Initial request to droplet extremely slow after longer periods of inactivity

April 9, 2015 1.6k views
Networking

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?

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...

Have another answer? Share your knowledge.