Date: Sat, 02 May 2015 20:18:13 +0000 From: opendaddy@hushmail.com To: freebsd-questions@freebsd.org Subject: Rails app slow after PostgreSQL inactivity Message-ID: <20150502201813.91B9E42420@smtp.hushmail.com>
next in thread | raw e-mail | index | archive | help
Hi! I'm using Rails with PostgreSQL and I often get these 504 gateway timeouts (30+ secs) seemingly out of nowhere. I just noticed that this usually happens after my database has been inactive (say for half a day). After feeding my app some new content via its JSON API, speeds immediately return to normal (2-3 secs). How can this be? Could this be related to FreeBSD (DigitalOcean)? Are my PostgreSQL workers are going dormant? Do I need a cron script to act as a little ping pong ball bouncing back and forth making sure everybody's awake? Prior to all of this I've: - made sure I'm not querying any 3rd party services - confirmed it's not Nginx, Puma, or my network in general - looked for clues with rack-mini-profiler - confirmed it's not the "initial request" problem: http://stackoverflow.com/a/12903611 Thanks! O.D.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150502201813.91B9E42420>