Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase concurrency handling while refetching state #1190

Closed
0x777 opened this issue Dec 12, 2018 · 6 comments
Closed

Increase concurrency handling while refetching state #1190

0x777 opened this issue Dec 12, 2018 · 6 comments
Assignees
Labels
c/server Related to server e/hard Will take weeks of effort k/enhancement New feature or improve an existing feature p/urgent Immediate action required

Comments

@0x777
Copy link
Member

0x777 commented Dec 12, 2018

No description provided.

@0x777 0x777 added k/enhancement New feature or improve an existing feature c/server Related to server p/urgent Immediate action required e/hard Will take weeks of effort labels Dec 12, 2018
@0x777 0x777 added this to the v1.0.0-alpha33 milestone Dec 12, 2018
@0x777 0x777 self-assigned this Dec 12, 2018
@dsandip dsandip removed this from the v1.0.0-alpha35 milestone Jan 11, 2019
@0x777 0x777 added this to the v1.0.0-alpha39 milestone Jan 29, 2019
@dsandip dsandip modified the milestones: v1.0.0-alpha39, v1.0.0-alpha40, v1.0.0-alpha42, v1.0.0-alpha41 Feb 28, 2019
@nicosuave
Copy link

Does this currently blindly poll every second + cache results in memory? https://github.com/hasura/graphql-engine/blob/master/server/src-lib/Hasura/GraphQL/Resolve/LiveQuery.hs#L112

@nicosuave
Copy link

Just spitballing, but might be worth tracking query dependencies (tables), as well as building a dependency graph of tables used in views. Then, read the wal log + find up matching queries to execute. Were y'all considering another approach?

@coco98
Copy link
Contributor

coco98 commented Mar 21, 2019

@nicosuave We had done something exactly like that earlier but realised that for anything with a high ingestion rate, it crumbles pretty quickly (both WAL and listen/notify) This apart horizontal scaling needs care to manage logical-repl slots etc, . https://github.com/hasura/pgdeltastream https://github.com/hasura/skor

The new update @0x777 is merging is going to be a huge improvement and a different approach. As soon as its merged we'll write up a blog on how it works. It'll allow a few thousand concurrent subscriptions to be multiplexed. We're benchmarking that versus a pure wal/listen-notify approach too. Will link you to it as soon as its out! 🤞 for monday.

@mike-thompson-day8
Copy link

mike-thompson-day8 commented Mar 22, 2019

If I understand correctly, the current approach (of brute force polling and associated diffing) trades off the cost of substantial CPU usage against the benefits of algorithmic simplicity and relatively low memory use.

Even when subscription queries are multiplexed (by which I assume you mean de-duplicated?), the tradeoff is unchanged (but less CPU and less memory is used in the extent that there's concurrent, duplicate queries).

If you are interested in exploring the alternative trade-off ... less CPU but more RAM, I'd point you towards the research done on "differential dataflow" (originally by Microsoft Research Labds but then carried on at ETH Zurich’s Systems group). There's a RUST implementation here:
https://github.com/TimelyDataflow/differential-dataflow
and a recent talk (assumes knowledge of Datalog-like databases):
https://www.youtube.com/watch?v=ZgqFlowyfTA

As far as I can tell (as a layperson), their work represents the current state of the art.

@shahidhk shahidhk modified the milestones: v1.0.0-alpha41, v1.0.0-alpha42 Mar 26, 2019
@coco98 coco98 changed the title improve subscriptions performance Increase concurrency handling while refetching state Mar 30, 2019
@ecthiender
Copy link
Member

@0x777 @coco98 we can close this right?

@rikinsk-zz rikinsk-zz removed this from the v1.0.0-alpha42 milestone Jun 6, 2019
@marionschleifer
Copy link
Contributor

I'm closing this issue. It has been fixed by this release: https://github.com/hasura/graphql-engine/releases/tag/v1.0.0-alpha45 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/server Related to server e/hard Will take weeks of effort k/enhancement New feature or improve an existing feature p/urgent Immediate action required
Projects
None yet
Development

No branches or pull requests

9 participants