Unicorn Rails - Takes 100% CPU while starting in production mode

旧街凉风 提交于 2019-12-10 04:17:24

问题


We are using Unicorn_Rails + nginx. It works well in development mode and production mode in my system ( 4GB Ram , Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz) i am able to start 10 workers in local system but unable to start more than 2 in any case in production sometimes it works but need to wait for 15- 20 mts It takes 99.6% CPU all the time while starting unicorn_rails

Intel(R) Xeon(R) CPU E5507 @ 2.27GHz but it hangs in amazon ( m1.small instance ) 1.73 GB RAM

i find no one talking about a slow startup using unicorn_rails anywhere ...


回答1:


Rails startup is CPU-bound, it will (almost) always use 100% of CPU all the time. Looks like the load you are trying to put on that instance is too large; you only need 1 worker per CPU core, and m1.small has just one.

When you try to start 10 workers, they're sharing both CPU and I/O, and a lot of I/O requests always slows the subsystem down. You can add preload_app true clause in your config/unicorn.rb; this should lower the startup time, but you really do not need 10 workers on such an instance.



来源:https://stackoverflow.com/questions/6994321/unicorn-rails-takes-100-cpu-while-starting-in-production-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!