Keeping a SQL budget
Because Calibre is all about the storage and retrieval of metrics at scale, its super important that we’re on top of, and aware of SQL performance at all times.
We thought we’d share a simple technique that we’ve been using that makes sure that Calibre is snappy to use.
Any database query that is more than 150ms will be written to the slow query log. That log is automagically transported (thanks to remote_syslog2) to papertrail — as soon as our search is matched, we’ll receive an email that contains the log line showing the offending query.
Simple logging and alerting can go a long way. Queries under 150ms might seem like a behemoth of a job on some applications, but we’ve been tracking against this budget on Calibre ever since it hit production.
Constant analysis of metrics means that anything major is caught immediately. 👀
Originally published at calibreapp.tumblr.com.