Documentation
¶
Overview ¶
Package glutton implements the benchmarking workload served by cmd/benchmarking/glutton: an API for consuming RAM, disk, and file descriptors, and for gossiping with other glutton instances, over either gRPC or protobuf-over-HTTP. See internal/proto/glutton/glutton.proto.
Index ¶
- Constants
- func Handler(mode string, svc *Service) (http.Handler, error)
- func NewServer(handler http.Handler) *http.Server
- type Service
- func (s *Service) BurnCPU(ctx context.Context, req *gluttonpb.BurnCPURequest) (*gluttonpb.BurnCPUResponse, error)
- func (s *Service) Close()
- func (s *Service) Gossip(_ context.Context, req *gluttonpb.GossipRequest) (*gluttonpb.GossipResponse, error)
- func (s *Service) Ingest(ctx context.Context, req *gluttonpb.IngestRequest) (*gluttonpb.IngestResponse, error)
- func (s *Service) OpenFD(_ context.Context, req *gluttonpb.OpenFDRequest) (*gluttonpb.OpenFDResponse, error)
- func (s *Service) Ping(ctx context.Context, req *gluttonpb.PingRequest) (*gluttonpb.PingResponse, error)
- func (s *Service) ReadDisk(ctx context.Context, req *gluttonpb.ReadDiskRequest) (*gluttonpb.ReadDiskResponse, error)
- func (s *Service) ReadRAM(ctx context.Context, req *gluttonpb.ReadRAMRequest) (*gluttonpb.ReadRAMResponse, error)
- func (s *Service) UseCPU(_ context.Context, req *gluttonpb.UseCPURequest) (*gluttonpb.UseCPUResponse, error)
- func (s *Service) WriteDisk(ctx context.Context, req *gluttonpb.WriteDiskRequest) (*gluttonpb.WriteDiskResponse, error)
- func (s *Service) WriteRAM(ctx context.Context, req *gluttonpb.WriteRAMRequest) (*gluttonpb.WriteRAMResponse, error)
Constants ¶
const ( ModeGRPC = "grpc" ModeHTTP = "http" )
Wire modes the main listener can serve, selected by the binary's --mode flag.
const ( ReadyzRoute = "/readyz" PingRoute = "/ping" WriteDiskRoute = "/writedisk" ReadDiskRoute = "/readdisk" WriteRAMRoute = "/writeram" ReadRAMRoute = "/readram" BurnCPURoute = "/burncpu" IngestRoute = "/ingest" UseCPURoute = "/usecpu" )
Routes the HTTP-mode mux serves. ReadyzRoute is served in both modes: ateom blocks RestoreWorkload until it answers 200, so ResumeActor cannot report success before the listener is reachable. The fake in ./fake aliases these, which is what keeps the stand-in and the real mux from drifting apart.
const Name = "glutton"
Name is the workload's identity to the telemetry SDK: the tracer and meter scope, and the service name the binary reports. Instrument names are written out in full at each call site so they match docs/metrics/registry/metrics.yaml literally.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Service ¶
type Service struct {
gluttonpb.UnimplementedGluttonServer
// contains filtered or unexported fields
}
func New ¶
New constructs a Service storing WriteDisk files under dir and registers its otel instruments. The caller is responsible for creating dir and for calling Close to stop any running gossip goroutines.
func (*Service) BurnCPU ¶ added in v0.4.0
func (s *Service) BurnCPU(ctx context.Context, req *gluttonpb.BurnCPURequest) (*gluttonpb.BurnCPUResponse, error)
BurnCPU spins the requested number of goroutines in a sha256 loop until the wall-clock duration elapses. The iteration count in the response keeps the work observable. Deliberately unsynchronized with s.mu: burning must not block the other RPCs.
func (*Service) Close ¶
func (s *Service) Close()
Close cancels every running gossip goroutine and waits for them to exit, then tears down any running CPU load pool.
func (*Service) Gossip ¶
func (s *Service) Gossip(_ context.Context, req *gluttonpb.GossipRequest) (*gluttonpb.GossipResponse, error)
Sends network traffic to a peer glutton. Messages will be sent on regular intervals separated by delay_ms.
func (*Service) Ingest ¶ added in v0.4.0
func (s *Service) Ingest(ctx context.Context, req *gluttonpb.IngestRequest) (*gluttonpb.IngestResponse, error)
Ingest writes the caller-supplied payload to a file under the data dir. The payload crossed the network to get here, which is the point: WriteDisk generates its bytes locally, Ingest models a download arriving through the actor's ingress path before it hits disk.
func (*Service) OpenFD ¶
func (s *Service) OpenFD(_ context.Context, req *gluttonpb.OpenFDRequest) (*gluttonpb.OpenFDResponse, error)
Make sure it has the specified number of file descriptors open. It will open or close file descriptors to hit the desired count (note this count is in addition to the other FDs needed to run the process).
func (*Service) Ping ¶
func (s *Service) Ping(ctx context.Context, req *gluttonpb.PingRequest) (*gluttonpb.PingResponse, error)
Receive a ping request, echoing the same response back.
func (*Service) ReadDisk ¶
func (s *Service) ReadDisk(ctx context.Context, req *gluttonpb.ReadDiskRequest) (*gluttonpb.ReadDiskResponse, error)
func (*Service) ReadRAM ¶
func (s *Service) ReadRAM(ctx context.Context, req *gluttonpb.ReadRAMRequest) (*gluttonpb.ReadRAMResponse, error)
Walk RAM previously written by WriteRAM, reading one byte per page so every touched page must be resident before the response returns. After a demand-paged restore this converts restore-time laziness into measurable read latency.
func (*Service) UseCPU ¶ added in v0.4.0
func (s *Service) UseCPU(_ context.Context, req *gluttonpb.UseCPURequest) (*gluttonpb.UseCPUResponse, error)
UseCPU replaces the currently-running CPU load pool. A num_cores of 0 stops all CPU load. See UseCPURequest for how (num_cores, duty_cycle, cycle_length_ms, cap_at_gomaxprocs) shape the load.
func (*Service) WriteDisk ¶
func (s *Service) WriteDisk(ctx context.Context, req *gluttonpb.WriteDiskRequest) (*gluttonpb.WriteDiskResponse, error)
Write to disk using the specified mode. Data written will be random bytes.
func (*Service) WriteRAM ¶
func (s *Service) WriteRAM(ctx context.Context, req *gluttonpb.WriteRAMRequest) (*gluttonpb.WriteRAMResponse, error)
Write to RAM, either overwriting previously-used RAM or allocating additional RAM per request instructions. Data written will be random bytes.