New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App takes longer to boot on Ubuntu 18 #1969
Comments
I could partially solve the issue by setting this:
The workers start responding properly after about 2 minutes. However that really seems a strange startup time. We run this Rails app in production since 2015 and we were using DigitalOcean Standard 2vCPU. We have always used clustered mode and we had never increased the |
I have made more tests: after a restart Puma takes ~90 seconds before responding to the first request. During that time there is no CPU usage (i.e. top says 99.5 idle) and there is a lot of free RAM (i.e. top says 8GB free). So why the worker startup is so low? |
So, there's not really a bug in Puma, it's just that your app is suddenly taking a long time to start up? Does it take so long to start in another application server, like Unicorn? |
Also does the application boot quickly in single mode? That is, after it boots and you immediately send it a request, how long does it take for that request to return? |
The app is currently (today) running on the old servers (Ubuntu 16.04) without the need of
In single mode takes about the same time as in cluster mode (the only difference is that it returns |
I have tried with ruby 2.5 and the problem persists on the new server.
The problem is the same on all the new servers. Apart from hardware, the only difference is Ubuntu (on old server was 16.04LTS, on the new server is 18.04LTS). |
Another note: the startup time doesn't change if I increase or decrease the number of workers. |
🤷♂ Not really any evidence of a Puma issue here, though. Could be any one of a million things in your app thats different w/the new boxes. The new OS version especially - there's literally thousands of different new packages. If you try Unicorn and it boots in 10s, please let us know. The SIGINFO/log_thread_status changes on master may help you debug this eventually once we actually get that working on linux (#1964), until then you're stuck using gdb to figure out where it might be hanging. |
Yes, it might not be strictly related to Puma and it is also not related to our app (it's working fine on the previous servers). Now I have also realized that another similar issue happens on the new database server (Ubuntu 18.04): rake db:migrate takes about ~90 seconds (same time as Puma boot) to run, even when there are no migrations to run (on the previous server took only a few seconds). In general the performance of the new servers (tested with bechmarks, like redis benchmark) are very high. So this must be a bug specific to Rails / Ruby / Ubuntu 18. If you have any other suggestion on how to debug this would be appreciated. |
That task + booting the app both have to set up the Rails "environment". My guess is that You might try rbspy to see where the time is going. I think it would work well here. |
@nateberkopec Thank you! That command saved my day... The runner indeed takes 90 seconds, exactly the same. So I have tried to CTRL-C and it was clear that the process was stuck on Redis gem. After some investigation I found that there was this line in
That cache store was never used, but it was configured. The problem is that the host was pointing to a machine in the old datacenter: when we tried to connect from the old servers (located in the old datacenter), the connection was simply rejected immediately. However in the new datacenter, probably due to different firewall configurations, that line produced a long waiting for a response. |
Steps to reproduce
-w 2
)This is the only information that you see in the puma logs:
Expected behavior
Puma should work fine in cluster mode.
Actual behavior
Request hang forever and no response is received. Logs don't give enough information.
System configuration
Ruby version: 2.6.4
Rails version: 5.2.3
Puma version: 4.1.1
OS/version: Ubuntu 18.04 LTS
Server: DigitalOcean CPU-Optimized 4vCPU
The text was updated successfully, but these errors were encountered: