Earlier quoted context omitted.
"one lightweight SELECT per millisecond" This reminds me of the teenager who told her dad that she was just a tiny little bit pregnant.
One cannot be a little bit pregnant. But a DB can be only a little bit in the RAM, and specifically in the page cache. SQLite can act exactly like that, and it's damn fast as long as it does not need to durably write a transaction. Polling once a millisecond could spend a few microseconds. I wonder if using a tiny Redis instance, or even something like LevelDB would be even more efficient.
Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
61–69 of 69 posts
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#62I'm a big fan of SQLite and all that, but if SQLite constrains you to a single writer process, why not do this in your application layer anyway?
Why this constraint? Because SQLite is serverless. There is no central server available to coordinate concurrent writes.
At the lowest level of the stack, every database engine has this same constraint, as there is only one wire connecting the CPU to the SSD, and you cannot send multiple writes over the same wire at the same time. But in a client/server database, the server (in cooperation with the filesystem) is at hand to serialize the writes and prevent problems in ways that are not possible without a server. The server creates the illusion of concurrent writes by multiplexing the single write wire efficiently and making that multiplexing transparent to the application.
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#63Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#64"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".
Respectfully (thanks haha) - yeah probably right. Original intent was to use inotify type thing but i avoided per-platform differences at the outset. this was definitely a for fun project that blew up unintentionally and am working to harden/improve. Love Fly.
So yes, don't use this in a mobile device, or a server if you want to let the CPU enter a low power state.
Otherwise, a single thread doing this in an otherwise idle server, doesn't seem that terrible. And if it's not idle, inotify won't help you (need to query what changed afterwards).
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#65Why not just use https://github.com/conductor-oss/python-sdk provide durability, distributed and orchestration.
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#66Earlier quoted context omitted.
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.)
If this stops the core being able to drop to a lower power state it can be whole multiples of power use on some devices. 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
#67Earlier quoted context omitted.
Respectfully (thanks haha) - yeah probably right. Original intent was to use inotify type thing but i avoided per-platform differences at the outset. this was definitely a for fun project that blew up unintentionally and am working to harden/improve. Love Fly.
One of the things people seem to forget is that SQLite itself polls every millisecond or so to grab a lock. So yes, don't use this in a mobile device, or a server if you want to let the CPU enter a low power state. Otherwise, a single thread doing this in an otherwise idle server, doesn't seem that terrible. And if it's not idle, inotify won't help you (need to query what changed afterwards).
Re: Honker – Durable queues, streams, pub/sub, and cron scheduler in a SQLite file
#68Earlier quoted context omitted.
If this stops the core being able to drop to a lower power state it can be whole multiples of power use on some devices. Wake ups are death for mobile form factors, even if not really doing much work.
This is a pretty good argument against the way we do operating systems now, right?