fix: use calibrated TSC frequencies for scheduler budgets - #550
fix: use calibrated TSC frequencies for scheduler budgets#550thweetkomputer wants to merge 3 commits into
Conversation
WalkthroughThe PR adds a private ChangesEloqStore linkage update
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
store_handler/eloq_data_store_service/build_eloq_store.cmake (1)
135-135: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why
absl::baseis required.The new private dependency is not self-explanatory. Add a short CMake comment that links it to EloqStore’s TSC-frequency calibration path in the selected upstream revision.
Proposed documentation
+# Required by EloqStore TSC-frequency calibration. target_link_libraries(eloqstore PRIVATE ${URING_LIB} ${BOOST_CONTEXT_TARGET} glog::glog jsoncpp_lib ${CURL_LIBRARIES} ${ZSTD_LIBRARY} ${AWSSDK_LINK_LIBRARIES} absl::baseAs per coding guidelines, document non-obvious operational and compatibility constraints, and explain why rather than restating syntax.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@store_handler/eloq_data_store_service/build_eloq_store.cmake` at line 135, Add a concise CMake comment immediately above the absl::base entry in target_link_libraries for eloqstore, documenting that it is required by EloqStore’s TSC-frequency calibration path and tied to the selected upstream revision. Keep the dependency and linking behavior unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@store_handler/eloq_data_store_service/build_eloq_store.cmake`:
- Line 135: Add a concise CMake comment immediately above the absl::base entry
in target_link_libraries for eloqstore, documenting that it is required by
EloqStore’s TSC-frequency calibration path and tied to the selected upstream
revision. Keep the dependency and linking behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a4ab4aba-064f-4415-b803-96bcaff5ffe9
📒 Files selected for processing (2)
store_handler/eloq_data_store_service/build_eloq_store.cmakestore_handler/eloq_data_store_service/eloqstore
Summary
sleep_for()-based TSC calibration with Abseil's calibrated raw TSC frequencyabsl::baseto the standalone txservice target's explicit dependencieseloqdata/eloqstore#495absl::baseinto the data_substrate-definedeloqstoreintegration targetRoot cause
Both Data Substrate and EloqStore divided elapsed TSC ticks by the requested
sleep_for()duration.sleep_for(1000us)is allowed to return later when the initializing thread is descheduled. Using 1000 rather than the actual monotonic elapsed time therefore overestimates the frequency. Repeated stable samples do not eliminate this systematic error when scheduler delay is similar between samples.An overestimated frequency makes the derived microsecond clock advance too slowly, so scheduler, cooperative-yield, work-loop, and delayed-request budgets can run late.
Abseil's calibration pairs raw TSC samples with actual monotonic-clock readings and retries with increasing measurement intervals. Its
NominalCPUFrequency()corresponds to the rawrdtscvalue used by both implementations.Build integration
Data Substrate defines its own txservice and embedded EloqStore targets. Both now declare the direct
absl::basedependency needed byNominalCPUFrequency(); the ARMcntfrq_el0paths remain unchanged.Dependency
12f1bdconagent/use-absl-tsc-frequencyand should be updated to the merged commit before this PR is merged.Impact
Data Substrate's scheduler clock and embedded EloqStore's work-loop clock are calibrated against actual elapsed time rather than requested sleep duration.
Validation
Local tests were intentionally not run; GitHub CI is expected to validate the amd64 and arm64 integrations.