Basic Check Tool#

The LMCache Basic Check Tool is a testing and validation utility that helps you verify your LMCache installation, configuration, and functionality. It provides multiple testing modes to validate different components of the LMCache system.

Overview#

The basic check tool (lmcache.v1.basic_check) is designed to:

  • Test remote backend connectivity and functionality

  • Validate storage manager operations

  • Generate test keys for performance testing

  • Verify configuration settings

  • Provide diagnostic information for troubleshooting

Available Check Modes#

The tool supports several check modes, each targeting specific functionality:

test_remote#

Tests the remote backend functionality including:

  • Connection establishment to remote backends (fs, etc.)

  • put/get operations with data integrity validation

  • put/get/exists operations with performance reports

Usage:

python -m lmcache.v1.basic_check --mode test_remote

test_storage_manager#

Tests the storage manager operations including:

  • Configuration validation

  • batched_put/get operations with data integrity validation

  • batched_put/get/contains operations with performance reports

Usage:

python -m lmcache.v1.basic_check --mode test_storage_manager

gen (Key Generation)#

Generates test keys for performance testing and benchmarking:

  • Configurable number of keys and concurrency levels

  • Memory-efficient batch processing

  • Progress tracking and performance metrics

  • Offset support for distributed testing

Usage:

python -m lmcache.v1.basic_check --mode gen --num-keys 1000 --concurrency 16

Command Line Interface#

Basic Usage#

python -m lmcache.v1.basic_check --mode <MODE> [OPTIONS]

List Available Modes#

python -m lmcache.v1.basic_check --mode list

Command Line Options#

--mode MODE#

Required. Operation mode to run. Use list to see available modes.

--model MODEL#

Model name for testing, just a part of key of persist kv-cache. Default: /lmcache_test_model/

--num-keys NUM#

Number of keys to generate (gen mode only). Default: 100

--concurrency NUM#

Concurrency level for operations (gen mode only). Default: 16

--offset NUM#

Offset for key generation (gen mode only). Default: 0

Configuration#

The basic check tool uses your existing LMCache configuration. You can specify configuration in several ways:

Environment Variable#

export LMCACHE_CONFIG_PATH=/path/to/config.yaml
python -m lmcache.v1.basic_check --mode test_remote

Example Configuration#

Here’s an example configuration optimized for basic checks:

# Basic cache settings
chunk_size: 256
local_cpu: true
max_local_cpu_size: 1.0  # 1GB for basic checks

# Remote backend (optional)
remote_url: "file:///tmp/lmcache_basic_check"

Examples#

The examples/basic_check/ directory contains comprehensive examples: