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

[#22537] YSQL: Benchmark restart read requests metric. #97

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

pao214
Copy link
Contributor

@pao214 pao214 commented Jul 30, 2024

Motivation

YugabyteDB provides read-after-commit-visibility guarantee as described by the read restart error section in Yugabyte Docs. This guarantee prevents the stale read anomaly and we need a mechanism to detect stale reads. Moreover, several optimizations are introduced into the database to reduce the number of read restart errors, and it is desirable to have benchmarks that demonstrate these improvements.

Changes

  1. A stale read detector app.
  2. A mechanism to throttle read and write throughput.
  3. A mechanism to execute read and write operations in lock step.
  4. Collector for read restart prom metrics.
  5. Cosmetic changes: use console style in the README, use YSQL where I could in comments.

Stale read detection example

Cluster Setup

To reproduce stale reads,

  1. Limit hybrid time propagation.
    a. Use replication_factor=1
    b. Use a single zone.
    c. heartbeat_interval_ms=10000
  2. Disable clock skew related checks.
    T-Server GFlags
    a. max_clock_skew_usec=0
    b. fail_on_out_of_range_clock_skew=false
    c. clock_skew_force_crash_bound_usec=0
  3. Simulate clock skew.
    a. sudo systemctl stop chronyd
    b. sudo timedatectl set-ntp false
    c. sudo date -s "$(date -d '+0.4 seconds' '+%Y-%m-%d %H:%M:%S')"

As a final step, verify the clock skew between the cluster nodes using the /tablet-server-clocks page of the WebUI.

Command

$ java -jar target/yb-sample-apps.jar --workload SqlStaleReadDetector --nodes x.x.x.x:5433,y.y.y.y:5433,z.z.z.z:5433 >& ../temp.log

Sample log output

... Stale read detected! ...
...
312689 [Thread-0] INFO com.yugabyte.sample.common.metrics.MetricsTracker  - Read: 1.07 ops/sec (215.67 ms/op), 300 total ops  |  Write: 55.06 ops/sec (18.09 ms/op), 17651 total
ops  |  Stale reads: x total ops | Num restart read requests: y | Uptime: 312638 ms |

@pao214 pao214 marked this pull request as draft July 30, 2024 18:45
@pao214 pao214 changed the title [#22537, WIP] YSQL: Benchmark restart read requests metric. [#22537] YSQL: Benchmark restart read requests metric. Jul 30, 2024
@pao214 pao214 force-pushed the clock_error branch 9 times, most recently from 3ceb30e to 1bcd769 Compare August 3, 2024 23:52
@pao214 pao214 marked this pull request as ready for review August 5, 2024 17:28
@pao214 pao214 requested review from pkj415 and sushantrmishra August 5, 2024 17:28
@pao214 pao214 force-pushed the clock_error branch 4 times, most recently from 30a1547 to 3437c11 Compare August 19, 2024 20:09
@pao214 pao214 force-pushed the clock_error branch 3 times, most recently from ad1e00c to f4e96d7 Compare August 20, 2024 01:09
@pao214 pao214 merged commit 07e5c09 into yugabyte:master Aug 20, 2024
1 check passed
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.

2 participants