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

fix: improve caching behavior of database integration #444

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Oct 1, 2024

This improves the caching behavior of the Lazy Load data system.

Previously, calling AllFlags or AllSegments updated an "allFlags" or "allSegments" key in the unscoped freshness tracker. That's correct, as those keys act as rate limiters for the "all" queries.

It then upserted each individual item in the unscoped freshness tracker.

This is not optimal, as the unscoped tracker is not referenced when we read individual items. This results in cache misses for individual items, even after they were all refreshed.

This change properly adds the individual items into the scoped tracker. Now, AllFlags or AllSegments should result in "priming" the cache for future individual item fetches.

This does have the behavior of syncing the TTL dates of all items to a single point in time.


Before:

[LaunchDarkly] lazy load via redis (JSON): get allFlags - cache miss
[LaunchDarkly] lazy load via redis (JSON): get allSegments - cache miss
[LaunchDarkly] lazy load via redis (JSON): get test - cache miss
[LaunchDarkly] lazy load via redis (JSON): get my-boolean-flag - cache miss

After:

[LaunchDarkly] lazy load via redis (JSON): get allFlags - cache miss
[LaunchDarkly] lazy load via redis (JSON): get allSegments - cache miss
[LaunchDarkly] lazy load via redis (JSON): get test - cache hit
[LaunchDarkly] lazy load via redis (JSON): get my-boolean-flag - cache hit

@cwaldren-ld cwaldren-ld marked this pull request as ready for review October 1, 2024 18:48
@cwaldren-ld cwaldren-ld requested a review from a team as a code owner October 1, 2024 18:48
@cwaldren-ld cwaldren-ld merged commit 5f47864 into main Oct 1, 2024
22 checks passed
@cwaldren-ld cwaldren-ld deleted the cw/SDK-728-improve-db-caching-perf branch October 1, 2024 19:40
@github-actions github-actions bot mentioned this pull request Oct 1, 2024
cwaldren-ld pushed a commit that referenced this pull request Oct 1, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-cpp-client: 3.7.0</summary>

##
[3.7.0](launchdarkly-cpp-client-v3.6.4...launchdarkly-cpp-client-v3.7.0)
(2024-10-01)


### Features

* add client-side C binding for fetching data source state
([#442](#442))
([e8ca616](e8ca616))


### Bug Fixes

* client init state should not regress when data source interrupted
([#441](#441))
([4a7f1f9](4a7f1f9))
* improve handling of streaming error state changes/logging
([#439](#439))
([04e7e0e](04e7e0e))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.8.2 to 0.8.3
    * launchdarkly-cpp-sse-client bumped from 0.5.2 to 0.5.3
</details>

<details><summary>launchdarkly-cpp-internal: 0.8.3</summary>

##
[0.8.3](launchdarkly-cpp-internal-v0.8.2...launchdarkly-cpp-internal-v0.8.3)
(2024-10-01)


### Bug Fixes

* improve handling of streaming error state changes/logging
([#439](#439))
([04e7e0e](04e7e0e))
</details>

<details><summary>launchdarkly-cpp-server: 3.6.1</summary>

##
[3.6.1](launchdarkly-cpp-server-v3.6.0...launchdarkly-cpp-server-v3.6.1)
(2024-10-01)


### Bug Fixes

* improve caching behavior of database integration
([#444](#444))
([5f47864](5f47864))
* improve handling of streaming error state changes/logging
([#439](#439))
([04e7e0e](04e7e0e))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.8.2 to 0.8.3
    * launchdarkly-cpp-sse-client bumped from 0.5.2 to 0.5.3
</details>

<details><summary>launchdarkly-cpp-server-redis-source: 2.1.13</summary>

##
[2.1.13](launchdarkly-cpp-server-redis-source-v2.1.12...launchdarkly-cpp-server-redis-source-v2.1.13)
(2024-10-01)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-server bumped from 3.6.0 to 3.6.1
</details>

<details><summary>launchdarkly-cpp-sse-client: 0.5.3</summary>

##
[0.5.3](launchdarkly-cpp-sse-client-v0.5.2...launchdarkly-cpp-sse-client-v0.5.3)
(2024-10-01)


### Bug Fixes

* improve handling of streaming error state changes/logging
([#439](#439))
([04e7e0e](04e7e0e))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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