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

Add caching to bus/worker for hot endpoints #1151

Open
2 tasks
ChrisSchinnerl opened this issue Apr 2, 2024 · 0 comments
Open
2 tasks

Add caching to bus/worker for hot endpoints #1151

ChrisSchinnerl opened this issue Apr 2, 2024 · 0 comments
Assignees
Milestone

Comments

@ChrisSchinnerl
Copy link
Member

ChrisSchinnerl commented Apr 2, 2024

There are some things that the worker can easily cache in memory which would greatly reduce the impact on the database as well as shave a lot of latency off uploads/downloads. e.g. fetching the contracts upon download/upload takes around 100ms on a node like Arequipa with lots of contracts.

  • Settings
  • UL/DL params
  • Hosts we have contracts with for downloads

To achieve that we need a few more features

  • Webhooks in the bus that notify the subscriber of changes to settings, contract set etc.
  • Worker needs to register appropriate hooks and fetch the latest value. Maybe keep a sane cache invalidation value (e.g. 1 hour) which forces fetching the values synchronously.

I would start with the following PRs:

  1. Build cache in worker used by the download route for now. It should come with a way to invalidate the cache but for now the value should just always be considered invalid and the most recent value fetched from the bus
  2. Identify and add necessary webhooks for download route to reach 0 synchronous bus calls (except for the one that fetches the object metadata for now)
  3. Hook up cache to webhooks and test
@ChrisSchinnerl ChrisSchinnerl added this to the v2 milestone Apr 15, 2024
@peterjan peterjan self-assigned this May 21, 2024
This was referenced May 29, 2024
ChrisSchinnerl pushed a commit that referenced this issue Jun 3, 2024
This PR updates the `bus` to trigger a webhook when certain events
occur. This PR is part of a series of PRs that eventually implements a
worker cache #1151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants