Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:LMCache LMCache PDBackend Close

From Leeroopedia


Knowledge Sources
Domains Infrastructure, Resource_Management
Last Updated 2026-02-09 00:00 GMT

Overview

Concrete tool for closing the PD backend and releasing NIXL transfer channels and ZMQ resources, provided by the PDBackend class.

Description

The PDBackend.close method sets the running flag to False, joins all background threads (allocation listener, heartbeat), closes the NIXL transfer channel, and terminates the ZMQ context.

Usage

Called during engine shutdown via LMCacheEngineBuilder.destroy() or when the vLLM process terminates.

Code Reference

Source Location

  • Repository: LMCache
  • File: lmcache/v1/storage_backend/pd_backend.py
  • Lines: L596-L604

Signature

def close(self) -> None:
    """Close the storage backend."""
    self.running = False
    for thread in self.running_threads:
        thread.join()
    self.transfer_channel.close()
    self.zmq_context.term()

Import

from lmcache.v1.storage_backend.pd_backend import PDBackend

I/O Contract

Inputs

Name Type Required Description
(none) Called on self, no parameters

Outputs

Name Type Description
(none) None All threads joined, NIXL channel closed, ZMQ context terminated

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment