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) Close()
- func (s *Service) Gossip(_ context.Context, req *gluttonpb.GossipRequest) (*gluttonpb.GossipResponse, 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) 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" )
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) Close ¶
func (s *Service) Close()
Close cancels every running gossip goroutine and waits for them to exit.
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) 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) 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.