TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Streaming data in Postgres to 1M clients with GraphQL

192 pointsby tango12over 2 years ago

15 comments

tango12over 2 years ago
Streaming data to clients at the edge (apps or services) is a hard problem. We built an approach that keeps Postgres at the center and allows clients to consume a stream of data that is already in Postgres without any additional moving parts.<p>This works with read replica style scaling or with Postgres flavours that support scaling out easily (eg: Cosmos Postgres, Yugabyte &amp; cockroach coming soon).
benjaminwoottonover 2 years ago
I think there’s a huge unacknowledged gap in the database industry for good streaming products.<p>If we are building a report or dashboard that we pull up a few times a day then a pull based model where we query the database on page load is fine.<p>For almost anything else such as an app, a microservice, an alerting system, a web page, a dashboard, we want to be able to update it in near real time for the user experience. Receiving a stream of query results is by far the easiest way to do this.<p>Polling is obviously a poor interim solution.<p>I think streaming will be a huge story in data over the next decade. The products are coming through now which is a start.
评论 #33230458 未加载
评论 #33234205 未加载
评论 #33230119 未加载
评论 #33230114 未加载
评论 #33260327 未加载
maxpertover 2 years ago
While I love ingenuity of developers at Hasura (because I&#x27;ve been personally through these scaling challenges), I always get a gag reaction with GraphQL. I&#x27;ve honestly tried hard to digest it, and I can tell you at large scale where single DB won&#x27;t cut it, you would either need to develop a large federation layer like [Netflix](<a href="https:&#x2F;&#x2F;netflixtechblog.com&#x2F;how-netflix-scales-its-api-with-graphql-federation-part-1-ae3557c187e2" rel="nofollow">https:&#x2F;&#x2F;netflixtechblog.com&#x2F;how-netflix-scales-its-api-with-...</a>), or just rip-it out. Streaming might elevate the problem a little, but I real problem still lurks under the hood. The fact that front-end community wants to fit everything under GraphQL bothers me, because every backend developer knows that a single tool&#x2F;technology is usually not the best tool for solving all problems of your life. Remember the golden words, THERE IS NO SILVER BULLET!
评论 #33229820 未加载
评论 #33230827 未加载
评论 #33229891 未加载
评论 #33229956 未加载
评论 #33229714 未加载
评论 #33233334 未加载
评论 #33232264 未加载
gipover 2 years ago
I&#x27;ve been using Hasura in production for small commercial projects deployed on AWS and I&#x27;ve been positively impressed by the stability and the speed up - it makes spinning up a graphQL backend with row-level security straightforward.
评论 #33229924 未加载
评论 #33231084 未加载
agrippanuxover 2 years ago
My company is using this in production to stream messages&#x2F;online presence to our Unity game clients and it works very well.
评论 #33229545 未加载
dsandipover 2 years ago
FD: I work at Hasura.<p>Seeing some feedback on GraphQL - Hasura has had support for converting templated GraphQL into RESTish endpoints (with Open API Spec docs if needed). We are planning to do the same for this streaming API as well - does anyone have good examples of existing REST&#x2F;RESTish endpoints that something similar?
评论 #33231786 未加载
hsupermanover 2 years ago
I would have hoped to see some benchmark latency numbers. What does it mean to easily handle a 1M clients?
评论 #33230263 未加载
praveenwebover 2 years ago
We have written a post[1] on building a real-time chat app with Streaming Subscriptions on Postgres. It gives a quick overview of the architecture used and how you can leverage the API on the client side with AuthZ. There’s a live demo that you all can try out.[2]<p>[1] <a href="https:&#x2F;&#x2F;hasura.io&#x2F;blog&#x2F;building-real-time-chat-apps-with-graphql-streaming-subscriptions&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hasura.io&#x2F;blog&#x2F;building-real-time-chat-apps-with-gra...</a> [2] <a href="https:&#x2F;&#x2F;eclectic-dragon-25a38c.netlify.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;eclectic-dragon-25a38c.netlify.app&#x2F;</a><p>Would love to see more use cases coming out of this :)
tango12over 2 years ago
Has anyone come across neat tools for load-testing streaming APIs?<p>We used <a href="https:&#x2F;&#x2F;github.com&#x2F;hasura&#x2F;graphql-bench" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hasura&#x2F;graphql-bench</a> and a set of scripts to monitor runtime characteristics of Hasura and Postgres, and reconciliation to make sure data was received as expected and in-order.<p>But would love to see if there&#x27;s other tools that folks have come across!
atentatenover 2 years ago
How different is this from Supabase Realtime?
评论 #33233909 未加载
评论 #33232993 未加载
dinvladover 2 years ago
I believe they had a POC for this already a few years ago, but great to see the examples expanded, and seems like it’s more “prod-ready” now.
评论 #33229961 未加载
jitlover 2 years ago
It sounds like the stream must be an append-only table. This is awkward - I would expect streaming updated results for a query. If I want clients to refetch changed record in real time, do I still need to build that on top of this stream primitive? Like, I stream an audit log style table, and then refetch any IDs mentioned in the stream separately?
评论 #33229996 未加载
评论 #33230187 未加载
评论 #33228968 未加载
canadiantimover 2 years ago
This looks really cool and solves my major gripe with something like Hasura, which is the duplication of data.
评论 #33229437 未加载
midislackover 2 years ago
How does it do on the Pi4 4GB, the universal standard benchmark system?
rpd9803over 2 years ago
I sort of hate GraphQL. Multi-mutation syntax sucks, no select-all.. do not like.