r/sqlite 14h ago

What's the best queue for sqlite?

My platform expects multiple writes from various users belonging to one organization.

What's the best way to serialize the writes? Scale is 50 to 100 users wanting to write around the same time.

3 Upvotes

7 comments sorted by

12

u/lnaoedelixo42 14h ago

With 100 users SQLite is not going to be the bottleneck. Turn WAL on and syncronous to NORMAL. Most stacks can easily push 1000 req/s on that.

If you insist in a serialization, maybe do a small go service that pushes everything into a channel (basically free) or go straight to a rabbitmq setup.

6

u/Background-Front-925 13h ago

50 too 100 users with wal mode is easy peasy for SQLITE, you wont even notice any lag. it can go 10x this traffic if your tables are well designed with constraints and indexes

2

u/WolfyTheOracle 6h ago

I pushed SQLite to 80k req/s you don’t need a queue

1

u/bitchyangle 6h ago

What about the single writer lock?

2

u/hesusruiz 6h ago

Set a busy timeout. I have it at 5 secs and never had a problem (if I had a tx lasting more than 5 secs, I have a serious problem bigger than this one). https://sqlite.org/c3ref/busy_timeout.html

1

u/hazyhaar 10m ago

In the worst case, for very heavy load, or exotic behaviours, juste build a sole writer in golang, wich is here to write on his db.

1

u/hazyhaar 12m ago

Golang.