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

Scheduler and worker #24

Merged
merged 85 commits into from
Mar 5, 2021
Merged

Scheduler and worker #24

merged 85 commits into from
Mar 5, 2021

Conversation

ana0
Copy link
Contributor

@ana0 ana0 commented Oct 20, 2020

This PR improves one of the largest bottlenecks in circles-api which is the indexing of trust connections (ca. 800k currently) between users.

Currently we pull the trust network data from our graph node, store it in a separate PostgreSQL database for faster querying and run the transfer path algorithm against this. The problem here is that we unnecessarily download all data, even of trust connections which haven't been updated at all. This puts unnecessary pressure on both the graph node, our database and the api process besides taking a large amount of time.

The solution to this problem is to listen to Ethereum events directly instead of relying only on the graph node and accordingly add / update / delete trust connections in the PostgreSQL database depending on the event.

To help with this a specificiation has been prepared, and is added in the PR

Additionally we put these updates into a worker queue to have more control over how much work the machine is actually doing and export a daily json file of the current trust network on S3 for external use.

Todos:

  • Implement worker and scheduler
  • Add worker task which dumps current trust network on AWS S3
  • Rebase this branch with current main
  • Revisit specification
  • Implement indexing algorithm following specification

adzialocha
adzialocha previously approved these changes Oct 20, 2020
@adzialocha adzialocha changed the title Log all request times Scheduler and worker Oct 23, 2020
@adzialocha adzialocha force-pushed the logging branch 2 times, most recently from 420e426 to 2eda7bc Compare October 26, 2020 11:04
@adzialocha adzialocha changed the title Scheduler and worker Feature: Scheduler and worker Oct 26, 2020
@adzialocha adzialocha marked this pull request as draft October 28, 2020 09:49
@adzialocha adzialocha added enhancement 🎇 New feature or request refactor 🐝 Existing parts made better labels Dec 9, 2020
@adzialocha adzialocha changed the title Feature: Scheduler and worker Scheduler and worker Dec 9, 2020
@ana0 ana0 marked this pull request as ready for review February 9, 2021 10:16
@adzialocha adzialocha self-requested a review February 15, 2021 12:15
Copy link
Collaborator

@adzialocha adzialocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎆 🎆 🎆 🎆 🎆 🎆

@adzialocha adzialocha merged commit c66b808 into main Mar 5, 2021
@adzialocha adzialocha deleted the logging branch March 18, 2021 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎇 New feature or request priority ★★★ refactor 🐝 Existing parts made better
Projects
None yet
4 participants