Menu

Maximum Concurrency (& Sub-Quadratic Scaling) By TokenGate
πŸ“°
0

Maximum Concurrency (& Sub-Quadratic Scaling) By TokenGate

DEV CommunityΒ·Joseph BooneΒ·about 1 month ago
#bi93KZTn
#performance#code#programming#token#tokens#fullscreen
Reading 0:00
15s threshold

What is TokenGate? TokenGate is a beta Python concurrency system built around a token-managed execution model. Instead of managing threads directly, you decorate synchronous functions and the system handles routing, admission, and worker assignment automatically. The core idea is simple: every function call becomes a token. That token moves through a lifecycle β€” created, waiting, admitted, executing, completed β€” while the coordinator manages a pool of core-pinned workers underneath. You interact with the public API, TokenGate handles everything else. As of v0.2.2.0 tokens are natively awaitable. That's what made this test possible to write cleanly: result = await token results = await asyncio . gather ( * tokens ) Enter fullscreen mode Exit fullscreen mode The decorated functions stay synchronous. The orchestrator stays async. TokenGate sits between them and keeps the pipeline full. What I did I dispatched 65,536 task tokens simultaneously and completed all of them in 30 seconds. Zero failures.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More