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

'current_time' vs live time checks and edge cases #679

Open
dormando opened this issue May 13, 2020 · 1 comment
Open

'current_time' vs live time checks and edge cases #679

dormando opened this issue May 13, 2020 · 1 comment

Comments

@dormando
Copy link
Member

dormando commented May 13, 2020

the current_time variable is a monotonic counter that's updated once per second via a libevent timed event. It was added to avoid overhead of fetching the clock, especially on systems where that function is slow (not typically linux).

It's probably worth re-evaluating this, at least subtly.

  1. Benchmark under high thread load with current_time's most frequent usages replaced with a direct clock call. Is current_time a bottleneck on some systems due to false sharing/etc? Is that the same with the system clock?
  2. What systems still exist which have a slow clock? Any of the BSD's? Mac?
  3. For cases where SET'ing a 1s TTL, the expiration time can be anywhere from immediate to nearly two seconds. Is the overhead of a clock call low enough that we can check the "time since the last time current_time was updated" during a SET and increment the TTL where it makes sense? Ensuring an item will last for 1-2 seconds rather than 0-2 seconds (or 1-3 seconds if blindly incrementing).

Might be a fun task for a student or contributor. Make sure you use mc-crusher to really get the request rate high.

@dormando
Copy link
Member Author

#307 - was reported here years ago. users do actually run into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant