-
Notifications
You must be signed in to change notification settings - Fork 123
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
Kotlin: Allow configuring delayPingLifetimeIo in Kotlin #2851
Conversation
b2f47b0
to
b8ac855
Compare
b8ac855
to
bf06ed3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please file a bug to document this in the Glean Book, let's not let that cause us to not be able to move fast here, though. Maybe also a follow-up bug to add the PING_LIFETIME_THRESHOLD
value to Nimbus so as to be able to tune it without needing to ship code-changes?
// We need to flush the ping lifetime data before a full shutdown. | ||
glean | ||
.storage_opt() | ||
.map(|storage| storage.persist_ping_lifetime_data()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, wonder if this'll uncover any bugs in Desktop tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one way to figure that out!
bf06ed3
to
bcc1733
Compare
We now automatically flush data to disk after 1000 writes into the in-memory ping-lifetime map. If `delay_ping_lifetime_io` is set to true, the data is now flushed to disk in these cases: * When `persist_ping_lifetime_data` is called by the application. * At shutdown (that calls `persist_ping_lifetime_data`) automatically. * Every 1000 writes * Calling `persist_ping_lifetime_data` resets the counter! The downside with `delay_ping_lifetime_io` is the increased risk of small windows of data loss: Data is only persisted so often, so if the process crashes or is killed in between the data is not persisted to disk and we will never know about. We do our best to still persist frequently (after enough writes, on ping submission, on background) and the application could decide to call `persist_ping_lifetime_data` on their own as well, e.g. on idle.
bcc1733
to
8f3ccdd
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2851 +/- ##
=======================================
Coverage 18.60% 18.60%
=======================================
Files 1 1
Lines 43 43
=======================================
Hits 8 8
Misses 35 35 ☔ View full report in Codecov by Sentry. |
For some documentation (also in the commit message):
Persist ping-lifetime data after 1000 writes
We now automatically flush data to disk after 1000 writes into the
in-memory ping-lifetime map.
If
delay_ping_lifetime_io
is set to true, the data is now flushed todisk in these cases:
persist_ping_lifetime_data
is called by the application.persist_ping_lifetime_data
) automatically.persist_ping_lifetime_data
resets the counter!The downside with
delay_ping_lifetime_io
is the increased risk ofsmall windows of data loss:
Data is only persisted so often, so if the process crashes or is killed
in between the data is not persisted to disk and we will never know about.
We do our best to still persist frequently (after enough writes, on ping
submission, on background) and the application could decide to call
persist_ping_lifetime_data
on their own as well, e.g. on idle.