Initial request to droplet extremely slow after longer periods of inactivity

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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…