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

Add latency stats around cluster config file operations #1534

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

enjoy-binbin
Copy link
Member

When the cluster changes, we need to persist the cluster configuration,
and these file IO operations may cause latency.

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.

Project coverage is 70.94%. Comparing base (b207b42) to head (523f1e3).
Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
src/cluster_legacy.c 84.61% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1534      +/-   ##
============================================
+ Coverage     70.92%   70.94%   +0.01%     
============================================
  Files           120      120              
  Lines         65004    65028      +24     
============================================
+ Hits          46104    46131      +27     
+ Misses        18900    18897       -3     
Files with missing lines Coverage Δ
src/cluster_legacy.c 87.00% <84.61%> (+0.31%) ⬆️

... and 12 files with indirect coverage changes

When the cluster changes, we need to persist the cluster configuration,
and these file IO operations may cause latency.

Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin enjoy-binbin force-pushed the cluster_config_latency branch from 33047ce to 523f1e3 Compare January 9, 2025 04:39
server.cluster->todo_before_sleep &= ~CLUSTER_TODO_FSYNC_CONFIG;
if (valkey_fsync(fd) == -1) {
serverLog(LL_WARNING, "Could not sync tmp cluster config file: %s", strerror(errno));
goto cleanup;
}
latencyEndMonitor(latency);
latencyAddSampleIfNeeded("cluster-config-fsync", latency);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've only seen significant time taken in the fsync (both here and in the dir). Have you observed the other operations taking significant amounts of time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other one I see most is open (10ms - 5s), which seems to try to get the dir lock something like that. And write sometimes take a few ms. I haven't seen the others in the production environment but i think i do see other take a few ms in the test environment (i dont see the unlink one). I see we have a lot latency around AOF, fsync/rename/write/fstats, so i added it all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I suppose open does also make sense. I am thinking now that since AWS uses EBS volumes, we might see the same type of latency on IO operations that other distributions see.

@madolson madolson added the release-notes This issue should get a line item in the release notes label Jan 9, 2025
@hpatro hpatro changed the title Add latency around cluster config file save Add latency stats around cluster config file operations Jan 9, 2025
Copy link
Collaborator

@hpatro hpatro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add some sanity tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes This issue should get a line item in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants