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

Task - create a version of the cache shared between servers and based on redis #89

Closed
16 tasks
Tracked by #11
benoitdm-oslandia opened this issue Oct 21, 2022 · 3 comments · Fixed by #132
Closed
16 tasks
Tracked by #11

Comments

@benoitdm-oslandia
Copy link
Owner

benoitdm-oslandia commented Oct 21, 2022

Create a cache exploiting redis

In the case of a deployment with horizontal scalability, the cache will be different from one instance to another. To overcome this problem, we can use a Redis instance which will store the cache!

Useful links

Steps

Install a Redis server

  • Install a Redis server first

Implementation external to the project

Update configuration

  • Add process option or env variable to enable use of Redis cache
  • Add Redis configuration (toml)
  • Initialize the Redis connection

Set up an implementation logic

  • Set up an implementation logic

[GET] :
if the data is not available in the Redis cache,

  • we will look for it in the database
  • we save it in the Redis cache

image

[GET] :
if the data is not available either in the Redis cache or in the database, we save the information of non-existence in the Redis cache

image

[POST] :
we always save new data in the Redis cache

[PATCH | PUT] :
save the data modification in the Redis cache, by overwriting the old cache

👁️‍🗨️ Redis stores keys/values

  • Ex. etag: {...} // réponse json d'une collection

👁️‍🗨️ where to add the redis instructions?

we will use the available Cacher interface

Implement the new Cacher interface RedisCache

  • check : ContainsWeakEtag
  • set : AddWeakEtag
  • get : getRedis()
  • clear : RemoveWeakEtag

cf. comment: implementation examples

Add unit test

  • Add Redis cache usage test

Benchmark

  • Set up a benchmark with/without Redis cache

  • Charge test

Implementation internal to the project

  • Install K6

https://github.com/grafana/k6

  • Write K6 tests
    • Set up in CI
    • Visualization of results in K6 Cloud
@benoitdm-oslandia
Copy link
Owner Author

cloned from #77

@benoitdm-oslandia
Copy link
Owner Author

marked this issue as related to #77

@benoitdm-oslandia
Copy link
Owner Author

marked this issue as related to #11

@jmkerloch jmkerloch changed the title Task - créer un cache exploitant redis Task - create a cache exploiting redis Nov 8, 2022
@benoitdm-oslandia benoitdm-oslandia moved this to 🏗 In progress in OGC API - Features - Part 4 Nov 10, 2022
@benoitdm-oslandia benoitdm-oslandia linked a pull request Nov 10, 2022 that will close this issue
This was referenced Nov 10, 2022
Repository owner moved this from 🏗 In progress to ✅ Done in OGC API - Features - Part 4 Nov 18, 2022
@nick-rv nick-rv changed the title Task - create a cache exploiting redis Task - create a specific version of the cache shared between servers and based on a redis instance Dec 7, 2022
@nick-rv nick-rv changed the title Task - create a specific version of the cache shared between servers and based on a redis instance Task - create a version of the cache shared between servers and based on redis Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants