I once was the CTO of a company that serviced about 100k requests per day across all our services. We grew to millions and eventually 10's of millions, but, somewhere along the way, an engineer on our team decided he wanted to build a queue off LISTEN/NOTIFY semantics in order to take advantage of strong consistency with the rest of our data model, which seemed reasonable given LISTEN/NOTIFY is not that hard to under…
Not saying this in a mean way: It seems to me this can be boiled down to "using things without understanding how they work doesn't scale". Yes, vanilla listen/notify doesn't scale. But the OP actually figured out how to make it scale. So your engineers don't have to. As the community builds, over time, distributed systems, it also understands which brick can do what, and it turns out that starting with less bricks an…
Postgres LISTEN/NOTIFY actually scales
41–50 of 99 posts
Re: Postgres LISTEN/NOTIFY actually scales
#42Much of the FUD around using LISTEN/NOTIFY in production comes from people who have never done so. It of course has its limits, and we should remain aware of them. Much like the limits of every piece of tech in our stacks. Choose database queue technology https://news.ycombinator.com/item?id=37636841
Re: Postgres LISTEN/NOTIFY actually scales
#43I went through this process when I was designing the sync server for Digital Carrot. In the end, I decided to just go with the simplest solution possible. In my case it's just a barebones Go gRPC service that uses an in memory channel to send notifications between connected clients. The reality is that this simple Go server will scale up to about 1000 simultaneously connected customers on about 2gb of RAM. I don't ex…
1000 connections is a fairly low number by modern standards, c10k “challenges” are like twenty years old by now. The real questions are: - how many messages per second are you processing on that 2gb machine (and using how many cpus)? - does your message processing involve transaction handling, including saving data ti disk durably? No offense but it really seems you’re comparing apples and oranges, with your use case…
My point here is that it is important to match the tech stack to the challenge you're facing. When I started thinking about how to solve this problem my first reaction was to design an overly complicated distributed message queue using PG Notify, Redis, Kafka or something along those lines. The key takeaway here is that I realized that I probably wouldn't end up with more than 1000 customers, so I just needed to design a system that could comfortably handle that level of traffic without much effort. If, by some miracle, my business goes crazy viral, I know that my cloud provider can probably handle up to 200,000 customers by just updating a slider in my dashboard, which is way more business than I want anyway.
Engineers love to fantasize about Google levels of scale, but that's just not realistic for a lot of services.
Re: Postgres LISTEN/NOTIFY actually scales
#44Earlier quoted context omitted.
The highest I could think of is WhatsApp, which gets ~1.6 million RPS on average, and they use MQTT
DynamoDB scales much more than that. In one of their dynamodb papers they claimed that the amazon us retail website alone made like 89 millions rps during prime day, a few years ago.
Re: Postgres LISTEN/NOTIFY actually scales
#45Earlier quoted context omitted.
Maybe there would be more if it were more straightforward to do so?
For reference, I've seen Visa marketing materials that suggest their network can do ~70k TPS. There are not very many systems one could conceive of that could do useful work 1/s for ~every human on the planet.
Roughly a hundred servers on 100 GbE ports each could handle one small UDP packet per human every second, and would have a plenty of cycles and RAM per human left to actually do some work.
That fits in a shipping container.
Illustrative of course: the point is that "for every human" is not far out there given how crazy powerful hardware has become.
Re: Postgres LISTEN/NOTIFY actually scales
#46I think a lot of these kind of posts are standalone assessment of your problems, understanding and solutions. Its debatable to term something as lack of expertise if one is trying to work with default settings of a tool and expecting a certain performance. Everyone is doing a continuous learning with the failures. 1. What I find interesting is that the experiment seems to be using a DB server with 96 cores, 384 GB RA…
Re: Postgres LISTEN/NOTIFY actually scales
#47Batching ensures you run at cpu & memory speeds and only pay significant latency for the flush - which usually linux kernel coalesces well if concurrent.
Re: Postgres LISTEN/NOTIFY actually scales
#48Earlier quoted context omitted.
For reference, I've seen Visa marketing materials that suggest their network can do ~70k TPS. There are not very many systems one could conceive of that could do useful work 1/s for ~every human on the planet.
> There are not very many systems one could conceive of that could do useful work 1/s for ~every human on the planet. Roughly a hundred servers on 100 GbE ports each could handle one small UDP packet per human every second, and would have a plenty of cycles and RAM per human left to actually do some work. That fits in a shipping container. Illustrative of course: the point is that "for every human" is not far out the…
> Roughly a hundred servers on 100 GbE ports each could handle one small UDP packet per human every second ...
While there is no correlation between the Visa claim of 70k tps to people on the planet, there is also no correlation to the number of servers needed to process UDP packets.
The "Visa network" is more of a trusted collaboration between a small number of banks operating multi-step transactions than it is an OSI Layer 1 - 5 concern.
Re: Postgres LISTEN/NOTIFY actually scales
#49Earlier quoted context omitted.
> There are not very many systems one could conceive of that could do useful work 1/s for ~every human on the planet. Roughly a hundred servers on 100 GbE ports each could handle one small UDP packet per human every second, and would have a plenty of cycles and RAM per human left to actually do some work. That fits in a shipping container. Illustrative of course: the point is that "for every human" is not far out the…
>> For reference, I've seen Visa marketing materials that suggest their network can do ~70k TPS. > Roughly a hundred servers on 100 GbE ports each could handle one small UDP packet per human every second ... While there is no correlation between the Visa claim of 70k tps to people on the planet, there is also no correlation to the number of servers needed to process UDP packets. The "Visa network" is more of a truste…