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

[MEX-527] Memory Store Apollo plugin #1537

Open
wants to merge 4 commits into
base: MEX-527-refactor-pair-filtering
Choose a base branch
from

Conversation

mad2sm0key
Copy link
Contributor

@mad2sm0key mad2sm0key commented Dec 11, 2024

Reasoning

  • the API sufferes from performance degradation in high concurrent requests scenarios. This happens due to the high number of fields with resolver functions and the highly nested nature of certain models.
  • the method propsed below, is meant to reduce load with the following strategy :
  1. maintain certain complex models in a singleton (memory store)
  2. hook into the graphQL lifecycle (bypass the regular resolve route) and return the data directly from the memory store
  • this PR tackles point 2

Proposed Changes

  • add singleton that will hold all pairs, all esdt tokens and the mapping pair<>esdt_tokens in memory
  • add interface (actually abstract class) that describes the behaviour of a service capable of returning response from the memory store based on a graphQL query
  • add a memory store factory service that abstracts away the underlying memory store services
  • add Apollo server plugin that attempts to resolve queries (partially or completely) from the memory store using the memory store factory
  • append -store_partial or -store_full to the metrics key of queries resolved from the memory store

How to test

  • N/A

- add singleton that will hold all pairs, all esdt tokens and the relation between them in memory
- plugin that attempts to resolve queries (partially or completely) from the memory store
- add utils for working with ASTs found in the graphql context
- make sure profiler exists for all scenarios (use didResolveOperation hook)
- append '-store_partial' or '-store_full' to the metrics key of queries resolved from the memory store
@mad2sm0key mad2sm0key marked this pull request as ready for review December 12, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant