Package-level declarations

Types

Link copied to clipboard
class Aggregates(versions: IntArray, index: Int, of: Int)

The aggregates one worker of a case writes: every of-th of versions' aggregates, by index, taken in turn so a flush holds distinct aggregates. Their versions are the case's (versions, by aggregate), carried from one step to the next, so a later step goes on from the versions an earlier one wrote.

Link copied to clipboard
class CallTimes

The time a kind of call took, by name, cumulative: <name> nanos and <name> calls among a step's counters, so a window's growth gives its mean (means, <name>Ms). A diagnostic of where a store call's time goes: the store's round trip, the whole call, the wait before it.

Link copied to clipboard
class ContainerCpu(container: String?)

The store container's CPU, from its cgroup (docker exec <container> cat /sys/fs/cgroup/cpu.stat); null without one.

Link copied to clipboard
data class Flushed(val written: Int, val refused: Int = 0)

What one flush did: the written units the store took, and the refused ones it did not (a guard, a key).

Link copied to clipboard
class LongList

A growable list of longs, a worker's flush latencies.

Link copied to clipboard
class MongoCounters(admin: MongoClient, database: MongoDatabase)

MongoDB's counters and settings around a raw run's windows, read with admin on database.

Link copied to clipboard

A snapshot's save on MongoDB in each shape its store cost is priced in: Update.M1 Wow's own filter and modifier (MongoSnapshotStore), and the candidate shapes against it.

Link copied to clipboard
data class Pace(val timing: Pair<Int, Int>, val rate: Double? = null)

How a step runs: timing's warm-up and measured seconds, and with rate, that many units a second in all.

Link copied to clipboard
class PostgresCounters(connect: () -> Connection)

PostgreSQL's counters and settings around a raw run's windows, on connections from connect.

Link copied to clipboard

Wow's PostgreSQL statement texts and parameter types, on the clone's tables (raw_log, raw_snapshot, raw_partition): the columns Wow's append and save write, its transaction bound, its append and save texts, and its binding of a parameter by its type. A text differs from Wow's only in its table names.

Link copied to clipboard
data class RawCalibration(val checks: List<RawCheck>, val apart: List<RawCheck> = emptyList(), val wowCounters: Map<String, Double> = emptyMap(), val rawCounters: Map<String, Double> = emptyMap(), val read: Boolean = true)

The check that the clone writes what Wow writes: each of checks per command of Wow's own run on this store (the domain's commands in this JVM) against the clone's calibration step, on the same rows in the same state; it passes when every check does and the step was read (every write it asked for taken). apart are reported beside them, unbounded, and every counter of both (wowCounters, rawCounters), so a gap shows where it is. A run that fails it says so at its head, and none of its cases is read.

Link copied to clipboard
data class RawCase(val name: String, val unit: String, val flushUnits: Int, val prices: String, val ceiling: String? = null)

