Skip to content

vllm.v1.kv_offload.tiering.example.manager

ExampleSecondaryTierManager: A simple in-memory secondary tier.

This implementation provides a minimal secondary tier that stores chunks in memory (using a dictionary) with immediate completion. It serves as a reference for writing new tiers and is useful for testing the TieringOffloadingManager without requiring actual storage or network backends.

Classes:

ExampleSecondaryTierManager

Bases: SecondaryTierManager

A simple in-memory secondary tier.

This implementation: - Stores chunks in a dictionary (key -> True) - Completes transfers immediately (synchronous)

Methods:

  • __init__ –

    Initialize the example secondary tier.

  • drain_jobs –

    Synchronous tier — submit_*() returns only after the operation

  • get_finished_jobs –

    Poll for finished jobs.

  • get_num_chunks –

    Get the number of chunks currently stored in this tier.

  • lookup –

    Check whether a chunk exists in this secondary tier.

  • submit_load –

    Submit a job to load chunks from this tier to primary tier.

  • submit_store –

    Submit a job to store chunks from primary tier to this tier.

__init__(offloading_spec, primary_kv_view, tier_type, custom_param=0, backpressure_detector=None, access_mode=OffloadAccessMode.READWRITE)

Initialize the example secondary tier.

Parameters:

  • offloading_spec

    (OffloadingSpec) –

    The offloading spec this tier belongs to.

  • primary_kv_view

    (memoryview) –

    Memoryview over the primary tier's KV buffer.

  • tier_type

    (str) –

    Name identifying this tier type.

  • custom_param

    (int, default: 0 ) –

    Dummy parameter demonstrating custom args.

  • backpressure_detector

    (BackpressureDetector | None, default: None ) –

    Optional backpressure detector.

  • access_mode

    (OffloadAccessMode | str, default: READWRITE ) –

    Direction(s) in which this tier may transfer data; the tiering manager skips lookups and stores it cannot serve.

drain_jobs()

Synchronous tier — submit_*() returns only after the operation completes, so there is nothing to wait for.

get_finished_jobs()

Poll for finished jobs.

Returns:

get_num_chunks()

Get the number of chunks currently stored in this tier.

lookup(key, req_context)

Check whether a chunk exists in this secondary tier.

Parameters:

  • key

    (OffloadKey) –

    Offload key to look up.

  • req_context

    (ReqContext) –

    Per-request context.

Returns:

  • LookupResult –

    HIT if the chunk is present, MISS if not found.

submit_load(job_metadata)

Submit a job to load chunks from this tier to primary tier.

Parameters:

  • job_metadata

    (TransferJob) –

    Job metadata including job_id, keys, and spec for writing chunks into the primary tier.

submit_store(job_metadata)

Submit a job to store chunks from primary tier to this tier.

Parameters:

  • job_metadata

    (TransferJob) –

    Job metadata including job_id, keys, and spec for reading chunks from the primary tier.

ExampleTierInfo dataclass

Bases: ConfigInfo

Config facts of one ExampleSecondaryTierManager.

A field name is the label name. A secondary tier needs no name of its own for the tier, because the tier label tells the series of the tiers apart.