Where do the SQLite files live? Are you using some kind of NFS or EFS or similar for them? Sharding them across many machines?
How are you handling backups and high availability? Are you using Litestream?
How many SQLite files do your application servers have open at any one time?
SQLite is crazy fast in WAL mode, but it's because they use a memory-mapped file to coordinate consistency across multiple processes/threads. You can't mmap a remote file.
(Source: hacking in a DB replica workaround to PhotoStructure so people can store their library on arbitrary filesystems... BTW, I'd love to be wrong here: if someone's figured out how to do this, please share!)
I was wondering if maybe the cute hack that was posted recentlyish (https://news.ycombinator.com/item?id=27016630) to enable SQLite3 to access large remote databases over HTTP might be relevant, but that approach requires a small server to be sitting at the remote, and only implements read-only access in any case.
Now I'm wondering what an NFS/SMB translation of the above idea (which uses SQLite3's VFS hooks) might look like: ramp internal buffering to the max, use separate transient files (with eg date-based unique names) for each in-flight request, etc. Append-only journal files also come to mind...
It's crazy how flaky network filesystems are at the lower levels. Like, I use NFS at home every day, without Kerberos (which lets me enable encryption, which IIUC provides AEAD), all while knowing my data integrity entirely depends on the IP checksum computed by my 15 year old ISP router. :D
(I already know I need to upgrade. Shhh.)
Also, how do you handle migrations, both schema as well as data?
Two disadvantages that stand out for me are:
1. You must be able to scale the database up to your biggest customer and down to the your smallest this can be increasingly difficult to provision.
2. You are stuck with customers being isolated and makes it much harder to develop features that cut across a group of customers.
If you have a dynamic set of databases or even tables, be ready to invest into tooling to recreate features you take for granted in a normal database.
IIRC, Slack had a lot of scaling issues when they won a deal with IBM. Jumping from medium-size customers to such a behemoth will obviously be a challenge, but a lot of the difficulties they faced was non-technical and more business-related (“What do you mean, you want our product but not our monthly plan charged per seat?”). Anyway, that's a nice problem to have for a start-up ;).
I have no affiliation with the product, but I have been comparing alternatives and it seems like that's where it shines.
4. By splitting, you limit the exposure in case of SQL injection.
5. By splitting, you can have good performance for the customer who has 1M records, and good performance for the 100K customers with 10 records.
I've never used AWS RDS (or similar), but I had been thinking that part of the advantage of RDS was you didn't need to "keep the PG server up to date".
But apparently I was wrong! What does this look like on RDS?
Minor versions you can tell it a day and rough timeslot (few hours) for it to apply them. Major version upgrades always require you to start them, and the docs lay out prep work to do before hand (check for incompatibilities, setup any custom config before hand, take a backup/snapshot, do dry run)
One of the things I love with RDS is that last bit, doing a dry run with a clone of the database is fairly easy (can't say what it's like at the TB level of data, probably not as easy/quick) to test.
I'm currently wrestling with a 35TB Aurora DB and considering options for future growth. The system is multi-tenant and one of the options on the table is breaking out the tenants and hosting them on either their own system or alongside smaller subset of tenants.
Thanks for the suggestion of TiDB, haven't previously considered this but it looks interesting, will take a closer look.
(And oh wow I just realized the billing must be amazing...)
Can't say too much, but it's Financial Services related.
I guess this cues the stereotypical "have you looked at kdb+" question, then, which you've probably already fielded :)
IIUC, kdb+ does in fact have a real DB hiding in it, and it's not all just "weird programming language" - but it does seem to require/prefer a reasonable amount of buy-in to the way it does things to be valuable. I guess the lateral question is whether its performance obsession extends to smaller on-disk footprint, and whether the savings would be worth throwing out all the the existing Aurora integration work. (Answer: very probably not.)
I solved the problem by handling all the DB operations in a separate thread that handled write and read queues. It certainly was not as easy as using mysql/postgresql where server does everything for you. Nowadays there are probably plenty of libraries that handle that for you.
I remember a discussion here a few years ago about it, and there were so many voices chiming up to say 'we did this, terrible idea'.
We're doing this for multiple reasons: a) As our DB grew the service became very expensive, one of the biggest items in our AWS invoice; b) Keeping the PG servers up to date is a pain, we simply don't have time for this; c) We wanted to be able to migrate to other clouds and even be able to offer a self-hosted version of our platform.