-
Notifications
You must be signed in to change notification settings - Fork 27
Share Query Cache feature #250
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
Share Query Cache feature #250
Conversation
No tests for this? This is really important. In case if cached query reached wrong node it would be a huge problem, we need to be 100% sure that this is not happening. |
I have little knowledge how to write multi-node DO test. But we are using this feature many months in production. |
You can ask for help. I'll guide and help you, not a big deal.
No offence but it'd rather choose proper test than "it works in our environment". I don't know your environment, I don't know how you use it. As I said I'll help you with tests. |
Thank you. I hope I will have time to make tests. But now it is not high priority task |
I don't like how upper-level types like There is got to be a way to create an equivalent of the query created by DO by using SQLDOM and certain SqlDriver only, in this case it is impossible. |
case TypeInfo typeInfo: | ||
output.AppendPlaceholderWithId(typeInfo); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example this is completely inappropriate.
@@ -37,13 +38,13 @@ public class SqlCompiler : SqlDriverBound, | |||
/// <param name="unit">Instance to compile.</param> | |||
/// <param name="compilerConfiguration">Configuration for compiler.</param> | |||
/// <returns></returns> | |||
public SqlCompilationResult Compile(ISqlCompileUnit unit, SqlCompilerConfiguration compilerConfiguration) | |||
public SqlCompilationResult Compile(ISqlCompileUnit unit, SqlCompilerConfiguration compilerConfiguration, TypeIdRegistry typeIdRegistry = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also not ok, you have a configuration that wraps additional info for compilation. But no upper-level types should be used there.
I'm also thinking of having caches within nodes in cases when Logically the idea of separated caches fits the concept attachable/detachable node - once node is disposed the resources it occupied should be released too. |
I agree this is some kind of hack. But it just works, that is why I decided to use it. |
Can you list the parts of query you replace with placeholders or something similar to make query to be cacheable? |
|
Long time ago I did TypeId as parameter of query, but Alexander Ustinov said that there is something wrong with my implementation if applied to your case so i didn't merge it. Now I have a second thought that maybe it will somehow fit to this concept, ShareQueryCacheOverNodes requires basically two features combined - TypeIdAsParameter and ShareSchemaOverNodes, doesn't it? |
Looks like, yes |
I have improved TypeId As Parameter PR (#147), It is based on QueryParameterBinding now which is much better. |
Additionally, I was inspired by your idea and changed schema actualization, here's the PR (#289). I think we could combine these two. PRs (#147 and #289) and just introduce condition like var domainConfig = domain.Configuration;
this.queryKey = domainConfig.ShareSchemaOverNodes && domainConfig.PreferTypeIdsAsQueryParameters
? queryKey
: new Pair<object, string>(queryKey, session.StorageNodeId); in this PR. |
done |
Take a look at the implementation in |
The PR is ready - #290 |
Setting
DomainConfiguration.ShareQueryCacheOverNodes = true
enables to share compiled queries between nodes