Webapps without databases

A web application without a database—at first, this sounds crazy, right? How could that even work? But when you start thinking about it, the idea becomes an appealing utopia. Imagine an application that is faster, easier to deploy, and simpler to maintain without the overhead of a traditional database. Not only would it be more cost-effective, but it would also be much easier to test. And these are just a few of the advantages. A great read on this topic is the article “Building a Highly-Available Web Service Without a Database.”

If you want to implement an app without a database, you’ll need to manage your data in cache. Caches are extremely fast but have one major downside: persistence. Once the app is down, all data is lost. Therefore, you need more than just a cache; you need tools like snapshots and transaction logs. While transaction logs alone might be sufficient, using snapshots in conjunction makes the process much faster.

Here’s the idea: store all your data in the cache, and periodically take a snapshot of the cache to save it to disk. Between snapshots, maintain a transaction log that records all changes to the data. If your app restarts, it first reads the snapshot and then replays the transaction log. This way, all your data is restored in the cache and ready for use.

I plan to implement a tool in Go that handles all of this. Here are the project milestones:

  1. Implement a caching mechanism that supports convenient functions (such as search, etc.).
  2. Implement transaction logs.
  3. Implement snapshotting.

The first step is to develop an easy-to-use caching system. The challenge here lies in implementing the generic part, especially since Go’s support for generics is relatively new (and I haven’t used it before). While this caching system might not be revolutionary, it could offer some significant benefits.

The next step is to make the cache persistent by adding the transaction log. I’m prioritizing transaction logs over snapshotting because this approach ensures no data is lost if the application shuts down. Snapshotting, as discussed earlier, is primarily a performance enhancement that speeds up app restarts.

I’m curious—what do you think about this project? Contact me and share your feedback! ;)