Could this work with Turso, the SQLite rust rewrite?
Author here. Yeah doesn’t depend on the underlying db if it speaks SQLite.
Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
51–60 of 69 posts
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#52Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#53Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#54Earlier quoted context omitted.
That only catches changes made by the database connection being "hooked." This has a thread running in the background trying to catch changes made by other connections, potentially (I'm not sure here, but I suspect as much) in different processes that are modifying the same database.
good point. but ime and as seems to be widely understood writing from multiple connections is a bit of a minefield in SQLite. and afaik it still would be possible to have a hook on all connections you expect to be writing?
on my crappy old i5 with the db file on /dev/shm it can do ~150k writes a second with the wal_hook callback called on every write. and this is using JS bindings to C++ so has some unnecessary overhead.
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#55Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#56Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#57Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#58Earlier quoted context omitted.
That only catches changes made by the database connection being "hooked." This has a thread running in the background trying to catch changes made by other connections, potentially (I'm not sure here, but I suspect as much) in different processes that are modifying the same database.
good point. but ime and as seems to be widely understood writing from multiple connections is a bit of a minefield in SQLite. and afaik it still would be possible to have a hook on all connections you expect to be writing?
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#59Earlier quoted context omitted.
Yeah, I had the same instinct - this feels very much like a "nice idea" but the execution falls short. I mean - busily banging on sqlite like this? Shit at that point just use Redis.
What's the CPU usage? Like 2%? I had a manual fs polling thing a while back. It was ugly (low time budget, didn't wanna mess with the native watchers), just scanned the whole thing once per second. It averaged out to like 0.3% CPU. Not elegant, but acceptable for my purposes! (Small-ish directory, and "ping me within a second or two" was realtime enough for this use case.)
Wake ups are death for mobile form factors, even if not really doing much work.
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#60"Idle cost is that one lightweight SELECT per millisecond per database — no page-cache pressure, no writer-lock contention, no kernel file watcher in the mix." I think (respectfully) the LLM that probably wrote this overshot the mark here because busy-polling a select does not actually sound better to me than a "kernel file watcher".
…but some other push-based IPC mechanism would be a lot more battery friendly