multiloop 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. {multiloop-0.1.1 → multiloop-0.1.2}/AGENTS.md +37 -12
  2. {multiloop-0.1.1 → multiloop-0.1.2}/CHANGELOG.md +21 -0
  3. {multiloop-0.1.1 → multiloop-0.1.2}/CITATION.cff +2 -2
  4. {multiloop-0.1.1 → multiloop-0.1.2}/Cargo.lock +4 -183
  5. {multiloop-0.1.1 → multiloop-0.1.2}/Cargo.toml +1 -5
  6. {multiloop-0.1.1 → multiloop-0.1.2}/PKG-INFO +17 -11
  7. {multiloop-0.1.1 → multiloop-0.1.2}/README.md +16 -10
  8. {multiloop-0.1.1 → multiloop-0.1.2}/README_ZH.md +15 -9
  9. {multiloop-0.1.1 → multiloop-0.1.2}/benchmarks/bench_asgi_throughput.py +15 -0
  10. multiloop-0.1.2/benchmarks/bench_wrk_asgi.py +343 -0
  11. {multiloop-0.1.1 → multiloop-0.1.2}/docs/API.md +3 -4
  12. {multiloop-0.1.1 → multiloop-0.1.2}/docs/API_ZH.md +3 -4
  13. {multiloop-0.1.1 → multiloop-0.1.2}/docs/CONCURRENCY.md +34 -0
  14. {multiloop-0.1.1 → multiloop-0.1.2}/docs/CONCURRENCY_ZH.md +34 -0
  15. {multiloop-0.1.1 → multiloop-0.1.2}/pyproject.toml +1 -2
  16. multiloop-0.1.2/src/http.rs +1286 -0
  17. {multiloop-0.1.1 → multiloop-0.1.2}/src/lib.rs +32 -12
  18. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/__init__.py +1 -1
  19. multiloop-0.1.2/src/multiloop/_http11.py +413 -0
  20. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_lifespan.py +99 -50
  21. multiloop-0.1.2/src/multiloop/_websocket.py +484 -0
  22. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/asgi.py +5 -79
  23. multiloop-0.1.2/src/multiloop/cli.py +438 -0
  24. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/pool.py +7 -0
  25. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/primitives.py +19 -1
  26. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/server.py +51 -45
  27. multiloop-0.1.2/src/multiloop/wsgi.py +748 -0
  28. multiloop-0.1.2/src/websocket.rs +292 -0
  29. multiloop-0.1.2/tests/test_asgi_backpressure.py +71 -0
  30. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_asgi_lifespan_ws.py +348 -298
  31. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_cli.py +36 -1
  32. multiloop-0.1.2/tests/test_http_pipelining.py +70 -0
  33. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_server.py +12 -2
  34. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_wsgi.py +94 -0
  35. {multiloop-0.1.1 → multiloop-0.1.2}/uv.lock +1 -34
  36. multiloop-0.1.1/src/h2.rs +0 -359
  37. multiloop-0.1.1/src/http.rs +0 -135
  38. multiloop-0.1.1/src/multiloop/_http11.py +0 -707
  39. multiloop-0.1.1/src/multiloop/_websocket.py +0 -266
  40. multiloop-0.1.1/src/multiloop/cli.py +0 -275
  41. multiloop-0.1.1/src/multiloop/wsgi.py +0 -311
  42. multiloop-0.1.1/src/websocket.rs +0 -126
  43. {multiloop-0.1.1 → multiloop-0.1.2}/.editorconfig +0 -0
  44. {multiloop-0.1.1 → multiloop-0.1.2}/.github/FUNDING.yml +0 -0
  45. {multiloop-0.1.1 → multiloop-0.1.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  46. {multiloop-0.1.1 → multiloop-0.1.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  47. {multiloop-0.1.1 → multiloop-0.1.2}/.github/dependabot.yml +0 -0
  48. {multiloop-0.1.1 → multiloop-0.1.2}/.github/pull_request_template.md +0 -0
  49. {multiloop-0.1.1 → multiloop-0.1.2}/.github/release-drafter.yml +0 -0
  50. {multiloop-0.1.1 → multiloop-0.1.2}/.github/workflows/ci.yml +0 -0
  51. {multiloop-0.1.1 → multiloop-0.1.2}/.github/workflows/publish.yml +0 -0
  52. {multiloop-0.1.1 → multiloop-0.1.2}/.github/workflows/release-drafter.yml +0 -0
  53. {multiloop-0.1.1 → multiloop-0.1.2}/.gitignore +0 -0
  54. {multiloop-0.1.1 → multiloop-0.1.2}/.pre-commit-config.yaml +0 -0
  55. {multiloop-0.1.1 → multiloop-0.1.2}/.python-version +0 -0
  56. {multiloop-0.1.1 → multiloop-0.1.2}/CODEOWNERS +0 -0
  57. {multiloop-0.1.1 → multiloop-0.1.2}/CODE_OF_CONDUCT.md +0 -0
  58. {multiloop-0.1.1 → multiloop-0.1.2}/CONTRIBUTING.md +0 -0
  59. {multiloop-0.1.1 → multiloop-0.1.2}/LICENSE +0 -0
  60. {multiloop-0.1.1 → multiloop-0.1.2}/Makefile +0 -0
  61. {multiloop-0.1.1 → multiloop-0.1.2}/SECURITY.md +0 -0
  62. {multiloop-0.1.1 → multiloop-0.1.2}/benchmarks/bench_multithread_loops.py +0 -0
  63. {multiloop-0.1.1 → multiloop-0.1.2}/benchmarks/benchmark_pull_model.py +0 -0
  64. {multiloop-0.1.1 → multiloop-0.1.2}/build.rs +0 -0
  65. {multiloop-0.1.1 → multiloop-0.1.2}/deny.toml +0 -0
  66. {multiloop-0.1.1 → multiloop-0.1.2}/docs/CHOOSING.md +0 -0
  67. {multiloop-0.1.1 → multiloop-0.1.2}/docs/CHOOSING_ZH.md +0 -0
  68. {multiloop-0.1.1 → multiloop-0.1.2}/examples/00_pool_basics.py +0 -0
  69. {multiloop-0.1.1 → multiloop-0.1.2}/examples/01_channels_select.py +0 -0
  70. {multiloop-0.1.1 → multiloop-0.1.2}/examples/02_waitgroup_once.py +0 -0
  71. {multiloop-0.1.1 → multiloop-0.1.2}/examples/03_taskgroup_timeout.py +0 -0
  72. {multiloop-0.1.1 → multiloop-0.1.2}/examples/04_sync_primitives.py +0 -0
  73. {multiloop-0.1.1 → multiloop-0.1.2}/examples/05_asgi_websocket.py +0 -0
  74. {multiloop-0.1.1 → multiloop-0.1.2}/examples/06_wsgi_flask.py +0 -0
  75. {multiloop-0.1.1 → multiloop-0.1.2}/examples/README.md +0 -0
  76. {multiloop-0.1.1 → multiloop-0.1.2}/examples/README_ZH.md +0 -0
  77. {multiloop-0.1.1 → multiloop-0.1.2}/rust-toolchain.toml +0 -0
  78. {multiloop-0.1.1 → multiloop-0.1.2}/src/channel.rs +0 -0
  79. {multiloop-0.1.1 → multiloop-0.1.2}/src/metrics.rs +0 -0
  80. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/__init__.pyi +0 -0
  81. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_cancel.py +0 -0
  82. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_channel_base.py +0 -0
  83. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_logging.py +0 -0
  84. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_metrics.py +0 -0
  85. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_multiloop_core.pyi +0 -0
  86. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_options.py +0 -0
  87. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_rust.py +0 -0
  88. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_sync.py +0 -0
  89. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/_taskgroup.py +0 -0
  90. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/context.py +0 -0
  91. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/exceptions.py +0 -0
  92. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/py.typed +0 -0
  93. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/rwlock.py +0 -0
  94. {multiloop-0.1.1 → multiloop-0.1.2}/src/multiloop/testing/__init__.py +0 -0
  95. {multiloop-0.1.1 → multiloop-0.1.2}/src/pool.rs +0 -0
  96. {multiloop-0.1.1 → multiloop-0.1.2}/src/rwlock.rs +0 -0
  97. {multiloop-0.1.1 → multiloop-0.1.2}/src/waitgroup.rs +0 -0
  98. {multiloop-0.1.1 → multiloop-0.1.2}/tests/conftest.py +0 -0
  99. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_cancel_scope.py +0 -0
  100. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_channel.py +0 -0
  101. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_docs.py +0 -0
  102. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_free_threading.py +0 -0
  103. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_go_parity.py +0 -0
  104. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_logging.py +0 -0
  105. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_loop_factory.py +0 -0
  106. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_perf_regression.py +0 -0
  107. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_pool.py +0 -0
  108. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_regression_bugs.py +0 -0
  109. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_sync_condition_barrier.py +0 -0
  110. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_sync_lock_event.py +0 -0
  111. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_sync_primitives.py +0 -0
  112. {multiloop-0.1.1 → multiloop-0.1.2}/tests/test_taskgroup.py +0 -0
@@ -43,7 +43,7 @@ multiloop/
43
43
  │ │ ├── _sync.py # Lock, Semaphore, Event, Condition, Barrier
44
44
  │ │ ├── _taskgroup.py # TaskGroup, TaskHandle
45
45
  │ │ ├── rwlock.py # AsyncRWMutex (async read-write lock, Rust-backed)
46
- │ │ ├── asgi.py # MultiloopASGIWorker (ASGI 3.0, Lifespan, WebSockets, H2)
46
+ │ │ ├── asgi.py # MultiloopASGIWorker (ASGI 3.0, Lifespan, WebSockets)
47
47
  │ │ ├── _http11.py # Http11Protocol (Rust SIMD httparse & fused TCP write)
48
48
  │ │ ├── _websocket.py # WebSocketProtocol (Rust SIMD unmasking & RFC 6455)
49
49
  │ │ ├── _lifespan.py # ASGILifespanManager (ASGI lifespan state machine)
@@ -64,10 +64,9 @@ multiloop/
64
64
  │ ├── waitgroup.rs # RawAsyncWaitGroup & WaitGroupInner
65
65
  │ ├── rwlock.rs # RawAsyncRWMutex (64-bit atomic state machine)
66
66
  │ ├── websocket.rs # FastWebSocketParser & SIMD fast_websocket_unmask
67
- │ ├── http.rs # FastHttpParser (SIMD httparse & zero-alloc ASGI assembly)
68
- │ └── h2.rs # PyH2Bridge, serve_h2_connection (Tokio H2 Runtime)
67
+ │ └── http.rs # FastHttpParser (SIMD httparse & zero-alloc ASGI assembly)
69
68
  ├── tests/ # 27 test files (pytest + pytest-asyncio)
70
- ├── benchmarks/ # 4 benchmark scripts
69
+ ├── benchmarks/ # 5 benchmark scripts (including bench_wrk_asgi.py)
71
70
  ├── examples/ # Runnable examples (python examples/00_*.py)
72
71
  ├── docs/
73
72
  │ ├── API.md # Complete API reference
@@ -270,9 +269,9 @@ pops so no single worker greedily drains the global queue.
270
269
  | `AtomicMetrics` | `src/metrics.rs` | `std::sync::atomic` | 64-byte-padded per-worker counters (`active`, `completed`, `global_pull_count`, `park_count`, etc.) — prevents false sharing |
271
270
  | `RawAsyncWaitGroup` | `src/waitgroup.rs` | parking_lot `Mutex<WaitGroupInner>` | Go-style atomic counter + generation + waiter list with single-mutex state machine |
272
271
  | `RawAsyncRWMutex` | `src/rwlock.rs` | parking_lot `Mutex<RWMutexInner>` | 64-bit atomic state machine, writer-preference async read-write lock with cancellation cleanup |
273
- | `FastHttpParser` | `src/http.rs` | httparse | SIMD zero-copy HTTP/1.x header parser with zero-alloc ASGI PyList direct assembly & interned methods |
274
- | `FastWebSocketParser` & `fast_websocket_unmask` | `src/websocket.rs` | PyO3 | SIMD 64-bit chunked XOR frame unmasking and zero-copy RFC 6455 frame header parsing |
275
- | `PyH2Bridge` & `serve_h2_connection` | `src/h2.rs` | tokio + h2 | Tokio HTTP/2 async multiplexing runtime bridge |
272
+ | `FastHttpConnection` | `src/http.rs` | httparse + PyO3 | Stateful HTTP/1.1 & WebSocket connection state machine, RFC 9112 chunk parser, request smuggling defense & zero-alloc response serializer |
273
+ | `FastHttpParser` | `src/http.rs` | httparse | SIMD zero-copy HTTP/1.x header parser with 22 interned headers, zero-alloc path/value interning & PyBuffer zero-copy |
274
+ | `FastWebSocketParser` & `fast_websocket_unmask` | `src/websocket.rs` | PyO3 | 32-byte 4-way SIMD vectorization unmasking, Option<[u8; 4]> allocation-free mask parsing, and RFC 6455 frame header parsing |
276
275
 
277
276
  ### Python-side patterns
278
277
 
@@ -291,7 +290,7 @@ pops so no single worker greedily drains the global queue.
291
290
  while re-acquiring the lock after being notified, it automatically forwards
292
291
  the notification to the next waiter to conserve notification tokens.
293
292
 
294
- ### Nine non-obvious design decisions
293
+ ### Thirteen non-obvious design decisions
295
294
 
296
295
  These are the places where a change that looks like a simplification usually
297
296
  breaks a real correctness or performance property. **Read each before modifying
@@ -345,14 +344,40 @@ the related code.**
345
344
  severe worker starvation and degrading multi-core throughput to single-worker limits (~50k QPS).
346
345
  `server.py` restricts `SO_REUSEPORT` to Linux only; on macOS/Darwin, workers share a single
347
346
  listening socket and race concurrently on `loop.sock_accept(shared_sock)`, guaranteeing
348
- perfect 25% load distribution and ~91k+ multi-core QPS.
347
+ perfect 25% load distribution and ~96k+ multi-core QPS.
349
348
 
350
- 9. **Python 3.14t Free-Threaded memory safety via `PyBytes::new_with`** (`src/websocket.rs:80-110`):
349
+ 9. **Python 3.14t Free-Threaded memory safety via `PyBytes::new_with`** (`src/websocket.rs:80-110`, `src/http.rs`):
351
350
  Under Python 3.14t (No-GIL), modifying Python buffer objects in-place across threads
352
351
  causes data races and invalidates Python's immutability invariant. Rust SIMD extensions must
353
352
  allocate Python objects through atomic single-pass constructors like
354
- `PyBytes::new_with(py, len, |buf| ...)` to populate unmasked payload bytes without
355
- intermediate copies or in-place mutations.
353
+ `PyBytes::new_with(py, len, |buf| ...)` to populate unmasked payload bytes and serialized
354
+ HTTP responses without intermediate copies or in-place mutations.
355
+
356
+ 10. **Unified Protocol Calculator (Rust) & Pure Transport Messenger (Python)** (`src/http.rs`, `_http11.py`):
357
+ `multiloop` strictly unifies HTTP/1.1 and WebSocket processing by eliminating parsing brain-split.
358
+ Rust `FastHttpConnection` owns 100% of protocol computation: SIMD header parsing, RFC 9112 chunked
359
+ streaming decoding with trailer verification, request smuggling defense (CL-TE/TE-TE rejection),
360
+ zero-allocation response wire serialization, and WebSocket frame fusion. Python `Http11Protocol` acts
361
+ purely as an asynchronous transport messenger (~380 lines), driving socket I/O, managing `_body_queue`
362
+ backpressure with `pump_events()` residue draining, and dispatching ASGI 3.0 coroutines.
363
+
364
+ 11. **Worker EventLoop Network Disconnection Exception Filtering** (`src/multiloop/pool.py:230-240`):
365
+ During high-concurrency client disconnects or abrupt socket termination, background transport socket
366
+ buffer flushes in `_SelectorSocketTransport` trigger `BrokenPipeError`, `ConnectionResetError`, or
367
+ `ConnectionAbortedError` without an active awaiter. Custom loop exception handler intercepts and suppresses
368
+ these normal network disconnection events, preventing unretrieved Future logs while keeping unexpected
369
+ runtime bugs intact.
370
+
371
+ 12. **Multi-Thread `server.close()` Task Set Snapshot Isolation** (`src/multiloop/server.py:290-305`):
372
+ Under Python 3.14t true physical multi-core execution, multiple worker threads concurrently finish
373
+ requests and discard tasks from `self._worker_conn_tasks` while `server.close()` iterates over them.
374
+ `server.py` snapshots task collections with `list(tasks)` and `list(self._worker_conn_tasks.values())`
375
+ to prevent `RuntimeError: Set changed size during iteration`.
376
+
377
+ 13. **ASGI Lifespan State Isolation via `.copy()`** (`src/multiloop/_http11.py:170`, `src/multiloop/_websocket.py:133`):
378
+ To conform to the ASGI 3.0 specification and prevent cross-request context pollution (e.g. `request.state.user_id`
379
+ leaking between users) and multi-core dictionary write contention under Python 3.14t, `scope["state"]` is
380
+ instantiated via `self.lifespan_state.copy()`.
356
381
 
357
382
  ---
358
383
 
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.2] - 2026-08-21
9
+
10
+ ### Added & Optimized
11
+ - **wrk High-Concurrency Multi-Core Benchmark Suite (`benchmarks/bench_wrk_asgi.py`)**:
12
+ - Production-grade wrk benchmark suite for physical multi-core scaling under Python 3.14t No-GIL.
13
+ - Achieves **151,366+ QPS** (4-Worker) on `/api/plaintext` and **145,836+ QPS** on `/api/ping` with sub-millisecond latency (0.29ms avg).
14
+ - **Rust SIMD HTTP Sliced Streaming & Zero-Allocation Fast-Path (`src/http.rs`, `src/multiloop/_http11.py`)**:
15
+ - `FastHttpConnection` streaming body sliced event dispatch (`ReceivingContentLength`) eliminating cursor rewind and $O(N^2)$ header re-parsing on split TCP packets.
16
+ - $O(1)$ buffer compaction via `compact_buffer` clearing on cursor drain without memory copies.
17
+ - Fast-path for zero-body GET/HEAD requests with module-level singleton `_EMPTY_BODY_MSG`, completely eliminating `asyncio.Queue` heap allocation and event loop dispatch overhead.
18
+ - **ASGI Transport Backpressure & Pipelining Concurrency Protection (`src/multiloop/_http11.py`, `src/multiloop/_websocket.py`)**:
19
+ - Physical write backpressure flow control (`_drain_event`) in `Http11Protocol.send()` eliminating server OOM under slow clients.
20
+ - Serial HTTP Pipelining request queueing (`_pending_pipeline_events`) guaranteeing strictly ordered, non-interleaved TCP responses.
21
+ - RFC 6455 WebSocket thread-safe send frame lock synchronization (`_send_lock`), eliminating `RuntimeError: concurrent drain calls` on high-concurrency data/control frame writes.
22
+ - **WSGI True Streaming Channel & Client Disconnect Decoupling (`src/multiloop/wsgi.py`)**:
23
+ - `SyncStreamReader` backed by lock-free cross-thread `Channel(maxsize=16)`, eliminating the 10MB pre-buffering requirement and enabling true streaming request body consumption.
24
+ - Automatic channel closure and feeder cancellation upon client disconnection, preventing orphaned synchronous WSGI worker tasks from occupying the thread pool.
25
+ - **No-GIL Task Collection Thread Safety & Adaptive CLI Watcher (`src/multiloop/server.py`, `src/multiloop/cli.py`)**:
26
+ - `ConnectionPinningServer` multi-worker task collection mutex protection (`_tasks_lock`), eliminating `RuntimeError: Set changed size during iteration` during `server.close()` under Python 3.14t physical multi-core execution.
27
+ - CLI file watcher with extended ignored directories and adaptive smooth polling backoff (0.3s~0.8s), reducing idle CPU usage while maintaining fast hot-reload responsiveness.
28
+
8
29
  ## [0.1.1] - 2026-08-18
9
30
 
10
31
  ### Added & Optimized
@@ -7,5 +7,5 @@ authors:
7
7
  email: "hankaihong@outlook.com"
8
8
  repository-code: "https://github.com/hankaihong1/multiloop"
9
9
  license: "MIT"
10
- version: "0.1.1"
11
- date-released: 2026-08-18
10
+ version: "0.1.2"
11
+ date-released: 2026-08-21
@@ -2,12 +2,6 @@
2
2
  # It is not intended for manual editing.
3
3
  version = 4
4
4
 
5
- [[package]]
6
- name = "atomic-waker"
7
- version = "1.1.2"
8
- source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
10
-
11
5
  [[package]]
12
6
  name = "bitflags"
13
7
  version = "2.13.1"
@@ -20,24 +14,12 @@ version = "3.20.3"
20
14
  source = "registry+https://github.com/rust-lang/crates.io-index"
21
15
  checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
22
16
 
23
- [[package]]
24
- name = "bytes"
25
- version = "1.12.1"
26
- source = "registry+https://github.com/rust-lang/crates.io-index"
27
- checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
28
-
29
17
  [[package]]
30
18
  name = "cfg-if"
31
19
  version = "1.0.4"
32
20
  source = "registry+https://github.com/rust-lang/crates.io-index"
33
21
  checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
34
22
 
35
- [[package]]
36
- name = "equivalent"
37
- version = "1.0.2"
38
- source = "registry+https://github.com/rust-lang/crates.io-index"
39
- checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
40
-
41
23
  [[package]]
42
24
  name = "flume"
43
25
  version = "0.11.1"
@@ -50,12 +32,6 @@ dependencies = [
50
32
  "spin",
51
33
  ]
52
34
 
53
- [[package]]
54
- name = "fnv"
55
- version = "1.0.7"
56
- source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
58
-
59
35
  [[package]]
60
36
  name = "futures-core"
61
37
  version = "0.3.33"
@@ -99,69 +75,18 @@ dependencies = [
99
75
  "wasm-bindgen",
100
76
  ]
101
77
 
102
- [[package]]
103
- name = "h2"
104
- version = "0.4.16"
105
- source = "registry+https://github.com/rust-lang/crates.io-index"
106
- checksum = "a9f37a958b41b3b19ee2707c06439c0e9e547e847223eb791ecb0cb821c65e27"
107
- dependencies = [
108
- "atomic-waker",
109
- "bytes",
110
- "fnv",
111
- "futures-core",
112
- "futures-sink",
113
- "http",
114
- "indexmap",
115
- "slab",
116
- "tokio",
117
- "tokio-util",
118
- "tracing",
119
- ]
120
-
121
- [[package]]
122
- name = "hashbrown"
123
- version = "0.17.1"
124
- source = "registry+https://github.com/rust-lang/crates.io-index"
125
- checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
126
-
127
78
  [[package]]
128
79
  name = "heck"
129
80
  version = "0.5.0"
130
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
131
82
  checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
132
83
 
133
- [[package]]
134
- name = "http"
135
- version = "1.5.0"
136
- source = "registry+https://github.com/rust-lang/crates.io-index"
137
- checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
138
- dependencies = [
139
- "bytes",
140
- "itoa",
141
- ]
142
-
143
84
  [[package]]
144
85
  name = "httparse"
145
86
  version = "1.10.1"
146
87
  source = "registry+https://github.com/rust-lang/crates.io-index"
147
88
  checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
148
89
 
149
- [[package]]
150
- name = "indexmap"
151
- version = "2.14.0"
152
- source = "registry+https://github.com/rust-lang/crates.io-index"
153
- checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
154
- dependencies = [
155
- "equivalent",
156
- "hashbrown",
157
- ]
158
-
159
- [[package]]
160
- name = "itoa"
161
- version = "1.0.18"
162
- source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
164
-
165
90
  [[package]]
166
91
  name = "js-sys"
167
92
  version = "0.3.103"
@@ -188,30 +113,15 @@ dependencies = [
188
113
  "scopeguard",
189
114
  ]
190
115
 
191
- [[package]]
192
- name = "mio"
193
- version = "1.2.2"
194
- source = "registry+https://github.com/rust-lang/crates.io-index"
195
- checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
196
- dependencies = [
197
- "libc",
198
- "wasi",
199
- "windows-sys",
200
- ]
201
-
202
116
  [[package]]
203
117
  name = "multiloop-core"
204
- version = "0.1.1"
118
+ version = "0.1.2"
205
119
  dependencies = [
206
- "bytes",
207
120
  "flume",
208
- "h2",
209
- "http",
210
121
  "httparse",
211
122
  "parking_lot",
212
123
  "pyo3",
213
124
  "pyo3-build-config",
214
- "tokio",
215
125
  ]
216
126
 
217
127
  [[package]]
@@ -315,7 +225,7 @@ dependencies = [
315
225
  "proc-macro2",
316
226
  "pyo3-macros-backend",
317
227
  "quote",
318
- "syn 2.0.119",
228
+ "syn",
319
229
  ]
320
230
 
321
231
  [[package]]
@@ -327,7 +237,7 @@ dependencies = [
327
237
  "heck",
328
238
  "proc-macro2",
329
239
  "quote",
330
- "syn 2.0.119",
240
+ "syn",
331
241
  ]
332
242
 
333
243
  [[package]]
@@ -372,16 +282,6 @@ version = "1.15.2"
372
282
  source = "registry+https://github.com/rust-lang/crates.io-index"
373
283
  checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
374
284
 
375
- [[package]]
376
- name = "socket2"
377
- version = "0.6.5"
378
- source = "registry+https://github.com/rust-lang/crates.io-index"
379
- checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
380
- dependencies = [
381
- "libc",
382
- "windows-sys",
383
- ]
384
-
385
285
  [[package]]
386
286
  name = "spin"
387
287
  version = "0.9.9"
@@ -402,82 +302,12 @@ dependencies = [
402
302
  "unicode-ident",
403
303
  ]
404
304
 
405
- [[package]]
406
- name = "syn"
407
- version = "3.0.3"
408
- source = "registry+https://github.com/rust-lang/crates.io-index"
409
- checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
410
- dependencies = [
411
- "proc-macro2",
412
- "quote",
413
- "unicode-ident",
414
- ]
415
-
416
305
  [[package]]
417
306
  name = "target-lexicon"
418
307
  version = "0.13.5"
419
308
  source = "registry+https://github.com/rust-lang/crates.io-index"
420
309
  checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
421
310
 
422
- [[package]]
423
- name = "tokio"
424
- version = "1.53.1"
425
- source = "registry+https://github.com/rust-lang/crates.io-index"
426
- checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
427
- dependencies = [
428
- "bytes",
429
- "libc",
430
- "mio",
431
- "pin-project-lite",
432
- "socket2",
433
- "tokio-macros",
434
- "windows-sys",
435
- ]
436
-
437
- [[package]]
438
- name = "tokio-macros"
439
- version = "2.7.2"
440
- source = "registry+https://github.com/rust-lang/crates.io-index"
441
- checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
442
- dependencies = [
443
- "proc-macro2",
444
- "quote",
445
- "syn 3.0.3",
446
- ]
447
-
448
- [[package]]
449
- name = "tokio-util"
450
- version = "0.7.19"
451
- source = "registry+https://github.com/rust-lang/crates.io-index"
452
- checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
453
- dependencies = [
454
- "bytes",
455
- "futures-core",
456
- "futures-sink",
457
- "libc",
458
- "pin-project-lite",
459
- "tokio",
460
- ]
461
-
462
- [[package]]
463
- name = "tracing"
464
- version = "0.1.44"
465
- source = "registry+https://github.com/rust-lang/crates.io-index"
466
- checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
467
- dependencies = [
468
- "pin-project-lite",
469
- "tracing-core",
470
- ]
471
-
472
- [[package]]
473
- name = "tracing-core"
474
- version = "0.1.36"
475
- source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
477
- dependencies = [
478
- "once_cell",
479
- ]
480
-
481
311
  [[package]]
482
312
  name = "unicode-ident"
483
313
  version = "1.0.24"
@@ -522,7 +352,7 @@ dependencies = [
522
352
  "bumpalo",
523
353
  "proc-macro2",
524
354
  "quote",
525
- "syn 2.0.119",
355
+ "syn",
526
356
  "wasm-bindgen-shared",
527
357
  ]
528
358
 
@@ -540,12 +370,3 @@ name = "windows-link"
540
370
  version = "0.2.1"
541
371
  source = "registry+https://github.com/rust-lang/crates.io-index"
542
372
  checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
543
-
544
- [[package]]
545
- name = "windows-sys"
546
- version = "0.61.2"
547
- source = "registry+https://github.com/rust-lang/crates.io-index"
548
- checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
549
- dependencies = [
550
- "windows-link",
551
- ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "multiloop-core"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -13,10 +13,6 @@ pyo3 = "0.29"
13
13
  flume = "0.11"
14
14
  parking_lot = "0.12"
15
15
  httparse = "1.10.1"
16
- h2 = "0.4.16"
17
- http = "1.5.0"
18
- bytes = "1.12.1"
19
- tokio = { version = "1.53.1", features = ["rt", "rt-multi-thread", "net", "io-util", "macros", "sync"] }
20
16
 
21
17
  [build-dependencies]
22
18
  pyo3-build-config = "0.29"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiloop
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -30,7 +30,7 @@ Project-URL: Repository, https://github.com/hankaihong1/multiloop
30
30
  [![CI](https://img.shields.io/github/actions/workflow/status/hankaihong1/multiloop/ci.yml)](https://github.com/hankaihong1/multiloop/actions/workflows/ci.yml)
31
31
  [![Python 3.14t](https://img.shields.io/badge/Python-3.14t%20Free--Threaded-blue.svg)](https://www.python.org/)
32
32
  [![Rust Core](https://img.shields.io/badge/Rust-Core%20SIMD-orange.svg)](https://www.rust-lang.org/)
33
- [![Throughput](https://img.shields.io/badge/ASGI%20Throughput-70%2C000%2B%20QPS-brightgreen.svg)](benchmarks/bench_asgi_throughput.py)
33
+ [![Throughput](https://img.shields.io/badge/ASGI%20Throughput-100%2C000%2B%20QPS-brightgreen.svg)](benchmarks/bench_wrk_asgi.py)
34
34
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
35
35
 
36
36
  > ⚡ **A high-performance multi-event-loop concurrency toolkit and Web server engine for Python 3.14t (Free-Threaded / No-GIL), powered by an ultra-fast Rust SIMD core.**
@@ -88,20 +88,26 @@ maturin develop --release
88
88
 
89
89
  ### Multi-Core Throughput (Python 3.14t)
90
90
 
91
- `multiloop` achieves linear physical multi-core scalability without GIL bottlenecks.
91
+ `multiloop` achieves true physical multi-core scalability without GIL bottlenecks.
92
92
 
93
- *3-round average benchmark metrics on Apple M1 (8 Cores, 8GB RAM, Python 3.14.6 Free-Threaded No-GIL):*
93
+ *Production-grade `wrk` load benchmark metrics on Apple M1 (8 Cores, 8GB RAM, Python 3.14.6 Free-Threaded No-GIL, release build):*
94
94
 
95
- | Workload (Benchmark Scenario) | Single loop (1-Worker) | multiloop 4-worker | multiloop 8-worker | Max Speedup |
96
- |---|---|---|---|---|
97
- | **JSON Ping API (`GET /api/ping`)** | 44,302 req/s | 72,134 req/s | 62,234 req/s | **1.63x** |
98
- | **POST Request Body (`POST /api/items`)** | 35,034 req/s | 58,915 req/s | 62,144 req/s | **1.77x** |
99
- | **CPU-bound Dispatch (40 × 2M ops)** | 2.88 s | 0.79 s | 0.60 s | **4.83x** |
100
- | **Mixed I/O + CPU (400 tasks, SHA-256)** | 134.0 req/s | 176.7 req/s | 116.6 req/s | **1.32x** |
95
+ | Workload (Benchmark Scenario) | Single loop (1-Worker) | multiloop 4-worker | multiloop 8-worker | Max Speedup | Avg Latency |
96
+ |---|---|---|---|---|---|
97
+ | **Plaintext 13B (`GET /api/plaintext`)** | 88,893 req/s | **151,366 req/s** | 150,712 req/s | **1.70x** | 0.29 ~ 0.74 ms |
98
+ | **JSON Ping API (`GET /api/ping`)** | 79,079 req/s | **142,622 req/s** | 145,836 req/s | **1.84x** | 0.31 ~ 0.64 ms |
99
+ | **CPU-bound Dispatch (40 × 2M ops)** | 2.88 s | 0.79 s | **0.60 s** | **4.83x** | — |
101
100
 
102
101
  ### Reproducing Benchmarks
103
102
 
104
- Run the built-in cross-platform pure-Python socket benchmark suite directly on your system (zero external dependencies like `ab` required):
103
+ Run the high-performance C-based `wrk` benchmark suite to measure physical multi-core throughput:
104
+
105
+ ```bash
106
+ # Measure real throughput via wrk (zero client CPU overhead)
107
+ uv run python benchmarks/bench_wrk_asgi.py --duration 5 --concurrency 100 --workers 1,4,8
108
+ ```
109
+
110
+ You can also run the built-in cross-platform pure-Python socket benchmark suite directly (zero external dependencies required):
105
111
 
106
112
  ```bash
107
113
  uv run python benchmarks/bench_asgi_throughput.py
@@ -3,7 +3,7 @@
3
3
  [![CI](https://img.shields.io/github/actions/workflow/status/hankaihong1/multiloop/ci.yml)](https://github.com/hankaihong1/multiloop/actions/workflows/ci.yml)
4
4
  [![Python 3.14t](https://img.shields.io/badge/Python-3.14t%20Free--Threaded-blue.svg)](https://www.python.org/)
5
5
  [![Rust Core](https://img.shields.io/badge/Rust-Core%20SIMD-orange.svg)](https://www.rust-lang.org/)
6
- [![Throughput](https://img.shields.io/badge/ASGI%20Throughput-70%2C000%2B%20QPS-brightgreen.svg)](benchmarks/bench_asgi_throughput.py)
6
+ [![Throughput](https://img.shields.io/badge/ASGI%20Throughput-100%2C000%2B%20QPS-brightgreen.svg)](benchmarks/bench_wrk_asgi.py)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
8
 
9
9
  > ⚡ **A high-performance multi-event-loop concurrency toolkit and Web server engine for Python 3.14t (Free-Threaded / No-GIL), powered by an ultra-fast Rust SIMD core.**
@@ -61,20 +61,26 @@ maturin develop --release
61
61
 
62
62
  ### Multi-Core Throughput (Python 3.14t)
63
63
 
64
- `multiloop` achieves linear physical multi-core scalability without GIL bottlenecks.
64
+ `multiloop` achieves true physical multi-core scalability without GIL bottlenecks.
65
65
 
66
- *3-round average benchmark metrics on Apple M1 (8 Cores, 8GB RAM, Python 3.14.6 Free-Threaded No-GIL):*
66
+ *Production-grade `wrk` load benchmark metrics on Apple M1 (8 Cores, 8GB RAM, Python 3.14.6 Free-Threaded No-GIL, release build):*
67
67
 
68
- | Workload (Benchmark Scenario) | Single loop (1-Worker) | multiloop 4-worker | multiloop 8-worker | Max Speedup |
69
- |---|---|---|---|---|
70
- | **JSON Ping API (`GET /api/ping`)** | 44,302 req/s | 72,134 req/s | 62,234 req/s | **1.63x** |
71
- | **POST Request Body (`POST /api/items`)** | 35,034 req/s | 58,915 req/s | 62,144 req/s | **1.77x** |
72
- | **CPU-bound Dispatch (40 × 2M ops)** | 2.88 s | 0.79 s | 0.60 s | **4.83x** |
73
- | **Mixed I/O + CPU (400 tasks, SHA-256)** | 134.0 req/s | 176.7 req/s | 116.6 req/s | **1.32x** |
68
+ | Workload (Benchmark Scenario) | Single loop (1-Worker) | multiloop 4-worker | multiloop 8-worker | Max Speedup | Avg Latency |
69
+ |---|---|---|---|---|---|
70
+ | **Plaintext 13B (`GET /api/plaintext`)** | 88,893 req/s | **151,366 req/s** | 150,712 req/s | **1.70x** | 0.29 ~ 0.74 ms |
71
+ | **JSON Ping API (`GET /api/ping`)** | 79,079 req/s | **142,622 req/s** | 145,836 req/s | **1.84x** | 0.31 ~ 0.64 ms |
72
+ | **CPU-bound Dispatch (40 × 2M ops)** | 2.88 s | 0.79 s | **0.60 s** | **4.83x** | — |
74
73
 
75
74
  ### Reproducing Benchmarks
76
75
 
77
- Run the built-in cross-platform pure-Python socket benchmark suite directly on your system (zero external dependencies like `ab` required):
76
+ Run the high-performance C-based `wrk` benchmark suite to measure physical multi-core throughput:
77
+
78
+ ```bash
79
+ # Measure real throughput via wrk (zero client CPU overhead)
80
+ uv run python benchmarks/bench_wrk_asgi.py --duration 5 --concurrency 100 --workers 1,4,8
81
+ ```
82
+
83
+ You can also run the built-in cross-platform pure-Python socket benchmark suite directly (zero external dependencies required):
78
84
 
79
85
  ```bash
80
86
  uv run python benchmarks/bench_asgi_throughput.py
@@ -3,7 +3,7 @@
3
3
  [![CI](https://img.shields.io/github/actions/workflow/status/hankaihong1/multiloop/ci.yml)](https://github.com/hankaihong1/multiloop/actions/workflows/ci.yml)
4
4
  [![Python 3.14t](https://img.shields.io/badge/Python-3.14t%20Free--Threaded-blue.svg)](https://www.python.org/)
5
5
  [![Rust Core](https://img.shields.io/badge/Rust-Core%20SIMD-orange.svg)](https://www.rust-lang.org/)
6
- [![Throughput](https://img.shields.io/badge/ASGI%20Throughput-70%2C000%2B%20QPS-brightgreen.svg)](benchmarks/bench_asgi_throughput.py)
6
+ [![Throughput](https://img.shields.io/badge/ASGI%20Throughput-100%2C000%2B%20QPS-brightgreen.svg)](benchmarks/bench_wrk_asgi.py)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
8
 
9
9
  > ⚡ **专为 Python 3.14t(Free-Threaded / No-GIL 无全局解释器锁)设计的高性能多事件循环并发工具包与 Web 服务器引擎,底层由超高性能 Rust SIMD 核心驱动。**
@@ -63,18 +63,24 @@ maturin develop --release
63
63
 
64
64
  `multiloop` 在无 GIL 锁环境下实现物理多核算力的线性扩展与超高网络吞吐。
65
65
 
66
- *在 Apple M1(8 核心、8GB 内存、Python 3.14.6 Free-Threaded No-GIL 纯线程环境)下进行 3 轮独立压测的平均指标:*
66
+ *在 Apple M1(8 核心、8GB 内存、Python 3.14.6 Free-Threaded No-GIL 纯线程环境,release 编译模式)下使用 `wrk` 进行生产级压测的指标:*
67
67
 
68
- | 工作负载 (Benchmark 压测场景) | 单 loop (1-Worker) | multiloop 4-worker | multiloop 8-worker | 最高加速比 |
69
- |---|---|---|---|---|
70
- | **JSON Ping 接口 (`GET /api/ping`)** | 44,302 req/s | 72,134 req/s | 62,234 req/s | **1.63x** |
71
- | **POST 请求体解析 (`POST /api/items`)** | 35,034 req/s | 58,915 req/s | 62,144 req/s | **1.77x** |
72
- | **CPU 密集任务调度 (40 × 200 万次运算)** | 2.88 s | 0.79 s | 0.60 s | **4.83x** |
73
- | **I/O + CPU 混合计算 (400 任务,SHA-256)** | 134.0 req/s | 176.7 req/s | 116.6 req/s | **1.32x** |
68
+ | 工作负载 (Benchmark 压测场景) | 单 loop (1-Worker) | multiloop 4-worker | multiloop 8-worker | 最高加速比 | 平均时延 |
69
+ |---|---|---|---|---|---|
70
+ | **Plaintext 13B (`GET /api/plaintext`)** | 88,893 req/s | **151,366 req/s** | 150,712 req/s | **1.70x** | 0.29 ~ 0.74 ms |
71
+ | **JSON Ping 接口 (`GET /api/ping`)** | 79,079 req/s | **142,622 req/s** | 145,836 req/s | **1.84x** | 0.31 ~ 0.64 ms |
72
+ | **CPU 密集任务调度 (40 × 200 万次运算)** | 2.88 s | 0.79 s | **0.60 s** | **4.83x** | — |
74
73
 
75
74
  ### 一键复现基准测试
76
75
 
77
- 在您自己的机器上运行纯 Python 跨平台基准压测套件(零外部命令依赖):
76
+ 运行基于 C 语言零开销的 `wrk` 基准压测套件测量真实物理多核吞吐:
77
+
78
+ ```bash
79
+ # 使用 wrk 压测真实多核吞吐(零客户端 CPU 占用)
80
+ uv run python benchmarks/bench_wrk_asgi.py --duration 5 --concurrency 100 --workers 1,4,8
81
+ ```
82
+
83
+ 您也可以在自己的机器上运行纯 Python 跨平台基准压测套件(零外部命令依赖):
78
84
 
79
85
  ```bash
80
86
  uv run python benchmarks/bench_asgi_throughput.py
@@ -5,6 +5,15 @@ Tests multiloop's ASGI 3.0 server engine against representative FastAPI workload
5
5
  2. CPU + Async I/O Hybrid Compute (/api/compute) - Python 3.14t No-GIL multi-core speedup
6
6
  3. POST Request Body Processing (/api/items) - Payload reading and JSON serialization
7
7
 
8
+ Optional Dependencies & Installation:
9
+ --------------------------------------
10
+ - To benchmark with real FastAPI & Pydantic, install them via:
11
+ uv pip install fastapi pydantic
12
+ or:
13
+ pip install fastapi pydantic
14
+ - If FastAPI is not installed, this benchmark automatically falls back to an
15
+ in-tree specification-compliant ASGI 3.0 router with identical route endpoints.
16
+
8
17
  Cross-Platform Pure-Python Design:
9
18
  - Built-in multi-threaded HTTP/1.1 Keep-Alive socket load generator.
10
19
  - 100% native on Windows, macOS, and Linux without any external CLI tool dependencies.
@@ -64,9 +73,15 @@ def create_benchmark_app() -> Any:
64
73
  thread_counter[t_name] += 1
65
74
  return {"received": item.model_dump(), "thread": t_name}
66
75
 
76
+ print(" App Framework: Native FastAPI (fastapi + pydantic)")
67
77
  return app
68
78
 
69
79
  except ImportError:
80
+ print(
81
+ " App Framework: Built-in ASGI 3.0 Fallback (fastapi not installed; "
82
+ "run `uv pip install fastapi pydantic` to test with native FastAPI)"
83
+ )
84
+
70
85
  # High-performance, spec-compliant ASGI 3.0 application fallback
71
86
  async def asgi_fallback_app(
72
87
  scope: dict[str, Any],