Resources

class Resources(processes: Map<String, Long>, containers: List<String>, mongoContainer: String?, postgresContainer: String?, postgresDatabase: String, kafkaContainer: String?, mongoDatabase: String = DEFAULT_DATABASE, published: PublishedStream? = null, catchUpLimitSeconds: Int = DEFAULT_CATCH_UP_LIMIT_SECONDS)

The cost of a run, captured beside it over its measured phase:

  • each server JVM (processes, name to pid): its CPU time and resident memory every second (/proc on Linux, ps elsewhere), its garbage collector and heap from jstat -gc, one sampling process per JVM, and the bytes it allocated (Allocations), so the results give bytes per operation beside CPU;

  • each container (containers): its CPU and memory from one docker stats stream;

  • the stores' operation counters: MongoDB's serverStatus().opcounters with its journal's syncs, its write concern's waits, its operations' latencies, its transactions aborted and its write conflicts (mongoContainer), and PostgreSQL's pg_stat_database of postgresDatabase with pg_stat_wal (postgresContainer), each from one session that prints them every second, and the end offsets of every Kafka topic and partition (kafkaContainer);

  • a published stream: its partitions' heads, the transport sink's checkpoints and the oldest commit waiting above them, every second from one more session of the store's (PublishedStream; on MongoDB in mongoDatabase), which goes on after the measured phase until the stream caught up or catchUpLimitSeconds passed since the drain.

Nothing starts inside the measured phase (B.O-2): prepare, at the warm-up, starts every sampling process, opens the allocation connections and reads the Kafka offsets once (kafka-get-offsets is a JVM of its own); start and stop only read what is already running, and complete, after the drain, waits for the published stream to catch up and reads the Kafka offsets again. The stores' counters at the phase's edges are the samples nearest to them; PostgreSQL's also give a per-second series of commits and WAL writes and flushes (B.O-3), and MongoDB's one of its writes and journal syncs. The samplers are a few percent of a core; the results say what they were. The published stream's reads count among the store's own: on PostgreSQL one statement a second, on MongoDB two queries a partition and one of the checkpoints a second.

Constructors

Link copied to clipboard
constructor(processes: Map<String, Long>, containers: List<String>, mongoContainer: String?, postgresContainer: String?, postgresDatabase: String, kafkaContainer: String?, mongoDatabase: String = DEFAULT_DATABASE, published: PublishedStream? = null, catchUpLimitSeconds: Int = DEFAULT_CATCH_UP_LIMIT_SECONDS)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

What stop captured, once it has; complete adds the published stream and the Kafka offsets.

Functions

Link copied to clipboard
fun complete()

After the drain, added to stopped: the published stream once it caught up (or catchUpLimitSeconds after the drain), then the Kafka offsets again (a JVM of its own, so outside the measured phase), which then hold every record the stream published of the run.

Link copied to clipboard

Every process's cumulative CPU seconds, read as cpu reads them.

Link copied to clipboard
fun prepare()

Starts every sampling process and opens the allocation connections, at the warm-up: the first attach starts a JVM's management agent, and mongosh, psql and jstat take a moment to start, none of which may land in the measured phase. The Kafka offsets are read last, once.

Link copied to clipboard
fun start()

The measured phase starts: reads what prepare started, and launches nothing.

Link copied to clipboard
fun stop(): Map<String, Any?>

The measured phase ends: gives back what the samplers captured over it, for the results.