@mark1russell7/harness
v0.16.35
Published
Network labs in Docker, declared as data. A cell builds a topology of networks, routers and proxies around a stock target. It injects a fault at layer 3 or 4 from a NET_ADMIN sidecar, measures the records of the kernel and judges a prediction. The faults
Maintainers
Readme
@mark1russell7/harness
Network labs in Docker, declared as data. A cell builds a topology of networks, routers and proxies around a stock target, and a client connects to that target. The harness injects a fault at layer 3 or 4, and it measures what the kernel did. Then the harness judges the measurement against the prediction of the cell.
- The faults: black holes, resets, ICMP unreachable, one-way drops, MTU drops, tc netem, the toxics of Toxiproxy, SIGSTOP and SIGKILL. A sidecar with NET_ADMIN commits each fault in one
iptables-restore, thus the image of the target stays stock. - The groups: Redis under its Sentinels, a MongoDB replica set, a PostgreSQL standby, a Kafka or RabbitMQ cluster, and a BGP fabric with BFD.
- The tiers: a lab operates on the Docker of the host, or in a QEMU guest with a pinned kernel. The package
@mark1russell7/kindhas the labs on Kubernetes clusters of kind. - The first use: connection timers. Examples are keep-alive, TCP retransmission, heartbeats and reconnects.
The harness does not compute predictions. The author of a cell computes the prediction, for example from a timer algebra, and puts it in the cell.
The cell
A cell (cell.ts) is all that one measurement needs, as data:
- The topology. A stock target image, pinned by digest, and the hops between the client and the target (
Cell.topology). Without hops, the client and the target are a direct pair. A replicated group under its Sentinels can replace the target (Cell.group). A PostgreSQL target can have one standby, with a final read of each server (Cell.pair). - The subject. The program under test, as data. Its image is an image pinned by digest, a build context, or an image that the harness ships (
Cell.client,Target.subject). - The settings. The sysctls of the client namespace, and the socket options of the client.
- The workload. A connection that stays idle, a connection with a request in flight, or a stream of requests. A stream of
GETrequests for a long value keeps many segments in flight. - The fault. A black hole, a reset, a frozen process, or a stall. In a topology, also a fault at a router or a proxy, or a router that forgets a flow. Also a proxy that closes an idle connection, or a toxic of Toxiproxy.
- The prediction. An interval [T_lo, T_hi] after the event that arms the timer, or silence in a window. After a stall, the prediction also tells when the connection recovers. A silent prediction can also tell when the reply comes back (
replies). - A detection by the program. The timer can be a timer of the program of the observer, for example a heartbeat. The program then drops the connection itself (
DROPPED). A detection can also give the waits of the reconnect of the client (reconnects). - The assumptions of the band. A band can name the range of first round trips that it assumes (
rtt), and the proxy times that it includes (through).
The environment
openLab(target, client, topology) (lab.ts) builds one environment with Testcontainers:
- A chain of new networks, and the target on the last network. A direct pair has one network.
- A client container that holds its network namespace.
- A privileged sidecar in the namespace of the client, for its sysctls and its routes. Docker Desktop keeps
/proc/sysread-only in a container that operates. - Each hop of the topology, on the network of each of its sides.
- An injector sidecar in the namespace of the target, with NET_ADMIN. Thus the image of the target stays stock.
- The manifest of each environment gives the HZ of its kernel, from /proc/config.gz. A host without that file (a hosted runner) gets HZ from two readings of /proc/timer_list, one second apart: its jiffies against the time of the kernel (
hzOf).hzFromtells which. - The manifest of each environment holds a
substrateblock (substrate.ts). It gives the layer, the cloud, the vendor, the kernel, HZ, KVM and the image of the runner. GitHub can schedule one image on Azure or on AWS. Thus the cloud comes from the DMI vendor, not from the name of the kernel. No statistic pools two substrates (comparable). A record from before the block reads throughsubstrateOf, and nothing rewrites it. - The layers (
docs/S7.md) are data in the entry@mark1russell7/harness/layers, which imports nonode:module.LAYER_FACTSgives each layer its texts from the table of S7, the faults that its cells inject and the limits that their load fills. The faults of E2 are the triggers of@mark1russell7/kind.layerOfgives the layer of a lab from its topology.rigTermsOfgives the pairs of the rig map of rigor that a cell applies (RIG_TERMS). A test holdsdocs/rigs.jsonequal to them. - The prober (
@mark1russell7/prober): a privileged container that loads the kernel program. It watches the namespace of the client, of the target and of each hop. Each run keeps its records from its start to its end. A run whose records the prober lost is void.
Each command is an argv array.
A lab in a guest
The folder vm/, the file src/vm.ts and the workflow vm.yml operate a lab in a guest of QEMU, layer E4 of docs/S7.md. src/vm.ts builds a pinned kernel and a disk, then boots that kernel directly, with no boot loader. The guest has systemd, sshd and the Docker of the runner. The images build in the guest, because the prober compiles against the BTF of the kernel that it operates on.
runCells in that file is the one command of the cells for the runner and for a guest. Rule 3 of that document pairs the two in one job. A guest cannot read its runner, thus the runner gives its host in LAB_RUNNER. substrateHere writes E4 with that cloud and image, and with the kernel and HZ of the guest. A run also records steal, the share of the CPU that the host took (stealShare). A guest sees only the host above it, thus this number does not show the layer below a hosted runner.
The command run of src/vm.ts and the workflow vm-run.yml operate one command of another repository in the guest (SYS-136). The guest copies a folder of the caller to /work, with no node_modules, and installs it from its lockfile. The argv starts in /work when Docker is ready. It writes its output to /out, and /out comes back to the runner, also after a failure.
After the time limit, each process of the argv stops. The file run.json in /out tells why the run ended, the exit code and the kernel of the guest. A consumer adds one job that uses vm-run.yml at a commit of this repository. One file, vm/linux.json, pins the kernel for vm.yml and vm-run.yml.
The gate of the VM tier
A pull request that changes the VM tier starts vm.yml (SYS-155). The workflow operates one arm e4 with the cells of the bridge of T01. Then src/vm-tier.test.ts reads the records of that arm, with HARNESS_VM=1. vmArmProblems in src/vm-tier.ts gives each difference from the cases of the self-test, as data:
| Case | The result that the case expects |
| --- | --- |
| control | The guest operates the kernel of vm/linux.json. The boot to Docker takes 30 s or less. The steal of each run is 0.01 or less. |
| idle blackhole | Each run ends with ETIMEDOUT. The median of the times is from 11.0 s to 12.0 s. |
| in-flight blackhole | Each run ends with ETIMEDOUT from 5.9 s to 6.5 s after the fault. |
| stall of 1 s | Each run gets its answer from 1.5 s to 1.9 s after the fault. |
A void run does not pass. The arm writes its boot record (<arm>.boot.json) before the cells, thus a guest that did not boot fails the control case. A runner with no /dev/kvm fails the job in a pull request or a push. Only a dispatch keeps the void result of rule 8. VM_TIER_FAULTS names the faults of the gate, and the rig systems.vm of docs/rigs.json names the same faults.
The k3s rung
The file src/k3s.ts and the workflow k3s.yml operate two guests of QEMU on the pinned kernel (SYS-85). One guest is a k3s server, and the other is a k3s agent. Each guest has its own kernel and its own overlay of the disk. A link of QEMU joins their second NICs on a TCP port of the runner, with no root. The file vm/k3s.json pins the k3s binary and its SHA-256, on the Kubernetes minor of the newest node image of kind.
The fault is a power-off of the agent: SIGKILL to its QEMU process. The kernel of the agent stops with its pods. A frozen container in kind keeps its kernel, thus this rung tests the claim that a frozen container stands for a lost node. After each loss, the agent boots again on the same disk. The record k3s.json (format harness-k3s/1) keeps the time of each step. k3sArmProblems in src/k3s-tier.ts compares it with the cases of the self-test:
| Case | The result that the case expects |
| --- | --- |
| control | Each guest operates the kernel of vm/linux.json, and its boot to ssh takes 30 s or less. The two nodes are Ready in 300 s or less. A hold of 70 s gives no change of the Ready condition. |
| loss | Four or more of five power-offs are counted. The Ready condition of the agent goes to Unknown from 39.6 s to 56.0 s after the power-off. |
| return | After the agent boots again, its pod has a new sandbox or a higher restart count. |
A run that starts before the agent is Ready with no taint of the controller is void. A void arm does not pass. K3S_TIER_FAULTS names the fault of the gate, and the rig systems.k3s of docs/rigs.json names the same fault.
The topologies
A topology (Topology) is the chain of hops from the client to the target, as data. Each hop is on two networks, one for each side. Network j joins element j and element j + 1: the client is element 0, and the target is the last element.
A router (
RouterHop) is the router image of the harness. It forwards, and it translates the addresses of the side of the client (NAT) with conntrack. Its idle timeout isnf_conntrack_tcp_timeout_established, in whole seconds. The router is privileged, thus it sets the sysctls of its own namespace, and thesysctlsof its hop. An injector sidecar shares its namespace. Its form (MiddleboxForm) tells what a late packet meets after the router forgets the flow:| Form | At the expiry | A late packet from inside | A late packet from outside | | --- | --- | --- | --- | |
reset-both| a reset to the two ends | dropped | dropped | |reset-next| nothing | a reset to its sender | dropped | |silent-drop| nothing | dropped | dropped | |recreate| nothing | passes, and the flow starts again | dropped | |none| nothing | passes, and the flow starts again | a reset from the stack of the router |A proxy (
ProxyHop) is a stock image, pinned by digest, that ends each TCP connection and opens its own to the next hop. Its files go into it before it starts, and{{next}}in them is the address and port of the next hop. Itscommandand itsenvironmentreplace those of its image. An injector sidecar shares its namespace. A privileged sidecar sets its sysctls when the hop names them.- The lab keeps the last 60 lines of the output of each proxy. A proxy that does not start gives them in its error.
The element before a router reaches the networks after the router through it. Its privileged sidecar, or the router itself, adds each route. A router translates the address of the side of the client, thus the target and each later hop see the router as the peer.
Lab.topology (RunTopology) gives each hop its namespace and its peer on each side. From 0.16.2, it also gives the own address of the hop on each side (address). The address of a router on the side of the client is the gateway of the element before it. A record from before 0.16.2 has no address.
A lookup treats an expired conntrack entry as gone, thus the router forgets a flow at its timeout, to the jiffy. The DESTROY event of the entry waits for the garbage collector or a list of the table. Thus ctwatch.py in the router lists the table each pump (PUMP, 0.1 s by default). A DESTROY then follows an expiry within the pump and two lists of the table.
LISTING (20 ms) is the longest list of the table that a prediction assumes. A longer list writes a pump-slow line, and a run with one near a detection by a timer of conntrack is void. PUMP_SLACK (5 ms) is how late the pump can be after its interval and two lists. Its sleep can end late, and the read of the event takes time. Thus a DESTROY follows an expiry within the interval of the pump, two lists and that slack.
The reset-both form sends its resets on the DESTROY event. Each reset has the sequence number that its end expects. A raw sniffer reads it from the last acknowledgment of that end.
The lines of each router (Lab.middlebox) are the conntrack events and the resets that it sent, on CLOCK_MONOTONIC. Each run keeps the lines from its start to its end.
A fabric is a topology with no hops and with fabric (fabric.ts, layer E3 of docs/S7.md). Four routers of FRRouting, two leaves and two spines, run eBGP over veth pairs of containerlab. The client hangs off one leaf and the target off the other, each on a new device eth1. Each link has the MTU of a Docker network, thus a segment is as long as on E1. Each leaf prefers spine1 by a weight, and spine2 holds the other path.
The fault silence drops each packet of spine1 in one commit, and its links stay up. A route monitor on each leaf records each change of a route. The later move of the two leaves ends the stall of the run (Run.heal), and the verdict of a stall reads it. A move outside the band of the cell makes the run void. Before each run, ready waits for each session, for the route on spine1 and for the path on spine2. The record of the run keeps the routes and the count of established sessions (Run.fabric).
The groups
A group (Group, Cell.group) is a replicated group under an external failover authority, as data. It is a primary and its replicas, and the Sentinels that decide which member is the primary. A group cell has no hops, and the group replaces its target.
- The parts. Each member and each Sentinel is a container from one stock image, pinned by digest. Each part has its own network namespace, thus a fault can act on one part. The server of each part is the child of a shell. Thus a fin can stop the server, and the container stays up.
- The data. The group gives its members, its Sentinels and the quorum. It also gives the settings of each member (
memberSettings) and of each Sentinel for the group (sentinelSettings), for exampledown-after-milliseconds. The first member is the primary when an environment starts. - The sidecars. Each part has an injector sidecar in its network namespace and in its process namespace. Thus the injector can send a signal to the server of the part, with monotonic stamps around the
kill(2)calls. - The client. The client of each run is ioredis 6.0.0 in Sentinel mode (
client-sentinel.mjs).- It asks the Sentinels for the primary of the group. Then it writes a stream of sequence numbers:
SET w:<n> <n>. - It sends each write when the reply to the write before it came and the interval passed.
- Each write is a
sentline, then anackline or afailline. Anackline has the address of the server that accepted the write, and afailline has its error.
- It asks the Sentinels for the primary of the group. Then it writes a stream of sequence numbers:
- The observer. A container of its own subscribes to each channel of each Sentinel (
observer.mjs).- Each Sentinel publishes each of its events on a channel with the name of the event. The observer stamps each message on CLOCK_MONOTONIC when it arrives.
- No fault rule names the address of the observer, thus the timeline stays whole.
- The prober watches the namespace of the client. A calibration (
Cell.calibratesissentinels) makes it watch each Sentinel too.
The roles of a group move: after a failover, a replica is the primary. Thus a fault names a part by its role at the start of a run (GroupPlace): primary, replica or sentinel.
Each run of a group cell starts from a group that converged:
- Each Sentinel agrees on one primary with no flag but
master, and it knows each replica and each other Sentinel. - Each replica follows that primary with its link up, and the primary has no failover in progress.
The harness then removes each key from the group. After the run, the group converges again, and the keys that it holds tell which writes it kept.
A driver with op: "rpush" appends each write to one list, and the entries tell how many copies of each write the group kept. window sets the count of writers. A band of extra copies (GroupPrediction.duplicates) judges the cell as a band of lost writes does.
A Sentinel that aborted a failover does not try again for 2 × failover-timeout. Thus after a run with an aborted failover, each Sentinel forgets the state of the group (SENTINEL RESET). The next run then starts from a group that each Sentinel knows again.
The replica sets
A replica set (ReplicaSet, Cell.replicaSet) is a replicated group with no external authority, as data. Its members elect their own primary, and the client finds the primary with its own monitors. The set replaces the target of its cell.
- The members. Each member is a container from one stock image, pinned by digest, in its own network namespace. Its server is the child of a shell, with the name of the set and the options of the set (
args). - The start. The first member starts the set (
rs.initiate) with the address of each member, as the client reaches it, and with the settings of the set. An example of a setting iselectionTimeoutMillis. - The sidecars. Each member has an injector sidecar in its network namespace and in its process namespace, as a member of a group has.
- The client. The client of each run is the MongoDB driver (
image/mongo). It knows the address of each member and the name of the set. It writes a stream of sequence numbers with the write concern of the cell (Cell.writeConcern). A run continues 2 s after the lift, and forCell.watchmore. A prediction of no failover after a short hold needs that time. - The timeline. A log consumer reads the JSON log of each member. A run keeps the lines of replication, of its heartbeats, of the elections, of the rollbacks and of the commands (
KEPT). - The clocks. The log of mongod has the wall clock in ms. The client writes the wall clock beside the monotonic clock each second (
clocks). Thus the run puts each line of a member on the monotonic clock (clockOffsetOf). - The prober watches the namespace of the client.
Each run of a replica set cell starts from a set that converged. The member that answers is the one primary, and it accepts writes. Each other member is a healthy secondary at the optime of the primary. The harness then removes each write from the set, with a write concern of each member. After the run, the set converges again, and the writes that it holds tell which writes it kept.
A step-down holds its old primary out of the elections for 60 s. Thus before each run, each secondary can stand for election again (rs.freeze(0)), and no run inherits that hold.
A fault names a member by its role at the start of a run: primary, or replica for a secondary. A cut from one member (one, one-way) cuts the first other member in the sequence of the set.
The recovery drills
A drill (Drill, Cell.drill) stops a replica set during writes, removes a disk, and recovers. drillOnce in drill.ts does it, and recovery.ts holds the pure parts.
- The backups are real. A
mongodump --oplogand each slice of the oplog go to a host of their own (ReplicaSetLab.vault).bsondumpreads each backup. The record keeps the last write that each backup holds (RunBackup). - The fault comes at
ageafter that last write, on the monotonic clock. Thus a run sets the age of its newest backup. - A restore cannot have a client of the set, because a client writes to any primary. So each slice joins the oplog of the dump, and a server with no set takes the restore on the next port. The set then starts again. A second client (
--from) sends the writes after the restore, thus no electionId of the old set stops it. - An election removes only the disk of the primary. The primary comes back at the end of the run, thus the set converges.
- The measure is a set difference (
recoveryOf). Each rule that a run breaks is a finding (recoveryFindings). A finding is a hole below a kept write, lost writes that the last backup does not explain, or tenant data that changed.
The clusters of RabbitMQ
A cluster (Cluster, Cell.cluster) is a cluster of RabbitMQ nodes with one quorum queue, as data. The members of the queue elect its leader by Raft, one member on each node. The cluster replaces the target of its cell.
- The nodes. Each node is a container from one stock image, pinned by digest, in its own network namespace. Its hostname is the name of its node (
rabbit@<name>), and all nodes share one Erlang cookie. Its server is the child of a shell. - The start. The nodes form the cluster from the list of their names (
classic_config), and the lab waits until each node runs in it. Then the admin (image/amqp/admin-cluster.mjs) declares the queue on the first node, with the leader locatorclient-local. - The sidecars. Each node has an injector sidecar in its network namespace and in its process namespace.
- The client. The client of each run is amqplib, in
image/amqp/client-cluster.mjs. The client publishes a stream of sequence numbers on a confirm channel through one node. That node is the last follower, or the node of the leader (Cell.clientAt). The library does not connect again by itself. When the connection ends, the client connects to the next node after 1 s, as an application does.driverOptions.windowsets the count of writers on the one channel. Each option that the client does not read goes to the socket of amqplib, for examplenoDelay. - The timeline. A log consumer reads the console log of each node. A run keeps the lines of the queue, each warning and error, and the lines of the maintenance mode. Ra writes a NOTICE for each change from or to the leader, and an INFO for each new leader that a follower detects.
- The clocks. The log has the wall clock in µs. The run puts each line on the monotonic clock with the clock lines of the client.
Each run starts from a queue that converged (rabbitmq-queues quorum_status): one leader, and a follower on each other node in its term at its commit index. The run then purges the queue. After the run, the queue converges again, and the admin reads the sequence numbers that the queue holds.
A step-down (step-down) moves the leadership to the first follower (rabbitmq-queues transfer_leadership). A drain (drain) puts the node in maintenance mode (rabbitmq-upgrade drain), and the run revives the node after it. Each of them starts an Erlang VM for the tools first. Thus its stamp is a line of the log, and not the command. For a step-down it is the NOTICE of the old leader that gives the leadership away (GIVES_AWAY). A drain stops the member of the leader, thus its stamp is the first follower that sees its monitor of the leader go down (MONITOR_DOWN).
A Kafka group (Kafka, Cell.kafka) is a group of Kafka brokers in KRaft mode with one controller, as data. The group replaces the target of its cell.
- The nodes. Each node is a container from one stock image, pinned by digest, in its own network namespace. The image starts by its own command, and each setting comes from the environment (
envOf). The controller is a node of its own. A fault does not go on it. - The topic. Each run makes one new topic with one partition, a replica on each broker, and
Kafka.minInsync. The first broker in the replica list leads. A run starts when each broker is not fenced and the partition is whole. - The sidecars. Each node has an injector sidecar in its network namespace and in its process namespace. A
partitionwithcuts: "group"cuts the leader from the other brokers and the controller. The client keeps its route to the leader. - The client. The client of each run is the producer of kafka-clients, in
image/kafka/ClientKafka.java. Each ofKafka.writersthreads has one write at a time. Each entry ofCell.driverOptionsis a producer setting. - The record. A Kafka group has no log lines in its record, and
Run.group.sentinelsholds the controller. After the run the partition converges again, and the admin (image/kafka/AdminKafka.java) reads the whole partition to its high watermark. The leader after the run tells if a failover came.
The clients and the agents
- A client image (
ClientImage,Cell.client) replaces the TCP client of the harness in each run. It operates in the namespace of the client. Its command gets the arguments of the TCP client, and it prints the same JSON lines. Its image is a stock image by its name, or the source of the image of a subject (ImageSource). - A client by its name (
Cell.client) is a client that the harness ships (SHIPPED_CLIENTS): the source of its image and its command. Thus each client of the harness is data too. - An HTTP client (
Cell.client:go-http,http-agentorundici) is a client of the harness from its own image. It sends a GET of the root, then a second request (probe.http):- after the signal (
inflight), into the fault - or by itself, a gap after its first reply (
gap), for the keep-alive race.
- after the signal (
- A client of a keyed limiter. The flag
limiter-key(probe.http.options) makes the client of undici or of Go send a key of its process in the headerx-limiter-key. Thus each run has its own count in the limiter of the target.- The flag
retrysends each request of undici through itsRetryAgent, at the defaults of undici. Eachretry-flag sets one option over them. - The client of undici then writes an
attemptline for each send of a request, with its numbernand its socket. ARetryAgentthat gives up givesUND_ERR_REQ_RETRYon theerrorline, with the status of the last reply and the count of sends.
- The flag
- The lines of an HTTP client. It writes the lines of the TCP client, with the number
iof the request on each line of a request. It also writes the connection of each try of a request (request, thenretry), with its local address and a flag for a reused connection. Each connection gets aconnline, and each end of a connection a line (eof,conn-error,closed). The end of the second request is adoneline. - A target with a script. A target can take files before it starts (
Target.files), for example the script of a Node server on the stock Node image. A target that writes JSON lines (Target.lines) gives them to each run (Run.server). The manifest holds the sha256 of each file and the first line of the target. - The WebSocket client is the
WebSocketTransportof@procedures/client: theclientprogram of aproceduressubject (Cell.clientis its client image). The client repository builds that subject (CLI-33). The cell gives each of its settings (probe.ws): the class of its sockets, the heartbeat, the reconnect, and the times of a call.- Its first request is
harness.echo. In flight, its request into the fault isharness.echo, orharness.holdfor a held reply. - It writes the lines of the TCP client. It also writes a line for each act of the program:
ping,drop,reconnectinganddial. - The class of its sockets is the global
WebSocketof Node, with the transport of the root entry. Or it is theWebSocketof thewspackage, with the transport of the Node entry@procedures/client/node. - The transport gets a subclass of that class. The subclass writes a line, then gives the work to its class. Thus the transport, undici and ws operate as they do without it.
- The subclass has
terminate()only when its class has it, because the transport drops a socket withterminate()when it exists.
- Its first request is
- A target from the image of a subject (
Target.subject). The target operates the image of a subject in place of its stock image.Target.imageis then the stock base of that image, and the manifest names both. The procedures server is a program in the image of the WebSocket client (server-ws.mjs). Thus the client and the server use one release of the package. - An agent (
lab.agent(image, command, { pid })) is a container in the network namespace of the target. Withpid, it also shares the process namespace of the target, thus it can signal the server process. Its JSON lines and itsexecstay available to the caller.
The memory of a client
A cell can set the limits of the memory controller of cgroup v2 for its client (Cell.cgroup, SYS-123). The law of those limits is in @mark1russell7/algebra (memcg.ts), from the sources of Linux.
- The files of the cgroup.
Cell.cgroupmaps a file of the client cgroup to its value, for examplememory.highin bytes. An admin container in the host cgroup namespace writes each file before the client starts. It reads each file back, and a value that the kernel changed stops the run. - The memory client is
/opt/harness/memoryof the imageharness. It has two commands:growtouches memory in steps of--steppages untilmemory.currentreaches--until-pages. Before the map of that memory, it locks its own pages, thus a reclaim frees none of them. The lock needs the capabilityIPC_LOCKof the client.oomstarts one task for each--task name:pages:adj, in order. Each task sets itsoom_score_adj, then touches its pages. An adj below the adj of the parent needsSYS_RESOURCE.
- The lines of the memory client. The
readyline gives the limits as the cgroup prints them, the usage, the page size and the lock.growwrites astepline for each step: its time, the usage after it and the count of the eventhigh.oomwrites ataskline for each task:held,killedorended, with its signal. Both commands end with the counts ofmemory.events, andgrowalso gives the stall ofmemory.pressure. - The law of a throttle (
MemoryThrottlePrediction) has one entry for each batch of 64 pages abovememory.high. An entry is the time band of a step and its eventshigh. The judge (measureMemory) compares each step with the entries at its usage and at its usage plus the drift (stepBand). It also compares the stall ofmemory.pressurewith the sum of the low ends of the bands. - The law of the OOM killer (
MemoryOomPrediction) gives the outcome of each task and the count of the eventoom_killof the cgroup. - A void run. A run is void when the cgroup reads other limits than the cell, or when the client stops before its end. A throttle run is also void when the client did not lock its pages, or on a kernel with another HZ. It is void too when the judge reads less than the share
readof the steps above the high. The judge does not read a step whose usage rose by more or less than one batch, outside the drift.
The egress qdisc of a client
A cell can put a qdisc at the root of the interface of its client, and judge the time that each datagram leaves it (EgressPrediction, SYS-124). The law of netem and tbf is in @mark1russell7/algebra (egress.ts), from the sources of Linux.
- The egress client is
/opt/harness/egressof the imageharness. It has two commands:sink PORTbinds a UDP socket and reads each datagram. The target of an egress cell is this sink.sendputs the qdisc of--qdiscat the root ofeth0withtc qdisc replace. Then it sends each--burst AT_MS:COUNT:PAYLOADof UDP datagrams to the target. The qdisc and the pin of the neighbour need the capabilityNET_ADMINof the client.
- The stamps of the kernel. The client sets
SO_TIMESTAMPINGwith the stampsSCHEDandSOFTWARE. The kernel gives a stamp when the qdisc takes a datagram and a stamp when the device takes it from the qdisc. The client moves each stamp fromCLOCK_REALTIMEtoCLOCK_MONOTONIC. A drop of the qdisc is a send that givesENOBUFS. - No other traffic. Before the qdisc, the client pins the neighbour of the target as
PERMANENT, thus no ARP packet goes through the qdisc. It reads the counts of the root qdisc before and after the bursts. - The lines of the egress client. The
readyline gives the MTU, the root qdisc astcreads it and the neighbour. Apacketline gives each datagram: its key, its burst, its errno and its two stamps. The client ends with the counts of the qdisc (stats), the step of the clock (clock) anddone. - The law of a datagram (
EgressPacketLaw) issentordropped. A sent datagram has a time band after the first arrival of its burst. A drop is at thelimitof the queue, or at thesizeof the burst of tbf. The judge (measureEgress) compares each datagram with its law. - A void run. A run is void when the client stops before its end or when the root qdisc is of another kind. A neighbour that is not permanent voids a run too. It is void too when a send fails with another error. A burst that spreads more than
spread, or that starts more thanjitteroff its time, voids its run. The counts of the qdisc void a run when other traffic went through it. A step of the clock above 100 µs voids a run, and a read of less than the sharereadof the departures voids it too.
The resources of a container
A lab reads the resources that a container used: its CPU time, its memory and the traffic of its devices. Each reading has its stamps on CLOCK_MONOTONIC, the clock of each line of a lab. Thus a load test puts the resources of its server next to the times of the load client.
import { quantity } from "@mark1russell7/quantity";
import { constant } from "@mark1russell7/rigor-chaos";
import { LOAD_PATH, loadPlanOf, openLab, resourceChange } from "@mark1russell7/harness";
// the server has 1 CPU and 512 MiB on CPU 0. The client and the reader have the CPUs 2 and 3.
const lab = await openLab({ ...target, limits: { cpus: 1, cpuset: "0", memory: quantity(512, "MiB") } }, "load");
const reader = await lab.resources({ period: quantity(1, "s"), cpuset: "2-3" });
const get = "GET / HTTP/1.1\r\nHost: target\r\n\r\n";
const load = loadPlanOf([{ key: "get", plan: { profile: constant(200, 30_000), options: { arrivals: "uniform" } }, requests: [get] }]);
const args = [lab.targetIp, String(lab.targetPort), "--plan", LOAD_PATH];
const probe = await lab.probe(args, [{ content: load.content, target: LOAD_PATH }], undefined, { cpuset: "2-3" });
await probe.until(["ready"], 15_000);
const before = await reader.read();
await probe.go();
await probe.until(["done", "deadline", "fail"], 60_000);
const used = resourceChange(before, await reader.read());
console.log(used.cpu?.total, used.network?.tx.bytes, used.memory.peak, reader.series.length);- The limits of a container (
ContainerLimits).Target.limitsgives the limits of the target ofopenLab. The fourth argument oflab.probegives the limits of a client.cpusis the CPU quota,cpusetis the list of CPUs, andmemoryis the memory limit. The container gets no swap.hostLimitsOfgives the limits as Docker takes them:NanoCpus,CpusetCpus,MemoryandMemorySwap. Limits with a problem (limitsProblems) stop the lab before the container starts.
- The reader is
/opt/harness/resourcesof the imageharness, in a privileged sidecar (resourceReader).lab.resources()reads the target, andprobe.resources()reads a client.- The sidecar is in the network namespace of the container and in the cgroup namespace of the host. It is not in the cgroup of the container. Thus its own CPU time and memory are not in the readings.
ResourceOptions.cpusetkeeps the reader on the CPUs that it names, for example the CPUs of the client.
- A reading (
ResourceReading) has the counters of one moment, between its two stamps (t0,t1):cpu.stat: the CPU time (usage,user,system), the periods of the CPU limit, and the count and the time of its stops.memory.current,memory.peak, andanon,file,kernelandsockofmemory.stat. The counts ofmemory.eventsincludeoom_kill: the tasks that the kernel stopped at the memory limit.pids.current, and the bytes and the packets of each device of/proc/net/devwithoutlo, with their sums.- The limits as the kernel prints them:
cpu.max,memory.maxandcpuset.cpus.effective.
- The two uses of a reader.
read()gives one reading at a named moment, for example before and after a schedule. Withperiod, the reader also writes a series (series), one reading each period, from its start to its stop. - The change between two readings (
resourceChange) gives the CPU time (total, user and system) and the time that the CPU limit stopped the container. It also gives the bytes and the packets of each direction, the last memory and the peak.- A counter that went down, as after a restart of the container, is in
resets, and its part is null. The function does not give a negative amount.
- A counter that went down, as after a restart of the container, is in
- No read is not a zero. A file that the reader cannot read gives null for its values. An example is
memory.peakon a kernel before Linux 5.19.- Docker removes the cgroup of a client when its program ends. After that, a
read()throws, and each reading of a series has null for the values of the cgroup. - The traffic of a client is the traffic of the namespace that the clients of the lab share.
- Docker removes the cgroup of a client when its program ends. After that, a
- The parse is in TypeScript. The reader writes the text of each file in one JSON line.
resourceReadingOfreads that line withcpuStatOf,memoryStatOf,cpuMaxOf,networkOf,cgroupNumber,cgroupLimitandcgroupKeyed. - The readings of a cell (from 0.16.16). A cell can measure the cost of its target in each run, with
runCell:Cell.clientLimitsgives the limits of the client in each run, for example other CPUs than the target.Cell.resourcesstarts a reader of the target in each run, with these options. The reader stops at the end of the run.- Each run then keeps
Run.resources. It has a reading when the client is ready and before it sends (start). It also has a reading after the run ended (end), and the series of the reader. environmentProblemsnames each problem of the limits of the target and of the client, before a lab opens. It also names each bad value of the connections of a load stream.
The subjects
A subject (Subject, image.ts) is the program under test, as data. The harness does not import the program. It starts the image of the program. Thus another repository can give its own subject, with its own release in it.
- The source of an image (
ImageSource) tells where the image comes from:pinned: an image of a registry with its digest,name@sha256:<64 hex digits>. The lab pulls it.build: a build context that the caller gives.contextis its folder,dockerfileis its Dockerfile, andfilesare the files and folders that the Dockerfile reads.shipped: an image that the harness ships, by its name (SHIPPED_NAMES).
- A relative folder of a build starts at the working folder of the process. A record holds the source of each image as the cell gives it. Thus give a relative folder, and the record names no path of the machine.
- A subject gives the source of its image and its stock base, pinned by digest. It also gives the command of each of its programs by their roles, for example
clientandserver. - A subject in a cell.
subjectClient(subject)gives the client of a cell, andprogramOf(subject, role)gives the command of a program. A target operates the image of the subject (Target.subject), and its stock image is the base of the subject. - A client that the harness ships keeps its name. When the client of a subject is a client that the harness ships,
subjectClientgives its name. Thus the records of a cell on that subject stay the same. - The procedures subject is a subject of the client repository:
harness/procedures-subject/subject.jsonof github.com/mark1russell7/client. From 0.12.0, the harness ships no procedures subject. The cells check out the client repository and give that subject.
These rules keep a build the same in each run:
- A pinned image names its digest. A tag alone can move.
- Each
FROMof the Dockerfile of a build names a digest, an earlier stage, orscratch. - Each
package.jsonandCargo.tomlof a build has a lockfile in its folder or in a folder above it. - The npm lockfile in the folder of each
package.jsonsatisfies it: the lock holds each direct dependency, at a version in its range.npm cirefuses a pair that does not agree, thus the plan refuses it first and names each dependency.npmDrift(manifest, lock)gives the same lines. - Each path of a build stays in its context.
- The tag of a build is its name, then 12 digits of a sha256. The sha256 reads the path of the Dockerfile, and the path and the content of each file. Thus a changed program cannot operate as an old one.
The images that the harness ships obey the same rules. A source that breaks a rule fails before Docker starts (planOf, imageProblems, subjectProblems). A pinned image, or a stock image by its name, does not load Testcontainers before the lab starts it.
The entry @mark1russell7/harness/schema has the zod schemas of a source (imageSourceSchema), a client (clientSchema) and a subject (subjectSchema). A runner that reads a subject as JSON examines it with them. The root entry does not import zod.
The images
The harness ships seventeen images, each as a shipped source (ImageSource). The tag of each image comes from the path of its Dockerfile and the content of all the files that its Dockerfile reads. The harness copies these files into a new build context, from its own package and from the prober package. Thus the build works in a workspace and from npm.
From 0.11.20, the harness builds each image with the CLI of Docker (docker build), thus with BuildKit where the CLI has it. Testcontainers reads nothing of the output of a build, and its error is "Failed to build image" only. The error of a failed build holds each line of its output that names an error, and its last 15 lines (buildFailure). Thus the host of a lab needs the CLI of Docker and its daemon.
- The harness image (
image/Dockerfile) has two stages, each a digest-pinned Alpine.Cargo.lockpins the crates. The image holds:- the kernel program of the prober, compiled against the BTF of the kernel that builds it, and its Rust collector.
client, the TCP client of a cell. Rust'sstd::netsets no socket option by itself, thus the measurement gets the timers of the namespace. The client also samplesTCP_INFOeach 2 ms, a second vantage on its socket. It waits inpoll(), which does not lock the socket. A keepalive timer that finds its socket held tries again HZ/20 later.- In a stream, a reply of the
clientis whole at its CRLF, or after the length of a bulk string. The client then writes arepliedline. load, the open-loop driver of an HTTP/1.1 server (SYS-93). Its plan (systems-load/1) is a list of streams, each with a key, a schedule (rigor-schedule/1) and its requests. Each stream has its own connections, thus a slow reply delays only its own stream. A send does not wait for a reply. A response is whole after itsContent-Lengthor its last chunk. Thesentandrepliedlines name the stream (k) and the arrival (i), and arepliedline names the status.- The field
connectionsof a stream (LoadConnections) sets how its arrivals go to the server. A plan with no such field gives the same lines as before.{ mode: "pipeline" }is the default. The stream has one connection, and each arrival goes at its time also when the replies before it are not in. The replies come in the order of the requests. Thus a slow reply delays each reply after it on the stream.{ mode: "pool", size }keepssizeconnections, from 1 to 1024, each with one request in flight at most. The driver opens them beforeready. A due arrival takes the connection that is idle for the longest time. With no idle connection, it waits in a queue of its stream.{ mode: "fresh" }opens a new connection for each arrival at its time, and closes it after the reply. The connect does not block the other streams. A failed connect is anerrorline of that arrival only, and the stream goes on.- A run of a cell with a pool or a fresh stream ends at
doneor at the deadline (loadEnds). Anerroror aneofof one connection does not end it. - In a pool and in a fresh stream, each
repliedline names the arrival of its own connection. Thus the replies can come out of order. Thesentline comes at the write and gives the wait for the connection in ns (wait). That wait is not a lag of the driver:streamsLoadOftakes it out of the lag. The latency still counts from the planned time. - A fresh stream leaves each closed connection in TIME_WAIT on the client, thus a high rate can use all the local ports. A pool needs a keep-alive time of the server above the idle time of each connection.
resources, the reader of the resources of a container.readprints one JSON line with the text of each file of a cgroup and of/proc/net/dev, between two monotonic stamps.watchprints one line each period. Each line of a series has its place on the clock from the start of the series. Thus a slow reading does not move the later ones.inject, which applies a fault in oneiptables-restorecommit, with monotonic stamps around the commit. Thus the start of a fault is known in the VM. Adocker execfrom Windows comes 190 ms late at the median. With--via DEV, the rules go in the FORWARD chain, on the device toward one side.--protocoland--handshake passchange the match of a rule, andinject silencedrops each packet of its namespace.injectalso sends a signal to a process by its name (signal), and one command to a server of the Redis protocol (resp). Stamps bracket each.
- The Node client image (
image/node) is a driver client: ioredis 6.0.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them.client-ioredis.mjsprints the lines of the TCP client on the same clock, and it adds the status changes of ioredis asstatuslines. The same image holds the client of a group in Sentinel mode (client-sentinel.mjs) and the observer of its Sentinels (observer.mjs). - The Go HTTP image (
image/go-http) is thehttp.Transportof Go 1.27.2 at its defaults (client-go). The program uses the standard library only, thus the digest of the Go builder pins all of its code. The build doesgofmtandgo vetfirst. A wrapper on each connection writes what the read loop of the transport reads. The trace of the transport writes each try of a request. - The Node HTTP image (
image/node-http) holds thehttp.Agentof Node 24.21.0 (client-agent.mjs) and an HTTP/1.1Clientof undici 8.12.2 (client-undici.mjs). The digest of the image and an npm lockfile pin them. It is apart from the image of ioredis, thus the cells of ioredis keep their image. - The PostgreSQL client image (
image/pg) is node-postgres: pg 8.23.1 with pg-pool 3.14.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them.client-pg.mjsmakes onepg.Poolwith the options of the cell (Cell.driverOptions), and it prints the lines of the TCP client on the same clock. The first query makes the connection, and the reply gives the client back to the pool, where it is idle. An error of the pool for that idle client is the detection of an idle cell. The probe is{ driver: { name: "pg", query, inflight } }, withSELECT 1as the query when the cell gives none.inflightis the text of the query in flight: the second query of an in-flight run. The first query then makes the pool ready at once, and only the query in flight is slow, for exampleSELECT pg_sleep(20). The HikariCP client reads it too.
- The HikariCP client image (
image/hikari) is HikariCP 7.1.0 over pgjdbc 42.7.13 on Temurin 21.0.12.1. The digests of the two stages and the SHA-256 of each jar pin them. The probe is{ driver: { name: "hikari", query, inflight } }.ClientHikari.javamakes oneHikariDataSourcewith the properties of the cell (Cell.driverOptions). A name with the prefixdataSource.is a property of pgjdbc. A name with the prefixsystem.is a system property of the JVM, which the client sets before its pool.- The user is
postgres, unless the cell givesusername(andpassword). Supavisor finds the tenant of a client in its user, for examplepostgres.harness. - It prints the lines of the pg client on the same clock. Each socket comes from the
PGStreamof its connection, and apoolline gives each change of the counts of the pool. The errno of a failure is the SQLState of pgjdbc. - Before its first line, it loads the classes of a connect and of a pool on the loopback of its namespace. It also starts the SecureRandom that HikariCP reads for the UUID of each new connection. Then it parses an ERROR of the server, as for the timeout of a statement. A new JVM loads each class at its first use. Thus a band does not time that load.
- With
burstin the probe ({ count, gap }), it sendscountqueries in place of one query in flight. Query 2 and the next ones each start on their own thread,gapapart, when each connection of the pool is idle. Aburstline gives the counts of replies and failures, then the counts of the pool. Before its first line, a client with a burst also makes one borrow that times out. Thus the band of a failure does not time that load.
- The RabbitMQ client image (
image/amqp) is amqplib 2.2.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them. The probe is{ driver: { name: "amqp" } }.client-amqp.mjsopens one connection and one channel. Each operation is an RPC of the channel: the first declares a queue that the broker names, and each later one declares it passively (checkQueue). The queue is exclusive, because RabbitMQ 4.3 refuses a transient queue that is not.- The options of the cell (
Cell.driverOptions) giveheartbeatin seconds, the user and its password (guest at the defaults), and the socket options of amqplib. - It prints the lines of the pg client on the same clock. A
connectionline gives each event of the connection, and achannelline each event of the channel. The errno of a failure is the error of the connection when it has one.
- The Kafka client image (
image/kafka) is kafka-clients 4.3.2 on Java 21, on the base image of the HikariCP client. The digest of the image and the hash of each jar (jars.sha256) pin them. A Kafka lab starts it (Cell.kafka), not a probe of a driver.ClientKafka.javawrites the sequence numbers to partition 0 of the topic of the run, with the settings of the cell. It printssent,ackandfaillines on the monotonic clock.AdminKafka.javamakes a topic, gives a view of the partition, and reads the whole partition.
- The gRPC client image (
image/grpc) is grpc-js 1.14.6 on Node 24.21.0. The digest of the image and an npm lockfile pin them. The probe is{ driver: { name: "grpc", hold } }.client-grpc.mjsopens one channel with no TLS. Each operation is a unary call ofgrpc.health.v1.Health/Check, with the messages encoded in the script. The first call makes the connection.- The options of the cell (
Cell.driverOptions) are the channel options of grpc-js (grpc.*), anddeadline_msfor the deadline of each call. Withhold, the call in flight asks the server of the harness to hold its reply that long. - grpc-js does not give its socket, thus the script names each socket from
net.connect, as the MongoDB client does. Astateline gives each change of the connectivity state of the channel, and alogline each line that grpc-js logs. - The errno of a failure is the error of the socket when it has one. It is EOF for an end by the server, else the status of the call.
- With
op: "watch", the operation in flight is a stream ofgrpc.health.v1.Health/Watch, which stays open. A GOAWAY of the server withtoo_many_pingsgives the errnotoo_many_pings: grpc-js logs that refusal before the end of the socket.
- The grpc-go image (
image/grpc-go) is the gRPC server of the harness, a server of grpc-go v1.84.0, built with Go 1.27.2 on a digest-pinned Alpine. A target takes it as the image of a subject:{ kind: "shipped", name: "grpc-go" }.go mod tidygets the modules of grpc-go at its tag, and the go command checks each module against the checksum database of Go. The build log prints the go.sum. The build doesgofmtandgo vetfirst.- The server is at the defaults of grpc-go and of Go, and each flag sets one value over them. The flags set the keepalive, the policy for PINGs, the age of a connection and the TCP keepalive of the listener.
- It serves
grpc.health.v1.Health. A check of the servicehold:<ms>holds its reply for that time, and Watch holds a stream open. It writes JSON lines on the monotonic clock (Target.lines). - At SIGTERM, it writes
stopping, and GracefulStop closes its listener and sends GOAWAY on each connection. - From 0.11.26,
--namegives a name to each line (p) and to each reply of Check (the headerx-pod), and--clock msgivestin milliseconds. A kind cell of@mark1russell7/kinduses both. - From 0.12.2,
--fail-file PATHadds the serviceliveness, the seam of a liveness restart. Check oflivenessanswers NOT_SERVING while the file at PATH exists, and each such reply writes anot-servingline. Check of the service""still answers SERVING. Without the flag, the server does not change.
- The etcd image (
image/etcd) is etcd v3.6.15 on a digest-pinned Alpine. The binaries come unchanged from the image of etcd, pinned by digest. That image has no shell, and a cell holds the server as the child of a shell. A target takes it as the image of a subject:{ kind: "shipped", name: "etcd" }. - The MongoDB client image (
image/mongo) is the driver mongodb 7.7.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them.client-mongo.mjsprints the lines of the TCP client on the same clock:- Each socket of the driver is a
socketline with its role:monitor,rttorpool. The stack of the call that makes the socket gives the role. - The events of the driver are
sdamlines (the heartbeats and the changes of each server),cmaplines (the pools) andcommandlines (each try of an operation). - Each operation is a
sentline, then anackline or afailline. Anackline has the server that accepted it. Afailline has the name and the labels of its error. - The same image holds
stepdown-mongo.mjs, the sender ofreplSetStepDown.
- Each socket of the driver is a
- The router image (
image/router) is a digest-pinned Alpine with conntrack-tools, nftables, iproute2 and Python.mbx.shsets the form of the router in one nftables table,ctwatch.pywrites the conntrack events, andresetter.pysends the resets of thereset-bothform. Each run records its packages in the manifest. - The PgBouncer image (
image/pgbouncer) is PgBouncer 1.26.1, a pooler hop, on a digest-pinned Alpine. The build gets the release tarball of pgbouncer.org and checks its SHA-256 before it builds. The C sources of that tarball are those of the tag that the machine documents cite.- A hop takes the image as a shipped source:
{ kind: "shipped", name: "pgbouncer" }. A proxy hop also takes a stock image by its digest. - A cell gives its configuration as files of the hop (
ProxyHop.files):/etc/pgbouncer/pgbouncer.iniand/etc/pgbouncer/userlist.txt. In them,{{next.host}}and{{next.port}}are the host and the port of the server. - PgBouncer does not start as root, thus it operates as its own user.
- A hop takes the image as a shipped source:
- The Pgpool-II image (
image/pgpool) is Pgpool-II 4.7.3, a pooler hop, on a digest-pinned Alpine. The build gets the source of the tag V4_7_3 from GitHub and checks its SHA-256 before it builds. The tree of git holds noconfigure, thus the build runs autoreconf, and bison and flex make the parser.- A hop takes the image as a shipped source:
{ kind: "shipped", name: "pgpool" }. - A cell gives its configuration as one file of the hop:
/etc/pgpool/pgpool.conf. Each other file that Pgpool-II reads is empty in the image. Pgpool-II operates in the foreground as its own user.
- A hop takes the image as a shipped source:
- The docker-proxy image (
image/docker-proxy) is docker-proxy of Docker Engine 29.1.5, the userland proxy of a published port, as a proxy hop. The build gets the static bundle of Docker 29.1.5 and checks its SHA-256. The proxy writes its status to fd 3, the pipe of its parent in Docker. Thus a cell starts it with3>/dev/null. - The LazyFS image (
image/lazyfs) is LazyFS of the commit 3edad01 with Node.js 24.21.0, on a digest-pinned Debian. It is the image of the disk tier.- The image also builds the fault layer
faultfs(image/lazyfs/faultfs.c) on libfuse 3. It mounts/mnt/diskabove the mount of LazyFS,/mnt/lazy. - LazyFS is a FUSE file system that keeps each write in its cache until an fsync. The command
lazyfs::clear-cacheloses each write of data after the last fsync. It keeps each directory entry: LazyFS applies each new file, each rename and each unlink at once. This is the rule of the kindlose-unsynced. - The build gets the tarball of the commit, toml11 v3.7.1 and spdlog v1.10.0. It checks the SHA-256 of each before it builds.
- The image also builds the fault layer
The build does the cargo test of the two crates. Thus the record decoder passes its tests before an image exists. Each amount that the native programs print is a quantity in a canonical unit. For example, an RTO is in jiffy, a round trip in us, and a segment in B.
ioredis sets the keepalive of its socket itself, after it connects. Thus a cell sets the keepalive of a driver through the keepAlive option of ioredis (probe.driver). The keepalive sysctls of the namespace do not apply to it.
The faults
- A black hole is DROP rules in the two directions, in the namespace of the peer of the observer. Thus the measurement gets the kernel timers of the observer. For the client, the rules go in the namespace of the target, through the injector. For the server, they go in the namespace of the client, through its admin sidecar. Rules in the namespace of the observer make its sends fail with EPERM, and the kernel records only a retransmission that goes out (
FaultSide). - A reset is a
REJECT --reject-with tcp-resetrule in the namespace of the target, for the segments of the client. The next send of the client gets a reset one round trip later. It is the reference fault of the calibration. - A frozen process is the cgroup freezer (
docker pause), while the kernel stays up. A target that names its server process (Target.program) freezes by SIGSTOP from a sidecar in its process namespace, with stamps (lab.signal). A hold (Cell.hold) then thaws it with SIGCONT at that time after the freeze. - A fault before the client (
Cell.before) holds before the client starts. Thus the first selection of the driver meets it. It is a black hole, a reset or an ICMP unreachable. - A stall is a black hole that stops by itself,
Cell.stallafter the send of the request. The run reads the stamp of the client on the send. Theninject clear PEER --at NSholds the end in the VM until that instant (lab.heal). Thus the latency of a docker exec does not change the length of the stall. An idle client sends only the pings of its heartbeat, thus its stall counts from its first ping into the stall. - An ICMP unreachable (
unreachable,Cell.icmp) answers each segment from the observer with host, net or port unreachable, or admin prohibited. Linux keeps it as a soft error, continues to retransmit, and gives the errno of the ICMP at the timeout. Host and net unreachable also revert the backoff (RFC 6069). - A simplex partition (
simplex,Cell.drops) drops the segments to the server, or the segments to the client, but not both. - A FIN (
fin) stops the process of the peer with SIGKILL while its kernel stays up. For the client, the target starts its server as the child of a shell (Target.command), andTarget.killstops it. For the server, the harness stops the container of the client. - An MTU black hole (
mtu-blackhole,Cell.mtu) drops each segment longer than the length, in the namespace that receives it. At a router (Cell.faultAt), it drops what the router forwards from one side. - A lost ACK of a FIN (
fin-ack) drops the first ACK of each FIN of the client, in the namespace of the client. The mark of each connection in conntrack counts the FINs of the client, thus the ACK of the second FIN passes. A connection that the client closes second stays inLAST_ACKuntil its retransmission timer fires. - netem (
netem,Cell.netem) is tc netem on the egress of the target: loss, duplication, reordering or corruption. The outcome is a distribution. At a hop, netem is on the egress of the device of the hop toward one side. - A latency (
Cell.latency) is tc netem delay on the egress of the target before the client connects. Thus the round trip and the RTO include it. - A fault at a proxy (
Cell.faultAt) puts the rules of a fault in the namespace of the proxy, toward the client or toward the target. The rules act on the sockets of the proxy. - A fault at a router (
Cell.faultAt) puts FORWARD rules in the namespace of the router, through its injector sidecar. A router forwards past INPUT and OUTPUT. Each rule faces one side by the device toward it, and by the address of the peer on that side:- A black hole drops what comes in from that side (
-i DEV -s PEER) and what goes out to it (-o DEV -d PEER). A simplex partition drops one of the two. - A reset answers each segment from that side with a reset from the router. The reset has the address that the segment went to.
- An ICMP unreachable comes from the address of the router on that device, not from the peer. Its rate limit is in the
sysctlsof the router. - The rules of the fault are in the filter table of iptables. The form of the router is a table of nftables at the same priority. Thus the two can both drop a packet, and an accept of one does not pass a drop of the other.
- Conntrack sees each packet before a FORWARD rule drops it. Thus a retransmission into a black hole at the router refreshes the flow. The resets of the
reset-bothform leave from the stack of the router, past its own FORWARD rules.
- A black hole drops what comes in from that side (
- No fault (
none) injects nothing. A calibration cell measures the path itself (Cell.calibrates). - A forgotten flow (
middlebox-forget) injects nothing. The router of the topology forgets an idle flow at its own timeout.Cell.idleBeforeholds an in-flight request until after the forget. - An idle proxy (
proxy-idle) injects nothing. The proxy closes an idle connection at its own timeout. - A toxic (
toxic,Cell.toxic) is one toxic of Toxiproxy, added through its HTTP API byinject http, with monotonic stamps around the request. Its name isfault, and the harness removes it after the run. A cell whose fault is another one adds its toxic first: a slow close, then the close of the server. - A close of the server (
server-close) makes the server close the connection of each client, withTarget.close:CLIENT KILLfor Redis. - A stall of the application (
app-stall) injects nothing. The server process holds the reply, because the request asks for it (HttpProbe.hold), and its kernel stays up. - An event at a proxy (
hop-event,Cell.event) is a signal to the program of the proxy, or a query on its console. Examples are a reload of the configuration, a stop of a proxy and PAUSE on the console of PgBouncer.- A signal goes to each process of
ProxyHop.program: HUP, TERM, INT, STOP or CONT (HopSignal). A sidecar in the network and process namespaces of the proxy sends it (inject signal NAME HUP). The lab starts that sidecar at the first signal. - STOP blocks the event loop of the proxy: its processes stop, and its kernel keeps each socket. With a hold (
Cell.hold), CONT thaws it at that time after the stop, from inside the VM (--at). The lift thaws a proxy that its hold did not thaw. - A write (
HopWrite) changes a file of the proxy, as an edit of its configuration does. The sidecar writes it through the root of the program (inject write NAME PATH CONTENT): first a file beside it, then a rename in one step. Thus a program that watc
- A signal goes to each process of
