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

Addition of a cache layer between the APIs and Vitess #40

Merged
merged 12 commits into from
Dec 12, 2020
Merged

Conversation

frouioui
Copy link
Owner

@frouioui frouioui commented Dec 8, 2020

This PR contains the changes required by #38. A Redis Cluster is being implemented. Allowing the APIs to cache the request that are being made to Vitess.

@frouioui frouioui added enhancement New feature or request vitess Related to the Vitess cluster api Related to the system's APIs performance Everything relating to performance improvement or issue labels Dec 8, 2020
@frouioui frouioui self-assigned this Dec 8, 2020
@frouioui
Copy link
Owner Author

frouioui commented Dec 8, 2020

Some research about how to trace spans with Jaeger all the way to Redis has been done. The package https://godoc.org/github.com/opencensus-integrations/redis seems to contain a nice interface to send contexts.

Moreover, go-redis packages seem to handle cluster, cache, and open tracing natively. The following repo is a library for using Redis cache: https://github.com/go-redis/cache, and https://github.com/go-redis/redis is the usual Redis go package. The library official website shows how to integrate open tracing.

@frouioui
Copy link
Owner Author

The cache implementation made in 2e00f6e and e9ad379 allows a great decrease of the overall query time. Cache TTL was setup to 1 minute.

image

As we can see, the first trace does not contain cache. We cached Vitess' response, making the second span go much quicker.

Tracing is not yet implemented all the way to Redis.

@frouioui
Copy link
Owner Author

As #41 mentions, tracing all the way to Redis nodes wont be done in this PR.

A more optimal way to use Redis can be done in the redis.go file of both API's server package. A set and get function could take an interface.

@frouioui frouioui merged commit a7ddac9 into master Dec 12, 2020
@frouioui frouioui deleted the caching branch December 12, 2020 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the system's APIs enhancement New feature or request performance Everything relating to performance improvement or issue vitess Related to the Vitess cluster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant