How netflix/rend works
Rend is a Memcached-compatible server and cache proxy. A client connects to the listener; text or binary requests are parsed, coordinated in L1-only or L1/L2 mode, dispatched to a selected storage handler, and answered using the corresponding protocol. Storage options include in-memory, ordinary Memcached, batched, and fixed-chunk Memcached handlers. The repository also includes load and correctness clients, plus shared metrics and timing support. The main workflow and documented capabilities are represented; some handler internals and wiring are unsampled, so uncertain links are omitted.
Main entry points: memproxy.go Server configuration · handler.go Memcached handler · listen.go Connection listener · main.go Load and correctness clients
Components 22
Server runtime
- Server configuration
memproxy.go - Connection listener
server/listen.go - Default server
server/default.go
Protocol handling
- Text parser
protocol/textprot/parser.go - Binary parser
protocol/binprot/parser.go - Text responses
protocol/textprot/respond.go - Binary responses
protocol/binprot/respond.go
Request orchestration
- L1-only logic
orcas/l1only.go - L1/L2 logic
orcas/l1l2.go - Batch L1/L2 logic
orcas/l1l2batch.go
Storage handlers
- In-memory handler
handlers/inmem/inmem.go - Memcached handler
handlers/memcached/std/handler.go - Batched handler
handlers/memcached/batched/handler.go - Batch connections
handlers/memcached/batched/conn.go - Chunked handler
handlers/memcached/chunked/handler.go
Client tools
- Load and correctness clients
client/cmd/blast/main.go - Binary client protocol
client/binprot/prot.go - Text client protocol
client/textprot/prot.go
Shared instrumentation
- Metrics library
metrics/endpoint.go - Timing utility
timer/timer.go
Other components
- Memcached client
- Memcached backend
Connections 32
- Memcached client → Connection listener: connects to
- Server configuration → Connection listener: configures
memproxy.go - Server configuration → L1-only logic: selects
memproxy.go - Server configuration → L1/L2 logic: selects
memproxy.go - Server configuration → Memcached handler: selects
memproxy.go - Server configuration → Batched handler: selects
memproxy.go - Server configuration → Chunked handler: selects
memproxy.go - Server configuration → In-memory handler: selects
memproxy.go - Connection listener → Default server: uses
server/listen.go - Connection listener → Text parser: routes requests
- Connection listener → Binary parser: routes requests
- Default server → L1-only logic: dispatches
server/default.go - Default server → L1/L2 logic: dispatches
server/default.go - Text parser → Text responses: formats replies
- Binary parser → Binary responses: formats replies
- L1-only logic → In-memory handler: dispatches
orcas/l1only.go - L1-only logic → Memcached handler: dispatches
- L1/L2 logic → Memcached handler: dispatches
- Batch L1/L2 logic → Memcached handler: dispatches
- Batch L1/L2 logic → Batched handler: dispatches
- Batched handler → Batch connections: uses
handlers/memcached/batched/handler.go - Memcached handler → Memcached backend: sends commands
handlers/memcached/std/handler.go - Batch connections → Memcached backend: sends batches
handlers/memcached/batched/conn.go - Chunked handler → Memcached backend: stores chunks
handlers/memcached/chunked/handler.go - Load and correctness clients → Binary client protocol: uses
client/cmd/blast/main.go - Load and correctness clients → Text client protocol: uses
client/cmd/blast/main.go - Load and correctness clients → Memcached client: sends requests
- Load and correctness clients → Timing utility: measures duration
client/cmd/blast/main.go - L1/L2 logic → Metrics library: records
orcas/l1l2.go - Memcached handler → Metrics library: records
handlers/memcached/std/handler.go - Binary parser → Metrics library: records
protocol/binprot/parser.go - Text parser → Timing utility: timestamps requests
protocol/textprot/parser.go