[ 
https://issues.apache.org/jira/browse/PHOENIX-8078?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Kyle Purtell updated PHOENIX-8078:
-----------------------------------------
    Summary: Pherf Harness: Phase 2: Single client Pherf enhancements and fixes 
 (was: Pherf Harness: Phase 2)

> Pherf Harness: Phase 2: Single client Pherf enhancements and fixes
> ------------------------------------------------------------------
>
>                 Key: PHOENIX-8078
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-8078
>             Project: Phoenix
>          Issue Type: Sub-task
>          Components: harness, pherf
>    Affects Versions: PHOENIX-8070
>            Reporter: Andrew Kyle Purtell
>            Assignee: Andrew Kyle Purtell
>            Priority: Major
>
> This subtask updates single client Pherf for Phoenix performance testing 
> while preserving backward compatibility with existing scenario files, command 
> line invocations, and report parsers. It also fixes several long standing 
> functional bugs and adds column bindings for array, encoded binary, JSON, and 
> BSON data types.
> Operation latencies are recorded in microsecond resolution HDR histograms and 
> written to a versioned JSON report alongside raw histogram interval logs.
> Execution gains an isolated warmup phase, an opt-in JDBC connection cache, 
> and an open loop arrival scheduler that separates service time from 
> end-to-end response time. Deterministic key co-generation lets reader threads 
> compute the exact keys written by producer threads without shared state, 
> supporting point lookups as well as rangeĀ {{SCAN}} and {{DELETE}} workloads.
> Workload profiles and command line launch overrides allow traffic adjustments 
> without editing scenario XML, and an offline validator also runs as a 
> preflight check. Each run writes a structured health verdict, an offline 
> analyze mode compares replicate sets with percentile bootstrap confidence 
> intervals, and the legacy detail report now uses linear rather than quadratic 
> memory.
> All new features are opt-in so that existing scenarios without the new 
> configuration elements run with their original semantics.
> Several defects in existing Pherf behavior are addressed with the inclusion 
> of a new regression test for each:
>  * SQL schema files read from a filesystem path now preserve line breaks so 
> single-line comments do not corrupt following SQL statements, and scenario or 
> schema arguments passed as absolute paths are resolved directly.
>  * Query execution and query-set pre-run DDL statements inherit the tenant ID 
> declared on the scenario instead of falling back to a null tenant. Pre-run 
> DDL runs once per tenant, retries failing statements a fixed three times 
> before halting with an error message naming the affected tenant and view, and 
> scenarios without a load profile no longer throw an exception.
>  * A {{userDefined}} column rule no longer leaks state into subsequent 
> columns, and {{SEQUENTIAL}} value generators keep independent counters per 
> table and column instead of sharing a single counter.
>  * Classpath resource discovery works consistently across packaged JARs and 
> unpacked directory trees, skips unreadable entries instead of aborting, and 
> retains support for the absolute path patterns used by callers such as the 
> harness.
>  * Writing to a column whose data type has no matching generation rule aborts 
> with a clear error naming the column instead of failing with a 
> {{{}NullPointerException{}}}.
> Synthetic data generation and JDBC parameter binding now cover float and 
> double arrays, {{{}VARBINARY_ENCODED{}}}, {{{}JSON{}}}, and {{BSON}} columns. 
> To preserve binary compatibility, the new type mapping constants are appended 
> to the end of the enum so existing ordinals do not shift, and the existing 
> XML length and bounds attributes govern array dimensions, binary payload 
> sizes, and document lengths without introducing new XML tags.
> Every generated value comes from the seeded random source for reproducible 
> datasets. Payloads for {{VARBINARY_ENCODED}} columns are encoded as 
> hexadecimal strings so embedded zero and 0xFF bytes cross the wire without 
> corruption. A shared document builder populates both {{JSON}} and {{BSON}} 
> columns with a consistent layout so queries can target predictable document 
> paths.
> Three Java {{ServiceLoader}} interfaces in {{org.apache.phoenix.pherf.spi}} 
> let deployments plug in a custom JDBC connection provider, append custom 
> report sections, or stream measurements to an external telemetry sink. 
> Individual query sets can also specify their own connection properties so 
> different workload groups within one scenario can use distinct JDBC driver 
> settings. When no SPI providers are registered and no per-group connection 
> properties are set, runtime behavior and generated outputs remain identical 
> to earlier Pherf releases.
> Every successful operation duration is recorded in {{HdrHistogram}} instances 
> keyed by operation identity and execution phase, keeping warmup activity 
> separate from steady-state measurements. The recorder uses fixed parameters 
> across all runs, so histograms from independent runs or distributed processes 
> can always be merged without precision loss. At the end of a run, Pherf 
> writes a version 1 pherf-latency JSON report listing the sample count, 
> minimum, maximum, mean, p50, p90, p99, and p99.9 in microseconds for each 
> key. High percentiles are omitted when the sample size is too small to be 
> meaningful, and the report includes the recorder settings along with the 
> effective arrival schedule for open loop query sets. Alongside the JSON 
> summary, the reporter writes a full run histogram log and, when interval 
> logging is enabled, a periodic interval log in standard {{HdrHistogram}} log 
> format, logging only the first I/O error if an interval write fails.
> Setting {{warmupExecutions}} on a query set adds a warmup phase in which 
> every worker thread runs the configured number of unmeasured iterations per 
> query before steady state measurement starts, keeping initial connection 
> setup and JVM JIT compilation out of steady state latency histograms. The 
> no-argument {{-connectionCache}} flag wraps the active connection provider in 
> a pooling decorator that reuses idle JDBC connections matching both the 
> connection URL and the property map (preserving tenant isolation), up to 
> {{pherf.default.threadpool}} idle connections.
> In closed loop testing, request submission slows down whenever the server 
> slows down, hiding client side queueing delay (the coordinated omission 
> problem). Adding an optional {{<openLoop>}} block to a query set switches 
> execution to a stage based arrival scheduler. A single constant rate stage 
> drives uniform traffic, successive flat stages form step ladders, an end rate 
> parameter produces a linear ramp, and a zero-rate stage inserts a quiet 
> pause. Arrival spacings can be uniform or drawn from a seeded Poisson process 
> that reproduces the exact dispatch schedule for a given seed. Each operation 
> records both raw JDBC service time and end-to-end response time measured from 
> its scheduled dispatch timestamp to completion. Requests running behind 
> schedule by more than {{maxLagMs}} are either executed and counted as late or 
> discarded and counted as dropped, depending on the configured policy. The 
> scheduler stops when the stage sequence finishes, a deadline expires, a stop 
> predicate triggers, or cancellation is requested, and then waits for 
> in-flight work to drain. The schedule block of the latency report summarizes 
> scheduled, completed, late, and dropped counts along with peak queue depth, 
> peak in-flight concurrency, and peak dispatch lag. Unlike the legacy 
> closed-loop path, the open-loop runner avoids a global per-iteration lock, 
> letting N configured workers sustain N concurrent operations.
> Checking read-what-you-wrote invariants or targeting specific rows for 
> deletion usually requires threads to share a large in-memory key cache. 
> Deterministic co-generation removes that shared state. Adding an optional 
> {{<coGeneration>}} element on a scenario computes every column value as a 
> pure function of the logical row index, the column identifier, and the 
> workload seed using a fixed 64-bit mixing hash. Built-in {{{}SEQUENTIAL{}}}, 
> weighted {{{}LIST{}}}, and bounded {{RANDOM}} rules keep their expected 
> distributions, and custom user generators can opt in via an index-addressed 
> interface. Writer threads reserve non-overlapping, batch aligned row index 
> ranges matched to commit batches and advance a committed high water mark 
> after each commit or once the load completes, so readers never query 
> uncommitted rows. Reader threads traverse the committed index window via a 
> multiplicative modular walk, providing even work partitioning across reader 
> threads and deterministic restart positions. Composite primary keys and range 
> prefixes always reference valid, populated rows. Optional batch clustering 
> bounds the distinct count of the leading primary key column within each write 
> batch, and process level index offsets partition the keyspace across separate 
> OS processes, providing the basis for multi-agent coordination in Distributed 
> Pherf.
> Queries can be tagged with {{kind="SCAN"}} or {{{}kind="DELETE"{}}}, 
> constructing range boundary predicates from {{[COL]}} placeholders resolved 
> through either the co-generation decoder or standard column generation rules. 
> Combined with bulk upserts and point lookups, these query kinds allow a 
> single scenario to exercise the full lifecycle of stored rows.
> Workload profiles package an open loop arrival schedule and an optional 
> operation mix in a standalone XML file keyed by generic operation. One 
> profile can drive multiple scenarios. Operation mixes use smooth weighted 
> round-robin scheduling over a deterministic cycle, keeping dispatch order 
> independent of OS thread scheduling and holding each operation kind within 
> one operation of its configured share. Three command line options/overrides 
> scale open loop arrival curves proportionally. Three ready-to-run reference 
> scenarios covering a relational schema, a JSON document table, and a BSON 
> document table, each paired with a smoke profile, ship under 
> {{{}phoenix-pherf/config/reference{}}}.
> Running Pherf with {{-validate}} audits scenario files, workload profiles, 
> and companion DDL scripts offline without opening a database connection. The 
> rule engine checks XML structure and unknown tags, column value types, query 
> kinds, warmup iteration counts, open loop rates, seeds, and operation mixes, 
> as well as SQL predicate syntax, identifier casing, primary key coverage, IN 
> lists, row value constructors, and range bounds. For scenarios using 
> co-generation, it also checks the multiplicative walk coverage, 
> non-overlapping writer block allocations and process offsets, and valid 
> watermark limits. Passing {{-allowUnknownTags}} downgrades unrecognized XML 
> elements and attributes to warnings so scenarios written for newer Pherf 
> releases can still run
> At the end of a run, Pherf evaluates its execution quality and atomically 
> writes {{VERDICT_<label>.tsv}} beside the latency report using the exact TSV 
> schema of the harness {{verdicts.tsv}} artifact, so the harness can append 
> the rows directly without translation.
> Schedule attainment checks verifies that the open loop arrival target was 
> sustained. Saturation checks look at peak dispatch lag while recording peak 
> queue depth and in-flight concurrency, assigning a root cause only on failure 
> so passing rows never imply a problem. Client pool health checks confirm that 
> requests did not stall waiting for a free Pherf worker thread. Tail latency 
> checks measure p99 and p99.9 against configured ceilings. Read skew checks 
> measure request imbalance across RegionServers. Checks without applicable 
> input data record SKIP with a diagnostic reason. Setting 
> {{pherf.verdict.noisyHost}} downgrades failed timing checks to {{ADVISORY}} 
> while keeping count based checks authoritative, matching the harness 
> contamination policy on a contended host. The full specification is in 
> {{{}phoenix-pherf/VERDICT.md{}}}.
> Invoking {{-analyze DIR [DIR]}} performs offline statistical comparison 
> across harness result bundles or standalone Pherf result directories, 
> treating one directory path as a replicate series and two directory paths as 
> a baseline-versus-candidate A/B comparison. Because each replicate run is the 
> unit of independent experimental trials, the analyzer computes medians and 
> 95% percentile bootstrap confidence intervals from per-replicate summary 
> percentiles. Regressions receive an authoritative {{FAIL}} grade only when 
> both sets have at least three replicates with uncompromised timing authority, 
> and are downgraded to {{ADVISORY}} otherwise. Timing authority is withdrawn 
> if any replicate reports host or resource contamination, or if cluster 
> topologies differ across runs. Within a set of replicates, operation count 
> parity is enforced for deterministic fixed count workloads and reported as 
> advisory for duration driven workloads. The tool writes 
> {{ANALYSIS_<label>.json}} when all checks pass. The specification is in 
> {{{}phoenix-pherf/ANALYSIS.md{}}}.
> The harness {{pherf}} driver now reads Pherf's structured telemetry artifacts 
> directly. It runs the data load and query phases under deterministic labels, 
> layers test-specific properties over the default property files from the 
> source tree, archives the full Pherf output directory verbatim in the harness 
> result bundle, and parses the JSON reports on the host. From those reports, 
> the driver records per key operation counts and microsecond latency 
> percentiles for both load and query phases, overall load row counts and 
> throughput rates, open loop scheduler metrics including peak queue depth and 
> peak in-flight concurrency, and per query result row counts from the XML 
> summary. It appends Pherf's five health verdict rows directly into the 
> bundle's verdict table, maps any pre-run validation gate exit to a formal 
> verdict, passes the noisy host flag when host contamination is detected, and 
> configures RegionServer endpoints for read skew checks when requested. 
> Finally, the driver adds the bson JAR to the client class path so clients 
> built with PHOENIX-8072 work without affecting earlier builds.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to