Documentation
¶
Overview ¶
Package benchbaseline holds baseline IPC implementations (direct function calls, raw UDS, net/rpc, and gRPC over TCP/UDS) for benchmarking against the shared-memory transport. It also provides the result row schema and JSONL writer used by both the spike and production benchmarks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteJSONL ¶
WriteJSONL appends results to path as JSONL (one JSON object per line), creating the file and any missing parent directories as needed.
Types ¶
type Baseline ¶
type Baseline interface {
// Name returns the baseline implementation's identifying name.
Name() string
// Start prepares and starts the baseline (e.g., spawning a subprocess or opening a listener).
Start() error
// Stop tears down the baseline, releasing any resources that Start acquired.
Stop() error
// Call performs one round-trip request/response over the baseline, returning the response payload.
Call(payload []byte) ([]byte, error)
}
Baseline is the interface every benchmark comparison point must implement: an echo round-trip that accepts a payload and returns it, plus explicit start/stop hooks so the benchmark suite can uniformly set up and tear down each baseline.
type DirectBaseline ¶
type DirectBaseline struct{}
DirectBaseline is the speed-of-light reference: an ordinary function call, no IPC of any kind.
func (*DirectBaseline) Name ¶
func (d *DirectBaseline) Name() string
func (*DirectBaseline) Start ¶
func (d *DirectBaseline) Start() error
func (*DirectBaseline) Stop ¶
func (d *DirectBaseline) Stop() error
type EchoArgs ¶
type EchoArgs struct{ Payload []byte }
EchoArgs holds a payload for the Echo RPC call.
type EchoReply ¶
type EchoReply struct{ Payload []byte }
EchoReply holds the response payload from the Echo RPC call.
type GRPCTCPBaseline ¶
type GRPCTCPBaseline struct {
// contains filtered or unexported fields
}
GRPCTCPBaseline runs the Ping gRPC service over TCP loopback (127.0.0.1).
func (*GRPCTCPBaseline) Name ¶
func (g *GRPCTCPBaseline) Name() string
func (*GRPCTCPBaseline) Start ¶
func (g *GRPCTCPBaseline) Start() error
func (*GRPCTCPBaseline) Stop ¶
func (g *GRPCTCPBaseline) Stop() error
type GRPCUDSBaseline ¶
type GRPCUDSBaseline struct {
// contains filtered or unexported fields
}
GRPCUDSBaseline runs the Ping gRPC service over a Unix domain socket.
func (*GRPCUDSBaseline) Name ¶
func (g *GRPCUDSBaseline) Name() string
func (*GRPCUDSBaseline) Start ¶
func (g *GRPCUDSBaseline) Start() error
func (*GRPCUDSBaseline) Stop ¶
func (g *GRPCUDSBaseline) Stop() error
type NetRPCBaseline ¶
type NetRPCBaseline struct {
// contains filtered or unexported fields
}
NetRPCBaseline uses the stdlib net/rpc package (gob codec) over a Unix domain socket.
func (*NetRPCBaseline) Name ¶
func (n *NetRPCBaseline) Name() string
func (*NetRPCBaseline) Start ¶
func (n *NetRPCBaseline) Start() error
func (*NetRPCBaseline) Stop ¶
func (n *NetRPCBaseline) Stop() error
type RawUDSBaseline ¶
type RawUDSBaseline struct {
// contains filtered or unexported fields
}
RawUDSBaseline is a length-prefixed echo server over a Unix domain socket with no framing library or RPC layer — the floor for any UDS-based transport.
func (*RawUDSBaseline) Name ¶
func (r *RawUDSBaseline) Name() string
func (*RawUDSBaseline) Start ¶
func (r *RawUDSBaseline) Start() error
func (*RawUDSBaseline) Stop ¶
func (r *RawUDSBaseline) Stop() error
type Result ¶
type Result struct {
Impl string `json:"impl"`
PayloadBytes int `json:"payload_bytes"`
Concurrency int `json:"concurrency"`
Regime string `json:"regime"`
P50Ns float64 `json:"p50_ns"`
P95Ns float64 `json:"p95_ns"`
P99Ns float64 `json:"p99_ns"`
P999Ns float64 `json:"p999_ns"`
ThroughputOpsSec float64 `json:"throughput_ops_sec"`
// AllocsPerOp measures whole-harness allocation, not isolated transport per-op allocation.
// It is (runtime.MemStats.Mallocs delta across the entire timed region) / samples, so it
// includes every allocation any goroutine made during that window — the benchmark driver's
// own per-call goroutine spawn/WaitGroup/response-byte-slice bookkeeping, not just the
// transport implementation's allocations. It is useful for relative comparison across
// implementations measured by the same driver, but not as an absolute claim (e.g., "the
// shared-memory transport allocates N bytes per call").
AllocsPerOp float64 `json:"allocs_per_op"`
// WakeupSyscallsPerOp is populated only for shared-memory transports (shm-spike prototype
// and production-shm rows), which define the metric for a shared-memory data plane.
// Every other implementation reports 0 rather than an approximate, misleading number.
// Even for shared-memory transports, the value covers only the HOST-observable half of a
// round trip (the write(2) to wake a parked plugin, plus the read(2) the host issues when
// it blocks for a response); the plugin's own read(2)/write(2) syscalls happen in a
// separate OS process and are not visible from the host without cross-process instrumentation.
WakeupSyscallsPerOp float64 `json:"wakeup_syscalls_per_op"`
Samples int `json:"samples"`
Timestamp time.Time `json:"timestamp"`
}
Result represents one row of a benchmark suite's machine-readable output, written by both the spike and production shared-memory benchmarks.