-
Notifications
You must be signed in to change notification settings - Fork 82
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
Use the prepare cache to prepare on node add/up events #32
Comments
Where is the prepared cache stored? Also usual cache concerns like TTL, size ? |
I think I am going to answer my question. :-) It's proxy's in-memory prepared cache. However, I would still like to understand TTL, size so that we don't go OOM because of that. |
It lives in the proxy. It's currently infinite on both accounts. This sounds terrible, but in practice it's not as bad as it sounds because it tends to be really small (even with many entries). That said, I have an idea to make this more robust, but it might be overkill. |
Sized capped at ~100MB: 147ef72 |
In the existing code execute queries were just a pass-through. That means that if an unprepared error occurred it was just passed back to the driver. The problem is that an attempt to prepare that query again would be forwarded to a connection that was not the one that originally serviced the execute. This could cause a scenario where execute requests would never resolve from the unprepared state. The proxy fixes this by keeping its own cache and properly handling unprepared errors. This cache was push down into the `proxycore` because eventually we should add pre-preparing queries on add/up node events. This should be address in a follow up issue: #32
When adding a new node or restarting node its prepared cache is empty. This causes execution of prepare queries to fail with unprepared errors. We handle this at the proxy-level by handling unprepared errors with preparing the queries on the executing connection and re-executing the original request. This results in extra latency and it can cause a "stampeding herd" of preparing on the new node. To mitigate these issues we can prepare new and newly restarted nodes with the queries that are in the proxy's prepared cache before marking the node as available.
The text was updated successfully, but these errors were encountered: