Skip to content

query: add experimental Select() cache#36

Open
GiedriusS wants to merge 1 commit into
v0.29.0+vintedfrom
v0.29.0+vinted_caching_exp
Open

query: add experimental Select() cache#36
GiedriusS wants to merge 1 commit into
v0.29.0+vintedfrom
v0.29.0+vinted_caching_exp

Conversation

@GiedriusS

Copy link
Copy Markdown

Add experiment support for caching select() requests. Only local tests for now. Cache works on matching identical request signatures. Data is cached only on io.EOF error; if something else occurs then the response is not cached.

Signed-off-by: Giedrius Statkevičius giedrius.statkevicius@vinted.com

Add experiment support for caching select() requests. Only local tests
for now. Cache works on matching identical request signatures. Data is
cached only on io.EOF error; if something else occurs then the response
is not cached.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
@GiedriusS GiedriusS force-pushed the v0.29.0+vinted_caching_exp branch from 462632b to 6f22322 Compare December 14, 2022 15:30
Comment thread pkg/extgrpc/client.go

// StoreClientGRPCOpts creates gRPC dial options for connecting to a store client.
func StoreClientGRPCOpts(logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, secure, skipVerify bool, cert, key, caCert, serverName string) ([]grpc.DialOption, error) {
func StoreClientGRPCOpts(logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, secure, skipVerify bool, cert, key, caCert, serverName string, maxCacheSize model.Bytes) ([]grpc.DialOption, error) {

@Titasp Titasp Dec 14, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style question, wouldn't it be better to refactor long function like this? (so that you wouldn't need to use horizontal slider to see all function params 😄 )

func StoreClientGRPCOpts(
  logger log.Logger, 
  reg *prometheus.Registry, 
  tracer opentracing.Tracer,
  secure, skipVerify bool, 
  cert, key, caCert, serverName string, 
  maxCacheSize model.Bytes,
) ([]grpc.DialOption, error) {
   //...
}

}
}

var fetchKeys = make([]string, 0, numKeys)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: var fetchKeys = ... -> fetchKeys := make([]string, 0, numKeys) ?

@Titasp Titasp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i trust u

@GiedriusS GiedriusS changed the title query: add experiment Select() cache query: add experimental Select() cache Dec 14, 2022
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.

2 participants