zlacker

[return to "Choose Postgres queue technology"]
1. ritzac+L21[view] [source] 2023-09-25 08:17:43
>>bo0tzz+(OP)
I often see the "engineers copy FAANG infrastructure because they want to be cool, even though their needs are completely different" take as a kind of attack on engineers.

But I think a lot of it is also about knowledge and documentation. If I want to copy FAANG or another startup, and set up an infinitely scalable queue-based architecture, I can find dozens of high quality guides, tutorials, white papers etc, showing me exactly how to do it. Yes maintenance is higher, but I can get set up with redis, SQS, any of the 'scalable' solutions within a few hours of copy-pasting commands and code and configuration from a reputable source.

If I want to use NOTIFY in postgres? I googled "SQLALchemy notify listen postgres" and I find a few unanswered stackoverflow questions and a github gist that has some code but no context.

I would honestly love to use this approach for a side project, but I don't have 2-3 days to figure it out on my own. The direct choice for me might seem to be

* simple, but not scalable (ie just use postgres)

* complex, but scalable (ie redis, sqs, whatever)

and then it's a tradeoff, and the argument goes that I am blinded by cool tech and FAANG and I'm choosing complex but scalable, even though I don't need scalable.

But taking into account guides and other resources, the choice for me is actually

* complex and not scalable (this, because I don't know how to implement it and I can't predict what pitfalls I might face if I try)

* simple and scalable (what everyone actually does)

and that makes the engineer's choice to follow faang look a lot more reasonable.

◧◩
2. zozbot+y81[view] [source] 2023-09-25 09:14:47
>>ritzac+L21
> If I want to use NOTIFY in postgres?

The nice thing about "boring" tech like Postgres is that it has great documentation. So just peruse https://www.postgresql.org/docs/current/sql-notify.html . No need for google-fu.

◧◩◪
3. ritzac+2c1[view] [source] 2023-09-25 09:51:55
>>zozbot+y81
Python, Flask, SQLAlchemy, and Postgres all have great documentation individually, but if I am building an application at the intersection often a guide on exactly how to join them all up is much faster than using each individually and trying to figure out the interactions in four places.

AWS white papers and engineering blogs tend to give me everything I need in one place, and I don't think there are any for apps built with NOTIFY.

◧◩◪◨
4. sppras+fn3[view] [source] 2023-09-25 20:05:52
>>ritzac+2c1
SQLAlchemy is an extra abstraction blocking your path here. While you probably should still use an ORM for your regular relation queries, you are not gaining anything significant by trying to use SQLAlchemy for implementing a queue backend. You can write raw SQL with psycopg2 (which is already a dependency in your project thanks to SQLAlchemy), and wrap these raw queue management SQL in a nice little Python module which you can later reuse for other applications as well.
◧◩◪◨⬒
5. mixmas+iN3[view] [source] 2023-09-25 22:12:53
>>sppras+fn3
You can write raw SQL with SA, while keeping the other nice features it has.
◧◩◪◨⬒⬓
6. hmhmhm+5Z3[view] [source] 2023-09-25 23:25:45
>>mixmas+iN3
Without being rude, what are the nice features? I've worked with it a bit and constantly found myself wishing it was just SQL whenever I've bumped into it
◧◩◪◨⬒⬓⬔
7. mixmas+Sd4[view] [source] 2023-09-26 01:16:05
>>hmhmhm+5Z3
API/engine/connection/pooling abstraction, serialization, type checking, etc.

Look up the features of Core if interested. No ORM needed, as it says in the docs.

[go to top]