Closed flomonster closed 6 days ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Attention: Patch coverage is 2.38095%
with 41 lines
in your changes missing coverage. Please review.
Project coverage is 28.25%. Comparing base (
ec8e87e
) to head (f22880b
). Report is 1 commits behind head on dev.
Files | Patch % | Lines |
---|---|---|
editoast/src/views/v2/train_schedule/projection.rs | 4.34% | 22 Missing :warning: |
editoast/src/redis_utils.rs | 0.00% | 19 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
There is a limitation with this. I didn't find how to set the expiration time of Redis entry with a bulk command. So now the Redis entry expires after 1 week even if they're used recently.
I found a solution. We can use a transaction or pipe to execute all the commands simultaneously. Example with the CLI:
$ MSET hey 42 hi 43
$ MULTI
$ EXPIRE hey 10
$ EXPIRE hi 10
$ EXEC
A better solution is to set up an allkeys-lru
policy to let Redis handle this automatically.
Description
The idea is to bulk-get the cached projection to limit the number of queries performed to Redis.
Benchmark
Condition:
The
path_projection
performance doesn't seem to change (1.2s).Queries performances:
I think in production, because of queries overhead the difference will be far more important.
The number of Redis queries is reduced by the number of valid train schedule. (2211 -> 1532 queries). Next, I will do the same to retrieve the path and simulation from the cache (but this implies code refactoring).