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

instantaneous_ops_per_sec sometimes negative after 'CONFIG RESETSTAT' #1577

Closed
yoav-steinberg opened this issue Mar 4, 2014 · 0 comments
Closed

Comments

@yoav-steinberg
Copy link
Contributor

instantaneous_ops_per_sec sometimes negative after CONFIG RESETSTAT
tested on v2.8.6
To recreate, in one terminal window run this python code

import redis
r = redis.Redis()
import time
while True:
    r.ping()
    time.sleep(0.1)

and in another terminal window run:
redis-cli config resetstat; redis-cli info stats
You might need to repeat the commands above a few times to see it, but eventually you'll get some output like:

redis-cli config resetstat; redis-cli info stats
OK
# Stats
total_connections_received:1
total_commands_processed:1
instantaneous_ops_per_sec:-2
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0

Notice the negative ops_per_sec above.
This is most likely because we reset server.stat_numcommands and forget to reset server.ops_sec_last_sample_ops leading to negative values in the ops per sec calculation.

mattsta added a commit to mattsta/redis that referenced this issue Mar 6, 2014
This value needs to be set to zero (in addition to
stat_numcommands) or else people may see
a negative operations per second count after they
run CONFIG RESETSTAT.

Fixes redis#1577
@antirez antirez closed this as completed in e8bae92 Mar 6, 2014
antirez pushed a commit that referenced this issue Mar 11, 2014
This value needs to be set to zero (in addition to
stat_numcommands) or else people may see
a negative operations per second count after they
run CONFIG RESETSTAT.

Fixes #1577
antirez pushed a commit that referenced this issue Mar 11, 2014
This value needs to be set to zero (in addition to
stat_numcommands) or else people may see
a negative operations per second count after they
run CONFIG RESETSTAT.

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

No branches or pull requests

1 participant