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

Andrew Kyle Purtell updated PHOENIX-8077:
-----------------------------------------
    Component/s: harness
                 pherf

> Pherf Harness: Phase 1
> ----------------------
>
>                 Key: PHOENIX-8077
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-8077
>             Project: Phoenix
>          Issue Type: Sub-task
>          Components: harness, pherf
>            Reporter: Andrew Kyle Purtell
>            Assignee: Andrew Kyle Purtell
>            Priority: Major
>             Fix For: PHOENIX-8070
>
>
> This subtask adds {{{}dev/harness{}}}, a smoke- and performance-testing 
> harness that compiles Phoenix from the local source tree and starts a single 
> host containerized cluster with ZooKeeper, HDFS, HBase, and an optional YARN 
> tier.
> Workloads run against this cluster through pluggable drivers, producing a 
> validated result bundle that reduces to one overall verdict and one process 
> exit code. Developers and automated agents can drive the harness through nine 
> command-line commands sharing an argument grammar, help layout, and exit code 
> vocabulary.
> Written in shell without adding Java sources, Maven modules, third-party 
> dependencies, or CI workflows.
> All operations against the container runtime go through a substrate contract 
> declared in {{{}lib/backend/contract.sh{}}}. This interface defines entry 
> points covering execution scopes, cluster provisioning and teardown, 
> readiness probes, exec, log retrieval and file transfer, horizontal scaling, 
> role groups, fault injection, restart counts and termination reasons, 
> resource samples, service endpoints, and container images.
> A deployment generator turns the chosen run class and cluster topology into 
> deployment manifests. Every daemon and client role runs from one multi-role 
> container image built from the local source tree. Inter-service traffic runs 
> over a harness-managed bridge network that assigns each role instance a 
> deterministic hostname. Published service ports bind to 127.0.0.1 using 
> matching host and container port numbers, avoiding external network exposure. 
> Template rendering aborts if any required variable is unset or if an 
> unexpanded placeholder remains in the output.
> By default, image builds fetch the latest Apache Hadoop 3.4 and HBase 2.6 
> patch releases. Callers may pick the target Phoenix HBase build profile, and 
> preflight rejects any HBase version outside that profile's supported 
> compatibility range. For multi-version verification, px-cluster matrix runs a 
> workload suite across a sequence of version sets.
> A sizing table targets a _small host_ tier, a host of up to 32 GiB running a 
> 24 GiB container engine: supporting daemons run at a 512 MiB heap floor (the 
> NameNode at 1 GiB), and the RegionServers and workload client share the 
> remaining budget. The default topology sums to 17152 MiB of container limits 
> and uses those exact allocations on larger machines unless a run selects 
> another configuration, keeping result bundles comparable across hosts.
> Cluster admission runs through a two stage preflight check. The first stage 
> checks container runtime reachability, registry or engine credentials, 
> loopback port availability, free disk space, and available CPU cores. The 
> second stage sums the container memory limits of the rendered deployment and 
> compares that total against engine memory minus 4 GiB of reserved host 
> headroom. If a topology exceeds that budget, preflight aborts bring-up and 
> prints the exact capacity calculation. While a cluster is running, the 
> harness holds an OS sleep inhibitor and runs a background watchdog that 
> triggers cluster teardown if free host memory drops to a critical threshold. 
> A host level mutex prevents concurrent harness clusters from colliding on the 
> same machine and reports the owning cluster when contention occurs.
> Operator and agent workflows are exposed through nine public entry points in 
> {{{}bin/{}}}: {{{}px-cluster{}}}, {{{}px-run{}}}, {{{}px-suite{}}}, 
> {{{}px-report{}}}, {{{}px-bundle{}}}, {{{}px-collect{}}}, {{{}px-tool{}}}, 
> {{{}px-pherf{}}}, and {{{}px-k3d{}}}. While {{px-pherf}} and {{px-k3d}} 
> arrive in the Distributed Pherf and Kubernetes subtasks respectively, all 
> nine executables use the same argument parser and help renderer. Helper 
> scripts, manifest generators, and collector subroutines stay internal and do 
> not appear in help output, error hints, or HOWTO documentation.
> Every command follows one invocation grammar:
> {{px-NAME [option...] [SUBCOMMAND] [OPERAND...] [option...] [-- ARGUMENT...]}}
> Option flags may appear anywhere before the {{--}} delimiter. Each flag has 
> one standard long spelling with consistent meaning across all tools, while 
> short flags are limited to {{{}-h{}}}, {{{}-v{}}}, {{{}-n{}}}, and 
> {{{}-e{}}}. Required targets are passed as positional operands rather than 
> option values, so callers launch a driver via {{px-run psql}} instead of 
> passing a driver-selection flag. When the same parameter appears more than 
> once on a command line, the earliest occurrence wins, matching the first-wins 
> precedence used across the configuration hierarchy from command-line 
> arguments down to the base defaults file. Arguments after {{--}} pass through 
> untouched to the target workload driver or container command. Malformed 
> invocations print standard usage errors and exit with code 2. Single-purpose 
> flags that forwarded values to individual PX_* environment variables are 
> replaced by {{{}-e NAME=VALUE{}}}, which checks every key against a registry 
> of known PX_* variables so mistyped names fail immediately rather than being 
> silently ignored.
> Each command defines one declarative option table that drives both flag 
> parsing and help text rendering, keeping parser behavior and help output in 
> sync, while a shared formatter gives {{-h}} the same section layout across 
> all nine tools. Passing {{-n}} prints a tabular dry-run plan with one row per 
> step and the exact argv vector a live run would execute. Also, {{px-cluster 
> up -n}} runs the full read-only preflight check suite and exits with code 3 
> if a live bring-up would fail admission, and {{px-pherf -n}} runs the same 
> preflight check when no active cluster is recorded. When a downstream pipe 
> consumer closes its input stream early, commands exit cleanly without 
> printing broken-pipe errors.
> When bringing up a cluster, {{px-cluster up}} writes a cluster record under 
> {{{}PX_OUT/{}}}, capturing the active backend, the run class, and all 
> parameters resolved from command-line flags, configuration files, and the 
> target definition flattened into key-value pairs. Passing a pre-rendered 
> directory via {{px-cluster up DIR}} launches that deployment directly, 
> inheriting the captured settings.
> Lifecycle follows resource ownership. Each command tears down only the 
> infrastructure it created. Destroying external resources not directly owned 
> by the recorded cluster requires an explicit --{{{}label KEY=VALUE{}}} 
> filter, which is validated before teardown begins. Passing {{--keep}} retains 
> resources that the invoking command would otherwise remove on exit.
> Generated artifacts are addressed through deterministic handles rather than 
> manual directory traversal. Any command taking a bundle operand accepts 
> either a directory path or a run identifier, resolving both through a single 
> lookup routine in {{{}lib/bundle.sh{}}}. When called without an explicit 
> bundle argument, {{px-report}} and the read-only {{px-bundle}} subcommands 
> target the most recently completed run bundle.
> Each workload driver is an independent executable implementing a six-verb 
> lifecycle contract: {{{}describe{}}}, {{{}validate{}}}, {{{}prepare{}}}, 
> {{{}run{}}}, {{{}restore{}}}, and {{{}report{}}}. This phase ships the 
> {{{}psql{}}}, {{{}pherf{}}}, and {{{}java-main drivers{}}}.
> Every completed or aborted workload run writes a versioned result bundle 
> containing the bundle manifest, the run metadata record, timed execution 
> windows delimited by anchors, verdict tables, extracted metrics, telemetry 
> collector artifacts, service logs, the harness execution log, the effective 
> merged threshold table, and the deployment sizing record along with the 
> component version set, container image digest, and run class.
> Running {{px-bundle validate}} verifies structural completeness and 
> cryptographic sizing digests, rejecting any bundle that omits a required path 
> or shows a digest mismatch and reporting the specific discrepancy.
> For queries, {{px-bundle verdicts}} streams the effective verdict rows, and 
> {{px-bundle metrics}} filters by anchor name and one or more key globs to 
> emit normalized anchor, key, value, and unit tuples.
> For statistical comparison across runs, {{px-bundle analyze}} runs the 
> offline Pherf statistical analyzer over either a single replicate group or a 
> baseline-versus-candidate pair. The bundle schema is documented in 
> {{{}docs/bundle-format.md{}}}.
> Every run is evaluated by eight built-in cluster health checks, parameterized 
> by threshold keys that resolve deterministically across the base defaults 
> file, the active run class, enabled plug-ins, and environment overrides.
> Verdict severities follow a total order: {{PASS}} < {{SKIP}} < {{ADVISORY}} < 
> {{FAIL}} < {{{}ERROR{}}}.
> When producing a run summary, {{px-report}} combines all health check and 
> driver verdict streams into a single aggregate verdict and exit code: 
> {{{}PASS{}}}, {{{}SKIP{}}}, and {{ADVISORY}} map to exit code 0. {{FAIL}} and 
> an inconclusive {{SKIP}} result map to exit code 1. {{ERROR}} maps to exit 
> code 3.
> Extensibility is supported through self-contained plug-in directories that 
> bundle a manifest, custom check evaluators, an optional workload driver, and 
> scripts that can be installed into up to nine discrete lifecycle hooks. Using 
> this extension mechanism, users can supply additional or custom workload 
> suites, drivers, service configuration overlays, JVM flags, external test 
> datasets, and custom telemetry collectors without modifying core harness 
> scripts. A reference plug-in exercising all nine hooks is included under 
> {{{}plugins/example{}}}, and the plug-in contract is documented in 
> {{{}docs/PLUGINS.md{}}}.
> Telemetry capture is managed by {{{}px-collect{}}}, which coordinates six 
> built-in collectors: async-profiler recording combined cpu and alloc events 
> in a single JFR output file, standard JDK Flight Recorder sessions, jHiccup 
> pause monitors attached to each target daemon JVM paired with an idle control 
> JVM, host wide resource sampling, per-container resource sample streams, and 
> RegionServer Phoenix trace counter snapshots. Passing {{--collect all}} 
> activates all collectors together.
> The test suite covers argument parsing and help layout across all entry 
> points, configuration precedence and cluster record persistence, manifest 
> generation and memory budget arithmetic, preflight admission against a mocked 
> runtime, host safety guards, driver lifecycle execution, bundle schema and 
> digest validation, health checks and verdict severity ordering, plug-in 
> lifecycle hooks, telemetry collectors, and all three layers of substrate 
> boundary enforcement. The suite also fails if any execution path writes 
> inside the repository working tree.
> Reference documentation starts at {{dev/harness/README.md}} and continues in 
> {{{}docs/backends.md{}}}, {{{}driver-contract.md{}}}, 
> {{{}bundle-format.md{}}}, and {{{}PLUGINS.md{}}}.



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

Reply via email to