One write or read a raw run measures (RawStoreBench): its name, the unit its figures are per (a row or an update of a snapshot, a command of Wow's, a read), how many units one flush asks for (flushUnits), and what it prices (prices: today's shape, a candidate, or a reference); and with a ceiling, that it is the shape Wow's node gives the store (WowShape), whose best candidate step is that ceiling: COMMITTED, a command answered at its append (Wow's E1), or SNAPSHOT, once its snapshot was written too (the default wait's).

Link copied to clipboard
data class RawCheck(val metric: String, val wow: Double?, val raw: Double?, val bound: RawCheck.Bound)

One calibration check: metric per command of Wow's own run against the clone's, within its own bound.

Link copied to clipboard

The commands Wow's run sends MongoDB, by command and collection (update wow_snapshot__transfer__account), so the calibration takes Wow's batch shape from its log's inserts and its snapshots' updates alone: the node's checkpoint and lease writes are commands of their own collections. RawStoreBench passes it as a source of Wow's run, beside ComponentCounters; the server hands every CommandListener to its client.

Link copied to clipboard
class RawMongo(uri: String, databaseName: String) : AutoCloseable

The raw run on MongoDB: Wow's collections cloned (each index, by listIndexes) as raw_log, raw_snapshot and raw_partition, written with documents of the domain's own commits as templates at Wow's write concern (majority), each step on a client whose pool is the step's connections:

Link copied to clipboard
class RawPostgres(url: String, user: String, password: String)

The raw run on PostgreSQL: Wow's tables cloned (LIKE … INCLUDING ALL: its columns, keys and indexes) as raw_log, raw_snapshot and raw_partition, written with rows of the domain's own commits as templates, by Wow's own statement texts and parameter types:

Link copied to clipboard
class RawResult(val calibration: RawCalibration, val store: Map<String, Any?>, val steps: List<RawStep>)

A raw run's result: its calibration, its store's version and settings, and its steps.

Link copied to clipboard
data class RawSettings(val connections: List<Int>, val warmUpSeconds: Int, val seconds: Int, val logBatch: Int, val snapshotBatch: Int, val batches: List<Int>, val aggregates: Int, val templates: Int, val p2Share: Double, val cases: List<String>, val container: String?, val shapeClients: List<Int> = listOf( DEFAULT_SHAPE_CLIENTS_LOW, DEFAULT_SHAPE_CLIENTS_MID, DEFAULT_SHAPE_CLIENTS_HIGH ))

A raw run's settings, from its options; each store's defaults are its share of Wow's batches in the L1 counts.

Link copied to clipboard
data class RawStep(val case: RawCase, val connections: Int, val rate: Double?, val seconds: Double, val units: Long, val flushes: Long, val failures: Long, val refused: Long, val late: Long, val p50FlushMs: Double, val p99FlushMs: Double, val storeCpuMsPerUnit: Double?, val perUnit: Map<String, Double>, val ratios: Map<String, Double> = emptyMap(), val pool: Int? = null)

A step's result: its case, its connections (and MongoDB's pool), and what it did and cost per unit written: storeCpuMsPerUnit from the store container's cgroup, perUnit the store's own counters' growth per unit, ratios those read as a share. A step with any failures or refused writes is not read (read); a paced step counts its flushes that started late.

Link copied to clipboard

One worker of a step: what it does once a flush, and its close.

Link copied to clipboard
class Watchdog(name: String, limitSeconds: Long, halt: (Int) -> Unit = Runtime.getRuntime()::halt)

A step's watchdog: unless cancelled within limitSeconds (limitOf a step's own length), it says which step (name) printed nothing for that long and ends the program with EXIT_HUNG (halt), so a step that hangs (a store read that does not return, a worker that never stops) costs minutes and names itself, rather than the job's whole timeout and a log that ends at the step before.

Link copied to clipboard
class WowShape<S : AutoCloseable>(partitions: Int, partitionOf: (Aggregates.Command) -> Int, options: WowShape.Options, open: () -> S, append: (S, List<Aggregates.Command>) -> BooleanArray, save: (S, List<Aggregates.Command>) -> BooleanArray) : AutoCloseable

Wow's own write path at its peak, the shape the node gives the store, with the driver alone:

Link copied to clipboard
class WowWindow(pipeline: () -> String?, saves: () -> Long)

