This chapter introduces the architectural concepts and design principles that underpin PyRobusta.
+
This page introduces the architectural concepts and design principles that underpin PyRobusta.
Detailed information about configuration, routing, and request handling is covered in the corresponding chapters.
Table of Contents
@@ -67,8 +67,9 @@
Execution Model
and associates each connection with a StreamReader and StreamWriter pair for network I/O.
Each client connection executes as an independent asynchronous task, allowing multiple connections
to make progress concurrently. HttpServer maintains the set of active connections and accepts
-new connections until the configured maximum number of concurrent connections is reached. HttpServer
-closes idle connections after the configured timeout to reclaim resources. Because each connection is
+new connections until the configured maximum number of concurrent connections is reached. When the
+server is at capacity, new connections wait for resources to become available until a configurable
+timeout expires. If the timeout is reached, the connection is rejected. Because each connection is
processed independently, slow clients do not block unrelated connections. However, requests within
the same connection are always processed sequentially.
@@ -79,7 +80,8 @@
Memory Model
for normal request processing is reserved when a connection is accepted, rather than during request handling.
For each new connection, the server reserves a request and response stream buffer from the shared buffer pool.
When all stream buffers are reserved, new connections are blocked until a buffer pair becomes available
-(either through connection closure or timeout). HttpServer automatically closes connections that remain inactive for too long.
+(either through connection closure or timeout). Connections that remain inactive for too long will
+automatically time out, enforced by HttpConnection.
Stream buffers are preallocated during server initialization based on the configured memory limits.
Their size and number remain fixed throughout the lifetime of the server. Preallocating stream buffers reduces heap
fragmentation, improving memory stability and reducing the risk of runtime allocation failures.
@@ -121,7 +123,7 @@
Resource Usage
Together, these architectural decisions enable PyRobusta to handle HTTP requests with predictable resource usage,
incremental request processing, and deterministic behavior suitable for resource-constrained embedded systems.