我正在尝试将独角兽更改为puma,但是pdfkit有一个问题。使用pdf与独角兽,我必须从3个工人开始,但如果我做同样的美洲狮,它停止在55%。
这是我的美洲狮配置。
# 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])}谢谢你帮忙!
编辑:我做了其他的尝试,我创建了两个端点,1睡眠应用程序很多时间(/sleeprequest)和其他呈现一个基本的json (/examplerequest).。我从相同的配置开始,如果我使用/seleeprequest,,应用程序就会被阻塞,并且不接受/examplerequest.
在此之前,我有一个基本的conf (我不知道它是否会是一个问题):
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发布于 2017-05-08 09:02:53
尝试在config/application.rb文件中添加以下行:
config.allow_concurrency = true发布于 2017-05-08 08:45:25
我终于发现了我的错误!
我禁用了rails环境conf中的并发:
config.allow_concurrency = true一切都很好!问题是我无法处理并发请求。
https://stackoverflow.com/questions/43800618
复制相似问题