Wow's own run's append queue and saves over its window, a diagnostic of the calibration's Wow side: every SAMPLE_MILLIS, the node's append calls and the streams they carried, its lanes' groups waiting for a committer and its pool (the bench-pipeline line's sections, pipeline), and its save statements (saves, cumulative from the window's start). stop gives each half of the window's commands an append, append calls a second and snapshots a save, so a cold first half (slower calls, larger appends) shows, and over the whole window the mean groups waiting and threads waiting for a connection.

Properties

Link copied to clipboard
const val CALIBRATION: String

The calibration's case: today's, on Wow's ground.

Link copied to clipboard

The calibration's connections: Wow's run's concurrency.

Link copied to clipboard

The model's own shape beside the calibration, apart.

Link copied to clipboard
const val LATE_NANOS: Long

How late a paced flush may start before it counts as late.

Link copied to clipboard

The layout's names before and after a window, both sides', as the calibration reports them apart.

Functions

Link copied to clipboard
fun calibrationOf(checks: List<Pair<String, RawCheck.Bound>>, apart: List<String>, wow: Map<String, Double>, calibrating: RawStep, shape: Map<String, Double> = emptyMap()): RawCalibration

The calibration: each of checks' metrics per command of Wow's own run (wow, every counter's) against the calibrating step's, within its bound; apart's metrics reported beside them, unbounded.

Link copied to clipboard
fun ceilingsOf(steps: List<RawStep>, calibrated: Boolean): Map<String, RawStep>

The ceilings a figure of Wow's is compared with, by what it is compared with (RawCase.ceiling): of each, the candidate step that did the most commands a second. A candidate is a step of Wow's own shape, unpaced and read, with no snapshot its writers failed; a committed one only when its window's saves kept up with its appends (at least WowShape.SAVES_KEPT of them). None from an uncalibrated run (calibrated).

Link copied to clipboard
fun cgroupUsageMicros(cpuStat: String): Long?

usage_usec of a cgroup v2 cpu.stat; null when the text has none.

Link copied to clipboard
fun groupsOf(units: Int, perGroup: Int): List<Int>

The groups of units a statement or call each: groups of at most perGroup, in order.

Link copied to clipboard
fun growthOf(before: Map<String, Double>, after: Map<String, Double>): Map<String, Double>

Each counter's growth between two reads, the WAL's position left out (PostgresCounters.WAL_POSITION).

Link copied to clipboard
fun jsonOf(value: Any?): String

value as JSON text: maps, lists, numbers (a non-finite one null), booleans, null and strings.

Link copied to clipboard
fun layoutOf(connection: Connection, table: String, suffix: String): Map<String, Double>

A snapshot table's pages as they are, a diagnostic of the HOT share (an update stays on its page only while the page has room for the new version): its pages, live rows a page, a row's mean width, free bytes a page and dead rows, read with pgstattuple; empty when the extension is not there. suffix names when it was read (Before, After).

Link copied to clipboard
fun main(args: Array<String>)

The raw-driver ceiling: what the store alone does with the durable writes Wow asks of it, per command, row or update, in today's shape and in the shapes that price a candidate (MongoDB's update shapes M0–M3; PostgreSQL's P0–P2), before any kernel work.

Link copied to clipboard
fun opened(aggregates: Int): IntArray

Versions of aggregates aggregates opened at version 1.

Link copied to clipboard
fun percentile(values: LongArray, percentile: Double): Long

The percentile (0 to 100) of values, sorted in place; 0 when there are none.

Link copied to clipboard
operator fun Flushed.plus(other: Flushed): Flushed

Two flushes' units, added.

Link copied to clipboard
fun rawJson(calibration: RawCalibration, settings: Map<String, Any?>, store: Map<String, Any?>, steps: List<RawStep>): String

raw.json's text: the calibration first, then the run's settings and the store's, then each step.

Link copied to clipboard
fun runStep(case: RawCase, connections: Int, pace: Pace, cpu: ContainerCpu, counters: () -> Map<String, Double>, ratios: (Map<String, Double>) -> Map<String, Double> = { emptyMap() }, records: (Map<String, Double>, Map<String, Double>) -> Map<String, Double> = { _, _ -> emptyMap() }, watch: () -> () -> Map<String, Double> = { { emptyMap() } }, worker: (Int) -> RawWorker): RawStep

Runs connections workers (worker by index, each with its own connection) of case: pace's warm-up unmeasured, then its measured seconds, as fast as they go or at its rate. The store container's CPU (cpu) and the store's own counters (counters) are read at the window's edges with every worker paused between flushes, so the units counted and the counters' growth cover the same writes. With a rate, a flush's latency starts at its scheduled time, and a flush that started more than LATE_NANOS after it counts as late.

Link copied to clipboard
fun savedBehind(owned: Aggregates, logBatch: Int, snapshotBatch: Int, append: (List<Aggregates.Command>) -> Flushed, save: (List<Aggregates.Command>) -> Flushed): Flushed

Today's flush on either store: logBatch of owned's commands appended in one group (append), their snapshots kept with the worker's earlier ones and saved snapshotBatch a call (save), as Wow's writer saves them: behind its appends and across them, so a save may wait for several appends or follow one with several. A command counts once its snapshot was written, which is after its append.

Link copied to clipboard
fun stepsOf(connections: List<Int>, aggregates: Int, prepare: () -> Unit, run: (connections: Int, versions: IntArray) -> RawStep): List<RawStep>

A case's steps, one at each of connections: each on tables prepared afresh, its aggregates aggregates opened at version 1, so no step runs on what an earlier one left (dead tuples, grown indexes, a vacuum's work).