Implementation:LMCache LMCache SageMaker HyperPod Adapter
| Knowledge Sources | |
|---|---|
| Domains | Storage Backend, AWS Integration |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
SageMakerHyperPodConnectorAdapter creates and configures connectors for AWS SageMaker HyperPod shared memory storage.
Description
The SageMakerHyperPodConnectorAdapter class extends ConnectorAdapter to handle URLs with the sagemaker-hyperpod:// scheme. It extracts extensive configuration from extra_config with sensible defaults including bucket name, shared memory name, concurrency limits, connection pool sizes, timeouts, lease TTL, streaming chunk size, HTTPS preference, and optional maximum lease size. All numeric configuration values are validated to be positive. The adapter includes static helper methods (_parse_url, _get_positive_int, _get_positive_float) for URL normalization and configuration validation. Environment variable expansion is supported in URLs via os.path.expandvars.
Usage
Use this adapter when deploying LMCache with AWS SageMaker HyperPod shared memory infrastructure. Configure via sagemaker-hyperpod://host:port URLs with additional settings in the engine's extra_config dictionary using keys prefixed with sagemaker_hyperpod_.
Code Reference
Source Location
- Repository: LMCache
- File: lmcache/v1/storage_backend/connector/sagemaker_hyperpod_adapter.py
- Lines: 1-233
Signature
class SageMakerHyperPodConnectorAdapter(ConnectorAdapter):
def __init__(self) -> None: ...
def create_connector(self, context: ConnectorContext) -> RemoteConnector: ...
@staticmethod
def _parse_url(url: str, use_https: bool) -> str: ...
@staticmethod
def _get_positive_int(config_dict: dict, key: str, default: int) -> int: ...
@staticmethod
def _get_positive_float(config_dict: dict, key: str, default: float) -> float: ...
Import
from lmcache.v1.storage_backend.connector.sagemaker_hyperpod_adapter import (
SageMakerHyperPodConnectorAdapter,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| context | ConnectorContext | Yes | Contains the SageMaker HyperPod URL, event loop, local CPU backend, and config |
| context.url | str | Yes | URL in format sagemaker-hyperpod://host:port
|
| context.config.extra_config | dict | No | Optional configuration overrides (keys: sagemaker_hyperpod_bucket, sagemaker_hyperpod_shared_memory_name, sagemaker_hyperpod_max_concurrent_requests, sagemaker_hyperpod_max_connections, sagemaker_hyperpod_max_connections_per_host, sagemaker_hyperpod_timeout_ms, sagemaker_hyperpod_lease_ttl_s, sagemaker_hyperpod_put_stream_chunk_bytes, sagemaker_hyperpod_use_https, sagemaker_hyperpod_max_lease_size_mb)
|
Outputs
| Name | Type | Description |
|---|---|---|
| create_connector return | RemoteConnector | A configured SageMakerHyperPodConnector instance |
Usage Examples
from lmcache.v1.storage_backend.connector import CreateConnector
# Basic usage with defaults
connector = CreateConnector(
url="sagemaker-hyperpod://127.0.0.1:9200",
loop=event_loop,
local_cpu_backend=cpu_backend,
config=config,
metadata=metadata,
)
# Configuration defaults:
# - bucket: "lmcache"
# - shared_memory_name: "shared_memory"
# - max_concurrent_requests: 100
# - max_connections: 256
# - max_connections_per_host: 128
# - timeout_ms: 5000
# - lease_ttl_s: 30.0
# - put_stream_chunk_bytes: 65536
# - use_https: False