Ruby on Rails 8.0 first beta release: A big bet on SQLite in production 

Ruby on Rails 8.0 first beta release: A big bet on SQLite in production 

Ruby on Rails 8.00 beta 1 has been released, with a strong emphasis on using SQLite in production web applications, for caching, queuing, and for the primary database.

According to Rails inventor David Heinemeier Hansson, “In the past, Rails needed either MySQL or PostgreSQL as well as Redis to take full advantage of all its features, like jobs, caching, and WebSockets. Now all of it can be done with SQLite.”

David Heinemeier Hansson compares Redis to SQLite at the recent Rails World event

The new SQLite-based options come in the form of three adapters called Solid Cable, Solid Cache and Solid Queue. 

Solid Cable is an adapter for Action Cable, which integrates WebSockets into a Rails application, enabling fast real-time communications. Solid Cable works with SQLite, MySQL and PostgreSQL.

Solid Cache is a cache store that is an alternative to Redid or Memcached. According to the documentation, the speed of modern SSDs makes it unnecessary to use a memory-based cache, and by using SSD the cache can be much larger. Again it can use SQLite, MySQL or PostgreSQL.

Solid Queue is a job queuing system, and supports the same three open source database managers as Solid Cable and Solid Cache. It will be configured by default in new Rails 8.0 applications.

The use of SQLite though goes beyond these three adapters. “At 37signals, we’re building a growing suite of apps that use SQLite in production,” write Hannsson, adding that there are now “thousands of installations of both Campfire and Writebook running in the wild that all run SQLite.”

SQLite is a file-based database manager and best known for use in embedded and desktop applications. It lacks the features of client-server database engines which make them robust and scalable with multiple remote users. The SQLite documentation states that “SQLite does not compete with client/server databases. SQLite competes with fopen().”

A single server web application though does not require all the features of client-server. “SQLite works great as the database engine for most low to medium traffic websites (which is to say, most websites),” the documentations claims, citing the SQLite web site itself which gets “400K to 500K HTTP requests per day, about 15-20 percent of which are dynamic pages touching the database.” As servers get faster and more capable, the effective limits of SQLite are constantly diminishing.

The argument here is not that SQLite should be used for every web application, but that it is suitable for many real-world cases.

Other new features in Rails 8.0 include a complete authentication system generator, and easier deployment using the container-based Kamal 2.