Controller APIs#
Warning
This page documents the behavior of LMCache’s in-process mode (deprecated). Please consider using LMCache MP mode for better feature support and performance. For the MP mode equivalent of this page, see HTTP API.
These APIs are specific to the LMCache Controller component. They provide visibility into registered instances, workers, and key statistics.
GET /controller/key-stats — Key Statistics#
Get key statistics across all instances and workers.
Method:
GETPath:
/controller/key-statsParameters: None
Response:
application/json
curl http://localhost:6999/controller/key-stats
Example Response (HTTP 200):
{
"total_key_count": 1500,
"total_instance_count": 2,
"total_worker_count": 4,
"instances": [
{
"instance_id": "instance_001",
"key_count": 800,
"worker_count": 2
},
{
"instance_id": "instance_002",
"key_count": 700,
"worker_count": 2
}
]
}
Error Response (controller not available, HTTP 503):
{
"detail": "Controller manager not available"
}
Response Schema:
Field
Type
Description
total_key_countint
Total number of KV keys across all instances
total_instance_countint
Total number of registered instances
total_worker_countint
Total number of workers across all instances
instanceslist
Per-instance breakdown (see below)
Instance Schema:
Field
Type
Description
instance_idstr
Unique identifier of the instance
key_countint
Number of KV keys held by this instance
worker_countint
Number of workers in this instance
GET /controller/workers — Worker Information#
Get worker information with flexible query parameters. Behavior depends on the combination of parameters:
No parameters: List all registered workers across all instances.
``instance_id`` only: List all workers for a specific instance.
``instance_id`` and ``worker_id``: Get detailed info about a specific worker.
Method:
GETPath:
/controller/workersParameters:
Name
Type
Description
instance_idstr
(Optional) Instance ID to filter workers
worker_idint
(Optional) Worker ID for specific worker details (requires
instance_id)Response:
application/json
# List all workers
curl http://localhost:6999/controller/workers
# List workers for a specific instance
curl "http://localhost:6999/controller/workers?instance_id=instance_001"
# Get a specific worker
curl "http://localhost:6999/controller/workers?instance_id=instance_001&worker_id=0"
Example Response (list workers):
{
"workers": [
{
"instance_id": "instance_001",
"worker_id": 0,
"ip": "10.0.0.1",
"port": 8000,
"peer_init_url": "http://10.0.0.1:8000/init",
"registration_time": 1706745600.0,
"last_heartbeat_time": 1706745660.0,
"key_count": 400
},
{
"instance_id": "instance_001",
"worker_id": 1,
"ip": "10.0.0.2",
"port": 8001,
"peer_init_url": "http://10.0.0.2:8001/init",
"registration_time": 1706745600.0,
"last_heartbeat_time": 1706745660.0,
"key_count": 400
}
],
"total_count": 2
}
Example Response (single worker):
{
"instance_id": "instance_001",
"worker_id": 0,
"ip": "10.0.0.1",
"port": 8000,
"peer_init_url": "http://10.0.0.1:8000/init",
"registration_time": 1706745600.0,
"last_heartbeat_time": 1706745660.0,
"key_count": 400
}
Error Response (worker not found, HTTP 404):
{
"detail": "Worker (instance_001, 99) not found"
}
Error Response (instance not found, HTTP 404):
{
"detail": "No workers found for instance unknown_instance"
}
Error Response (controller not available, HTTP 503):
{
"detail": "Controller manager not available"
}
Worker Response Schema:
Field
Type
Description
instance_idstr
Instance this worker belongs to
worker_idint
Worker index within the instance
ipstr
Worker IP address
portint
Worker port number
peer_init_urlstr
(Optional) Peer initialization URL
registration_timefloat
Unix timestamp of worker registration
last_heartbeat_timefloat
Unix timestamp of last heartbeat
key_countint
Number of KV keys held by this worker