xmlrpc_extended¶
Thread-pool powered extensions for Python's built-in XML-RPC server.
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 —
XMLRPCClientcontext manager with configurable timeout - Linux scale-out —
SO_REUSEPORTmulti-process workers viaxmlrpc_extended.multiprocess - ASGI adapter —
XMLRPCASGIAppfor uvicorn/hypercorn/granian;async defhandlers + sync thread pool - Zero dependencies — pure stdlib; no pip-install surprise transitive deps
Install¶
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¶
-
Install, configure, and run your first server in minutes.
-
Deep dives into overload policies, path restriction, metrics, client helpers, scale-out, and ASGI deployment.
-
Full auto-generated documentation for every public class and function.
-
Request lifecycle, threading model, ASGI adapter, and class hierarchy as Mermaid diagrams.
-
Real numbers:
ThreadPoolXMLRPCServervsSimpleXMLRPCServerandXMLRPCASGIAppacross different workload profiles. -
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