Skip to content

xmlrpc_extended

Thread-pool powered extensions for Python's built-in XML-RPC server.

CI Docs License: MIT Python 3.10+ Ruff


xmlrpc_extended upgrades Python's stdlib SimpleXMLRPCServer with:

  • Bounded thread pool — serve requests concurrently instead of one-at-a-time
  • Overload protection — block, drop, fault, or return HTTP 503 when saturated
  • Real-time metrics — server.stats() gives a point-in-time counters snapshot
  • Path restriction — accept XML-RPC only on specific URL paths
  • Client helpers — XMLRPCClient context manager with configurable timeout
  • Linux scale-out — SO_REUSEPORT multi-process workers via xmlrpc_extended.multiprocess
  • ASGI adapter — XMLRPCASGIApp for uvicorn/hypercorn/granian; async def handlers + sync thread pool
  • Zero dependencies — pure stdlib; no pip-install surprise transitive deps

Install

pip install xmlrpc-extended

Requires Python 3.10+.


30-second quickstart

from xmlrpc_extended import ServerOverloadPolicy, ThreadPoolXMLRPCServer


def add(left: int, right: int) -> int:
    return left + right


with ThreadPoolXMLRPCServer(
    ("127.0.0.1", 8000),
    max_workers=8,       # 8 concurrent requests
    max_pending=16,      # 16 more may queue
    overload_policy=ServerOverloadPolicy.HTTP_503,
    logRequests=False,
) as server:
    server.register_function(add, "add")
    server.serve_forever()

Callers use the standard xmlrpc.client or the bundled XMLRPCClient helper:

from xmlrpc_extended.client import XMLRPCClient

with XMLRPCClient("http://127.0.0.1:8000/", timeout=5.0) as proxy:
    print(proxy.add(1, 2))  # → 3

Quick navigation

  • Getting Started

    Install, configure, and run your first server in minutes.

  • User Guide

    Deep dives into overload policies, path restriction, metrics, client helpers, scale-out, and ASGI deployment.

  • API Reference

    Full auto-generated documentation for every public class and function.

  • Architecture

    Request lifecycle, threading model, ASGI adapter, and class hierarchy as Mermaid diagrams.

  • Benchmarks

    Real numbers: ThreadPoolXMLRPCServer vs SimpleXMLRPCServer and XMLRPCASGIApp across different workload profiles.

  • Security

    Supported versions, vulnerability reporting, and the safe-usage guide.


Why not just use ThreadingMixIn?

Python's stdlib ships ThreadingMixIn which spawns an unbounded thread per request. Under load this creates thousands of threads and exhausts file descriptors. ThreadPoolXMLRPCServer uses a ThreadPoolExecutor (bounded workers) and an explicit semaphore to limit the total outstanding requests — giving you predictable memory footprint and explicit overload behaviour.


Community

Questions, ideas, and discussion → GitHub Discussions

Bugs and feature requests → GitHub Issues