Unicorn Rails - Takes 100% CPU while starting in production mode
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 开发者_如何学JAVAbut it hangs in amazon ( m1.small instance ) 1.73 GB RAM
i find no one talking about a slow startup using unicorn_rails anywhere ...
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.
精彩评论