state: enforce 10 MiB log caps for thread and threadless process logs#12038
state: enforce 10 MiB log caps for thread and threadless process logs#12038charley-oai merged 13 commits intomainfrom
Conversation
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a55b4f043
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6274c296fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review this |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f63a77f11a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c87e90ac4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review this |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
jif-oai
left a comment
There was a problem hiding this comment.
Good for me. If the write load is too high we could run it only x% of the time as I don't think an overshoot is a big deal
codex-rs/state/src/runtime.rs
Outdated
| const LOG_PARTITION_SIZE_LIMIT_BYTES: i64 = 10 * 1024 * 1024; | ||
| // Estimated payload bytes used for partition caps. This intentionally ignores | ||
| // SQLite storage overhead and focuses on user-visible log content size. | ||
| const LOG_ROW_ESTIMATED_BYTES_SQL: &str = r#" |
There was a problem hiding this comment.
We could compute it up-front at insertion time to make the rest faster (read >> write)
8cf291c to
27153e6
Compare
Summary
thread_idin state log storageprocess_uuidfor threadless (thread_id IS NULL) logsSUM(...)precheck so windowed prune queries only run for keys that are currently over the capWhy
This keeps log growth bounded by the intended partition semantics while preserving a small, readable implementation localized to the existing insert path.
Local Latency Snapshot (No Truncation-Pressure Run)
Collected from session
019c734f-1d16-7002-9e00-c966c9fbbcaeusing local-only (uncommitted) instrumentation, while not specifically benchmarking the truncation-heavy regime.Percentiles By Query (ms)
insert_logs.insert_batchinsert_logs.precheck.processinsert_logs.precheck.threadinsert_logs.prune.processinsert_logs.prune.threadinsert_logs.prune_totalinsert_logs.totalinsert_logs.tx_begininsert_logs.tx_commitinsert_logs.totalHistogram (ms)<= 0.100<= 0.250<= 0.500<= 1.000<= 2.000<= 5.000<= 10.000<= 20.000<= 50.000<= 100.000> 100.000Local Latency Snapshot (Truncation-Heavy / Cap-Hit Regime)
Collected from a run where cap-hit behavior was frequent (
135/180insert calls), using local-only (uncommitted) instrumentation and a temporary local cap of10_000bytes for stress testing (not the merged10 MiBcap).Percentiles By Query (ms)
insert_logs.insert_batchinsert_logs.precheck.processinsert_logs.precheck.threadinsert_logs.prune.processinsert_logs.prune.threadinsert_logs.prune_totalinsert_logs.totalinsert_logs.total_cap_hitinsert_logs.total_no_cap_hitinsert_logs.tx_begininsert_logs.tx_commitinsert_logs.totalHistogram (ms)<= 0.100<= 0.250<= 0.500<= 1.000<= 2.000<= 5.000<= 10.000<= 20.000<= 50.000<= 100.000> 100.000insert_logs.totalHistogram When Cap Was Hit (ms)<= 0.100<= 0.250<= 0.500<= 1.000<= 2.000<= 5.000<= 10.000<= 20.000<= 50.000<= 100.000> 100.000Performance Takeaways
75%cap-hit calls),insert_logs.totalstays sub-10ms at p99 (8.901ms) and max (9.095ms).insert_logs.total_no_cap_hitp952.079ms) than cap-hit calls (insert_logs.total_cap_hitp955.547ms).insert_logs.totalrose from p953.623msto p955.103ms(+1.48ms), indicating bounded overhead when pruning is active.Codex author
codex resume 019c6792-fed7-76f3-b94c-c7f3df43bf66