Why ruby ​​processes are 100% CPU on passenger

I have a rails application (2.3.5) running on VPS with 4 cores with a frequency of 2 GHz and 4 GB. I am running nginx (0.7.61) and passenger phusion (2.2.14) on Ruby Enterprise (1.8.7-2010.01) with a maximum pool size set to 30. My problem is that it seems that every ruby ​​process that is being executed is requested rails runs at a speed of about 100%. If I run TOP, they go away every time the display is updated so that they do not hang themselves, but they still work 100%.

Is there any way to reduce this? Or at least figure out how much of the code the processor is diving into? Is this normal behavior?

Here is the TOP conclusion:

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                     
 2427 psadmin   25   0 91904  76m 2696 R  100  1.9 739:05.96 Rails: /var/www/apps/main_rails_app/current                                                                                                  
 3457 psadmin   25   0 98180  82m 2532 R  100  2.0 711:21.91 Rails: /var/www/apps/main_rails_app/current                                                                                                  
 2415 psadmin   25   0 93952  77m 2708 R   99  1.9 727:49.31 Rails: /var/www/apps/main_rails_app/current                                                                                                  
 3455 psadmin   25   0 99204  83m 2528 R   69  2.0 726:04.70 Rails: /var/www/apps/main_rails_app/current                                                                                                  
 2791 psadmin   16   0 98044  81m 2492 S   31  2.0   0:10.16 Rails: /var/www/apps/main_rails_app/current                                                                                                  
 8034 psadmin   15   0  8160 3656 1772 S    1  0.1   0:35.39 nginx: worker process                                                                                                                        
 8035 psadmin   15   0  8324 3696 1732 S    0  0.1   0:31.34 nginx: worker process                                                                                                                        
 2588 psadmin   15   0  197m 183m 2712 S    0  4.5   1:02.16 Rails: /var/www/apps/main_rails_app/current      

Thank!

Edit: Tried strace using the following forks as below. This is the output, which is reset again and again:

sudo strace -f -p 3455

clock_gettime(CLOCK_MONOTONIC, {394577, 508326476}) = 0
select(0, [], [], [], {0, 0})           = 0 (Timeout)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()   
+3
1

. , , ... strace pids.

+1

Source: https://habr.com/ru/post/1751011/


All Articles