Show HN: Drop-in SQS replacement based on SQLite
656 points| memset | 1 year ago |github.com
I wrote this because I wanted a queue with all the bells and whistles - searching, scheduling into the future, observability, and rate limiting - all the things that many modern task queue systems have.
But I didn't want to rewrite my app, which was already using SQS. And I was frustrated that many of the best solutions out there (BullMQ, Oban, Sidekiq) were language-specific.
So I made an SQS-compatible replacement. All you have to do is replace the endpoint using AWS' native library in your language of choice.
For example, the queue works with Celery - you just change the connection string. From there, you can see all of your messages and their status, which is hard today in the SQS console (and flower doesn't support SQS.)
It is written to be pluggable. The queue implementation uses SQLite, but I've been experimenting with RocksDB as a backend and you could even write one that uses Postgres. Similarly, you could implement multiple protocols (AMQP, PubSub, etc) on top of the underlying queue. I started with SQS because it is simple and I use it a lot.
It is written to be as easy to deploy as possible - a single go binary. I'm working on adding distributed and autoscale functionality as the next layer.
Today I have search, observability (via prometheus), unlimited message sizes, and the ability to schedule messages arbitrarily in the future.
In terms of monetization, the goal is to just have a hosted queue system. I believe this can be cheaper than SQS without sacrificing performance. Just as Backblaze and Minio have had success competing in the S3 space, I wanted to take a crack at queues.
I'd love your feedback!
[+] [-] davidthewatson|1 year ago|reply
+1 for k8s, kubernetes, cloud native, self-hosted, edge-enabled at low cost, no cost.
I ran rq and minio for years on k8s, but been watching sqlite as a drop-in-replacement since most of my work has been early stage at or near the edge.
Private cloud matters. This is an enabler. We've done too much already in public cloud where many things don't belong.
BTLE sensors are perfectly happy talking to my Apple Watch directly with enough debugging.
I'd argue the trip through cloud was not a win and should be corrected in the next generation of tools like this, where mobile is already well-primed for SQLite.
[+] [-] memset|1 year ago|reply
Asking from a business perspective - I of course intend to keep developing this, but am also really trying to think through the business case as well.
[+] [-] raihansaputra|1 year ago|reply
[+] [-] pfix|1 year ago|reply
[+] [-] hrisen|1 year ago|reply
[+] [-] memset|1 year ago|reply
[+] [-] dav43|1 year ago|reply
Makes me think quite positively of go lang and of the dev for designing in such a way. Can understand why teams like it because of easier maintenance
Quite elegant from my uneducated pov.
[+] [-] silisili|1 year ago|reply
A number of people don't like it for limiting their expression and abilities, which I understand that feeling too. But as a middle aged programmer I realized that readability trumps conciseness and cleverness in the long run.
[+] [-] memset|1 year ago|reply
[+] [-] unknown|1 year ago|reply
[deleted]
[+] [-] x-complexity|1 year ago|reply
- The dev for making it both fast & simple to understand
- Golang for making the codebase easy to follow
[+] [-] jerrygenser|1 year ago|reply
are you monetizing this as a separate business from: https://www.ycombinator.com/companies/scratch-data
[+] [-] memset|1 year ago|reply
But I started working this as something I wish existed as opposed to having some big VC strategy and pitch deck behind it.
(Also, I appreciate all of your feedback on this a month ago! It was really helpful to encourage me to keep looking into this and also figuring out the "first" things to launch with!)
[+] [-] Onavo|1 year ago|reply
[+] [-] 4RealFreedom|1 year ago|reply
[+] [-] cies|1 year ago|reply
So far I had not problems with ElasticMQ.
I'm much intrigued by the small LOC count of SmoothMQ. When I compare it to ElasticMQ it's much smaller (probably by using sqlite's features).
https://github.com/softwaremill/elasticmq
[+] [-] memset|1 year ago|reply
[+] [-] yimpolo|1 year ago|reply
I assume this would work without much issue with Litestream, though I'm curious if you've already tried it. This would make a great ephemeral queue system without having to worry about coordinating backend storage.
[+] [-] ahachete|1 year ago|reply
I also love writing AWS API-compatible services. That's why I did Dyna53 [1] ;P
(I know, unrelated, but hopefully funny)
[1] https://dyna53.io
[+] [-] selcuka|1 year ago|reply
[+] [-] bensmoif|1 year ago|reply
[+] [-] memset|1 year ago|reply
[+] [-] philippta|1 year ago|reply
Move all the structs from models/ into the root directory.
This allow users of this package to have nice and short names like: q.Message and q.Queue, and avoids import naming conflicts if the user has its own „models“ package.
[+] [-] memset|1 year ago|reply
[+] [-] pqb|1 year ago|reply
[+] [-] PanMan|1 year ago|reply
[+] [-] stuaxo|1 year ago|reply
I swear they reimplement stuff we have just so there are more places to bill us.
[+] [-] memset|1 year ago|reply
[+] [-] paulddraper|1 year ago|reply
10m requests for $4.
You will need hundreds of millions of requests per month for it to be noticable.
And can an implementation like this even help you at that point?
[+] [-] john-tells-all|1 year ago|reply
https://docs.localstack.cloud/overview/
[+] [-] crazysim|1 year ago|reply
[+] [-] mihaitodor|1 year ago|reply
[+] [-] andrewstuart|1 year ago|reply
single exectuable binary
golang with sqlite so fast
minimal config so no ridiculous hours or days of config and operations
This blitzes other ideas for use cases that do not require distributed queues - and that is likely many use cases.
[+] [-] koito17|1 year ago|reply
The "TODO: check for errors" comment, combined with what seems like disabling foreign key constraint checks, makes me a bit hesitant to try this out.
[+] [-] memset|1 year ago|reply
In practice, I did not find they were necessary - I was only using foreign keys to automatically CASCADE deletes when messages were removed. But instead of relying on sqlite to do that, I do it myself and wrap the delete statements in transactions.
There are many TODOs and error checkings that I will, over time, clean up and remove. I'm glad you've pointed them out - that's the great thing about open source, you at least know what you're getting into and can help shine a light on things to improve!
[+] [-] chromanoid|1 year ago|reply
[+] [-] westurner|1 year ago|reply
The celery Backends and Brokers docs compare SQS and RabbitMQ AMQP: https://docs.celeryq.dev/en/stable/getting-started/backends-...
Celery's flower utility doesn't work with SQS or GCP's {Cloud Tasks, Cloud Pub/Sub, Firebase Cloud Messaging FWIU} but does work with AMQP, which is a reliable messaging protocol.
RabbitMQ is backed by mnesia, an Erlang/OTP library for distributed Durable data storage. Mnesia: https://en.wikipedia.org/wiki/Mnesia
SQLite is written in C and has lots of tests because aerospace IIUC.
There are many extensions of SQLite; rqlite, cr-sqlite, postlite, electricsql, sqledge, and also WASM: sqlite-wasm, sqlite-wasm-http
celery/kombu > Transport brokers support / comparison table: https://github.com/celery/kombu?tab=readme-ov-file#transport...
Kombu has supported Apache Kafka since 2022, but celery doesn't yet support Kafka: https://github.com/celery/celery/issues/7674#issuecomment-12...
[+] [-] andrewstuart|1 year ago|reply
https://github.com/crowdwave/sasquatch
sasquatch is also a message queue, also written in Golang and also based on sqlite.
sasquatch implements behaviour very similar to SQS but does not attempt to be a dropin replacement.
sqsquatch is not a complete project though, nor even really a prototype, just early code. Likely it does not compile.
HOWEVER - sasquatch is MIT license (versus this project which is AGPL) so you are free to do with it as you choose.
sasquatch is a single file of 700 lines so easy to get your head around: https://raw.githubusercontent.com/crowdwave/sasquatch/main/s...
Just remember as I say it's early code, won't even compile yet but functionally should be complete.
[+] [-] mannyv|1 year ago|reply
I never cared to figure out what parts of SQS are clients-side and server side, but - does SmoothMQ support long polling, batch delivery, visibility timeouts, error handling, and - triggers? Or are triggers left to whatever is implementing the queue? Both FiFo and simple queues? Do you have throughput numbers?
As an SQS user, a table of SQS features vs SmoothMQ would be handy. If it's just an API-compatible front-end then that would be good to know. But if it does more that would also be good to know.
The reason you'd use this is because there are lots of clients who still want on-prem solutions (go figure). Being able to switch targets this way would be handy.
[+] [-] memset|1 year ago|reply
It implements many of these features so far (ie, visibility timeouts) and there are some that are still in progress (long polling.) a compatibility table is a good idea.
[+] [-] systemz|1 year ago|reply
[+] [-] memset|1 year ago|reply
Totally agree on adding more metrics and information to the UI - but how much of that should be on the dashboard vs exposed as a prometheus metric for someone to use their dashboard tool of choice?
I am not very good at visual design and have chosen the simplest possible tech to build it (static rendering + fomanticUI). I sometimes wonder if the lack of react or tailwind or truly beautiful elements will hold the project back.
[+] [-] deskr|1 year ago|reply
[+] [-] memset|1 year ago|reply
[+] [-] neuroscisoft|1 year ago|reply
My lab also developed an SQS-esque system based on the filesystem, so no dependencies whatsoever and no need for any operational system other than the OS. It doesn't support all SQS commands (because we haven't needed them), but it also supports commands that SQS doesn't have (like release all messages to visible status).
https://github.com/seung-lab/python-task-queue
[+] [-] encoderer|1 year ago|reply
[+] [-] rmbyrro|1 year ago|reply