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

Persistent compile cache #6493

Closed
1 of 6 tasks
fantix opened this issue Nov 16, 2023 · 2 comments
Closed
1 of 6 tasks

Persistent compile cache #6493

fantix opened this issue Nov 16, 2023 · 2 comments
Assignees

Comments

@fantix
Copy link
Member

fantix commented Nov 16, 2023

Objective

  • Compiled EdgeQL cache (SQLs) should survive server restarts, so that restarts won't cause potentially large drops in quality of service (like a slow query) when rebuilding the cache.
  • (secondary) Reduce server memory footprint and backend network load.

Proposal

Dynamically create individual SQL functions for each compiled EdgeQL (named/indexed by query / argument types hash and schema version) in order to replace the current in-memory LRUMapping. The EdgeDB server should keep an up-to-date list of cached queries (names of functions) to avoid extra round-trip to the backend checking the existence of the cache of a certain query, so that the server could either just execute that function (cache hit), or compile + create function + execute function (cache miss) with minimal I/O to the backend, when handling an EdgeQL query request.

Action items

  • Test how well Postgres handles concurrent changes to the functions table under load
  • Design for multi-backend-tenancy (multiple EdgeDB servers on one backend) - basically a notification for other tenants to reload what's cached in the backend
  • Design the cleanup of the "cache" (functions table) when hitting maxsize
  • Make sure prepared statements work fine
  • Benchmark to see how the design performs
  • Use CALL Postgres protocol message to call the cached funcs
@msullivan
Copy link
Member

We have merged a working persistent cache, but need some additional work to get functions working.

@msullivan
Copy link
Member

msullivan commented Jul 3, 2024

Current issues:

msullivan added a commit that referenced this issue Sep 24, 2024
Whenever postgres skips a DROP because IF EXISTS fails, it emits an
INFO. Since this happens every time a query cache misses, I found this
annoyingly noisy.

Make those operate by using an explicit condition check instead. Doing
this required removing a check that converted such checks into IF
EXISTS as well as fixing some problems with our checks.

This is one of two checkboxes left on #6493, I think, the other being
a flake I dimly remembered, so we can probably close that?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants