Initial request to droplet extremely slow after longer periods of inactivity

Posted April 9, 2015 3.4k views

I’m running this Rails app on DO (FreeBSD). Lately I’ve been experiencing extremely slow initial requests after longer periods of inactivity. Subsequent requests are fine.

At first I thought it was my PostgreSQL database or the Rails app itself, but now I doubt that’s the case as I just realized SSH connections made simultaneously with those initial requests are equally slow.

Has anybody ever encountered anything similar?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Your box might be starting to “grind” using swap space memory after awhile (i.e. running low on RAM), that might explain both being slow. If your question is whether the initial request is a network weirdness, you could leave a console logged in “for quite awhile” (until you anticipate the problem) then run a curl command like $ curl http://localhost:port/my_page and see if that’s fast or not (since it doesn’t do any outside networking). It’ll probably be slow…