Skip to content

enable full percentile spectrum analysis on latency - #100

Merged
yossigo merged 4 commits into
redis:masterfrom
filipecosta90:hdr.hist
Aug 12, 2020
Merged

yossigo merged 4 commits into
redis:masterfrom
filipecosta90:hdr.hist

Conversation

@filipecosta90

@filipecosta90 filipecosta90 commented Nov 10, 2019 •

Copy link
Copy Markdown
Collaborator

Full percentile spectrum analysis

Fixes: #68
This PR enable full percentile spectrum analysis on query latency so that we can fully understand the performance and stability characteristics of the system we are measuring.

Right now memtier_benchmark is displaying single values targets like the average.
Considering that latency does not obey a normal distribution we should enable ourselves to do full percentile spectrum analysis. Just looking at a number might be misleading.

A useful visualization for pointing out the folly of chasing a mean measurement is illustrated below - they have nearly identical simple descriptive statistics, yet have very different distributions and appear very different when graphed.

image

Source: https://en.wikipedia.org/wiki/Anscombe%27s_quartet



Enabling full percentile latencies on memtier_benchmark:

The previous features can be applied with the changes added on this PR using the following added options:

      --hdr-file-prefix=FILE     Prefix of HDR Latency Histogram output files, if not set, will not save latency histogram files
      --print-percentiles          Specify which percentiles info to print on the results table (by default prints percentiles: 50,99,99.9)

@yossigo yossigo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@filipecosta90 Thanks for this PR, I've went through most of it (maybe not enough in detail in some parts though) and added a few comments.
Nitpicking: there are some extra white space and code style issues in this PR, it would be a good idea to re-review it and clean it up.

Comment thread memtier_benchmark.cpp Resolved
Comment thread memtier_benchmark.cpp Resolved
Comment thread run_stats.cpp Resolved
Comment thread run_stats.cpp Resolved
Comment thread run_stats.cpp Resolved
Comment thread run_stats.cpp Resolved
Comment thread shard_connection.cpp Resolved
Comment thread memtier_benchmark.cpp Resolved
Comment thread memtier_benchmark.cpp Resolved
Comment thread memtier_benchmark.cpp Resolved
Comment thread rate_limiter.cpp Resolved
Comment thread run_stats.h Resolved
Comment thread shard_connection.h Resolved
Comment thread shard_connection.cpp Resolved
Comment thread shard_connection.cpp Resolved
@filipecosta90 filipecosta90 changed the title enable full percentile spectrum analysis on latency. enable maintaining fixed rps during query benchmarks enable full percentile spectrum analysis on latency Jan 27, 2020
@filipecosta90

Copy link
Copy Markdown
Collaborator Author

Hi there @yossigo and @yaacovhazan-Redislabs I've pruned the PR and I believe it's ready for a new review.
I've updated the hdrhistogram to the latest official one ( v0.11.0 ), added a test case for the added features, and extended the PR to store per second latency/throughput metrics at the output json ( The stored percentiles comes from the --print-percentiles property ). Here is a snippet:

,"ALL STATS":{
		"Runtime":{
			"Start time": 1597016193374
			,"Finish time": 1597016207579
			,"Total duration": 14205
			,"Time unit": "MILLISECONDS"
			}
		,"Sets":{
			"Count": 182000
			,"Ops/sec": 12812.51
			,"Hits/sec": 0.00
			,"Misses/sec": 0.00
			,"Latency": 1.419
			,"Average Latency": 1.419
			,"Min Latency": 0.032
			,"Max Latency": 14.415
			,"KB/sec": 986.79
			,"Time-Serie":{
				"0":{
					"Count": 14225
					,"Average Latency": 1.29
					,"Min Latency": 0.54
					,"Max Latency": 6.43
					,"p50.00": 1.17
					,"p99.00": 3.73
					,"p99.90": 4.96
					}
				,"1":{
					"Count": 14739
					,"Average Latency": 1.23
					,"Min Latency": 0.10
					,"Max Latency": 7.78
					,"p50.00": 1.20
					,"p99.00": 2.62
					,"p99.90": 5.86
					}
(...)

WDYT?

@yossigo
yossigo merged commit 145c02b into redis:master Aug 12, 2020
@yossigo

yossigo commented Aug 12, 2020

Copy link
Copy Markdown
Contributor

@filipecosta90 Thanks a lot for this effort! It's a great improvement and definitely worth the effort and time invested in it.

fcostaoliveira added a commit that referenced this pull request Jun 6, 2026
Closes the round-14 R2/R3/R4/R5/R6/R7 coverage gap: the existing
read-preference suite only exercises the RESP2 path. tests/
test_read_preference_resp3.py adds three RESP3-specific cells gated by a
shared server_supports_resp3() capability probe in tests/include.py:

  - test_resp3_read_preference_secondary: --protocol=resp3
    --read-preference=secondary --ratio=0:1 -- asserts cmdstat_get on
    replicas > 0 AND on masters == 0.
  - test_resp3_read_preference_mget_secondary: adds --multi-key-get=10 to
    exercise RESP3 nil parsing on the cluster MGET replica path
    (closes the R3+R6 finding).
  - test_resp3_read_preference_secondaryPreferred_fallback: kills one
    replica via SHUTDOWN NOSAVE and asserts master_gets > 0 after, which
    proves the HELLO 3 reconnect ladder on a fresh shard succeeded.

Also adds a placeholder test_readonly_retry_resp2_resp3 in
test_read_preference_failover.py that env.skip()s with a TODO referencing
#100, since deterministic -READONLY orchestration requires precise
CLUSTER FAILOVER timing against an in-flight pipeline that RLTest does
not expose.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 25, 2026
)

On a cluster with replicas, memtier retries a -READONLY reply to the
slot's primary (ee757e7, #456), but no test proved that. The only check
was a placeholder in test_read_preference_failover.py that always
skipped, with a stale TODO(#100).

test_cluster_readonly_retry.py covers it with scripted peers on
ephemeral ports, under --protocol=resp2 and resp3: a replica A answers
SETs with -READONLY while B owns the key's slot. Every SET A got is
then rejected, and each one is accepted exactly once by B, including
SETs sent late, after the retry. Two decoy primaries, C (the seed) and
D (last in the map), own no key's slot and must get no SET, so a
resend to any other connection fails the test.

When a cluster cell expects replicas (--use-slaves, i.e.
OSS_CLUSTER_REPLICAS=1) but CLUSTER NODES lists none or can't be read,
get_cluster_replica_connections() now raises instead of returning []
and letting the read-preference tests skip green. It raises rather than
asserting because RLTest drops a failed assert when the test then
skips. Cells without replicas still skip. The README "Testing with
replicas" section and the helper docstrings describe the RLTest fork's
real cluster replicas.

Fixes #462

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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

Successfully merging this pull request may close these issues.

Provide more latency data in results

3 participants