-
Problems with a backoff busy handler
In the process of getting the non-blocking
Continue reading …busy_timeout
from thesqlite3
gem used in Rails, I needed to explore the differences between a busy handler implementation that uses a backoff and one that simply polls on a consistent interval. What I found was that a busy handler that backs off kills “tail latency” (how long it takes for the operation in the worst cases). This is because the SQLite “retry queue” behaves very differently from a more traditional queue that we tend to work with and think about, like a background job queue. -
Update to Litestream gem
Version 0.5.1 of the Litestream is out. The 0.5.x versions of the gem adds a new
Continue reading …restore
command along with some useful introspection commands, making it simple to restore a database from a remote backup. This is a huge feature that makes Litestream even more useful. -
The how and why of optimal performance
Continue reading … -
Update to Solid Errors
Version 0.4.2 of Solid Errors is out. The 0.4.x versions of the gem adds a number of awesome new features, most notably email notifications. If you need a self-hosted error tracking solution for your Rails application, Solid Errors is a great choice.
Continue reading … -
Isolated connection pools
If you want to squeeze as much performance out of your SQLite on Rails application, at some point you will need to confront the problem of writes saturating your connection pool. Let’s dig into this problem and how to solve it with some clever usage of Rails’ multi-database support.
Continue reading … -
Introducing Solid Errors
Solid Errors is a Rails engine that provides a dashboard for viewing and resolving exceptions in your Rails application without the need for an external 3rd party service. With version 0.3.0, I am happy to announce that Solid Errors is now ready for production use.
Continue reading … -
Radio Pills with Tailwind
Here is a quick tip on building “radio pills” with TailwindCSS, inspired by Scott O’Hara’s brilliant work. The goal here is to make an accessible form element that also has visual polish and purpose.1
Continue reading … -
Rails security quick wins
I recently launched a major new feature for an application I maintain at $dayjob, and I needed to ensure that the application followed current basic security best practices. It took me a couple of hours to track everything down, so I thought I would document it here for future reference. So, let’s dig into some quick wins for Rails security.
Continue reading … -
Rails engine migration generator with support for multiple databases
Rails supports multiple databases. This means you can specify which database to point a migration at when you use a generator (e.g.
Continue reading …bin/rails generate migration CreateDogs name:string --database animals
). For gems, when you are creating a Rails engine, you will often need to create some tables, so you register a generator to install the migrations (e.g.bin/rails generate my_gem:install
). I want to ensure that the generator I am providing from my engine/gem allows the user to specify a specific database, and my gem respects that. With the help of some folks from Twitter, I figured out the requirements. -
Non-blocking timeout
Last month I released version 0.4.0 of the
Continue reading …activerecord-enhancedsqlite3-adapter
gem, which added support for a non-blockingbusy_timeout
to the SQLite adapter in Rails. As with all of my lower-level SQLite work, the goal is always to push these solutions into the foundations of the ecosystem so that everyone can benefit from them. In this case, I’m happy that thebusy_timeout
feature has made its way into thesqlite3
gem, which is the most popular SQLite gem for Ruby.