2017-05-05 2 views
1

나는 변화를 유니콘 퓨마에 노력하고있어를 사용하는,하지만 난 pdfkit에 문제가 있습니다. pdf를 unicorn과 함께 사용하려면 3 명의 직원과 함께 시작해야하지만, puma와 동일한 작업을 수행하면 55 %로 중단됩니다.구성 푸마는 pdfkit

이것은 내 푸마 설정입니다. 시작시

# config/puma.rb 
port 3000 
threads 0, 16 
workers 3 

내 로그 :

=> Booting Puma 
=> Rails 4.2.6 application starting in development on http://localhost:3000 
=> Run `rails server -h` for more startup options 
=> Ctrl-C to shutdown server 
[23551] Puma starting in cluster mode... 
[23551] * Version 3.8.2 (ruby 2.3.1-p112), codename: Sassy Salamander 
[23551] * Min threads: 0, max threads: 16 
[23551] * Environment: development 
[23551] * Process workers: 4 
[23551] * Preloading application 
[23551] * Listening on tcp://localhost:3000 
[23551] Use Ctrl-C to stop 
[23551] - Worker 0 (pid: 23571) booted, phase: 0 
[23551] - Worker 1 (pid: 23580) booted, phase: 0 
[23551] - Worker 2 (pid: 23589) booted, phase: 0 
[23551] - Worker 3 (pid: 23598) booted, phase: 0 

그리고 난 PDF 파일을 만들려고 할 때 로그 (이 완료되지 않습니다).

Completed 200 OK in 40ms (Views: 4.2ms | ActiveRecord: 5.7ms) 
[=================================>       ] 55% 
내 레이아웃에 내가 (그것은 헤더와 같은 응용 프로그램에 바닥 글 비아 요청 렌더링 것) 같은 것을 사용하고 있는지 말을 내가해야

다른 것 :

- if request_from_pdfkit? 
    %meta{:name => 'pdfkit-header_html', :content => pdf_header_url(:protocol => 'http', :codigo =>params[:title])} 
    %meta{:name => 'pdfkit-footer_html', :content => pdf_footer_url(:protocol => 'http', :codigo =>params[:title])} 

감사합니다 도와주기 위해!

편집 : 내가 다른 시도, 내가 2 엔드 포인트, 1 개 수면 응용 프로그램 많은 시간 (/sleeprequest)과 창조 않았다 다른 기본 JSON (/examplerequest)를 렌더링합니다. 동일한 설정으로 시작했는데 /seleeprequest을 실행하면 앱이 차단되어 /examplerequest을 허용하지 않습니다.

나는 (이 문제가 될 수 있다면 나도 몰라)이 기본 conf의와 그 전에의 nginx 있습니다

location/{ 
    proxy_pass http://127.0.0.1:3000; 
    proxy_set_header Host $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    } 

그리고 내 프로세스

나는 마침내 발견
ps aux | grep puma 
alejand+ 29391 2.1 1.2 573648 206572 pts/22 Sl+ 10:18 0:07 puma 3.8.2 (tcp://localhost:3000) 
alejand+ 29413 1.0 2.2 1193920 365412 pts/22 Sl+ 10:18 0:03 puma: cluster worker 0: 29391 
alejand+ 29422 0.5 1.9 1180024 313324 pts/22 Sl+ 10:18 0:01 puma: cluster worker 1: 29391 
alejand+ 29431 0.5 2.0 1180024 329728 pts/22 Sl+ 10:18 0:02 puma: cluster worker 2: 29391 
+0

내가 문제가 응용 프로그램 서버에 관련이 있다고 생각하지 않습니다. devlopment.log 또는 production.log 또는 puma.log에서 pdfkit의 오류 로그를 찾아 우리에게 보여주십시오. –

+0

Pdfkit는 오류를 표시하지 않습니다. 뷰를 렌더링하려고 시도하는데 3 인이 필요합니다. 주 요청은 1이고 머리글과 바닥 글은 2입니다. 유니콘과 3 명의 직원이 근무하고 있습니다. 나는 내가 설정에 문제가 있다고 생각한다. – AarmenterosR

답변

2

config/application.rb 파일에서 선 아래 추가하려고 :

config.allow_concurrency = true 
1

내 오류를 !

나는 conf의 환경 레일에 cocurrence을 비활성화 한 :

config.allow_concurrency = true 

모든 것이 잘 작동!. 문제는 동시 요청을 처리 할 수 ​​없다는 것이 었습니다.