Python Event Queues, Thread Contention, and the GIL in Trading Systems
Summary
This forum exchange asks whether routing events through one queue in a Python event engine can cause congestion, blocking, or reduced efficiency, and whether multiple queues or engines would help. A respondent argues that adding threads may reduce speed in a Python process because of the Global Interpreter Lock. The discussion also raises whether a trading system's disk activity is substantial or whether intraday data handling is primarily memory-based.
The exchange offers a brief systems-design consideration: more threads do not automatically improve throughput for Python workloads, especially when execution is constrained by the GIL. However, it does not examine queue implementation, event rates, locking behavior, or workload profiles, and it leaves the disk-versus-memory question unanswered. It provides no benchmarks or measurements, so the response should be treated as a general observation rather than a diagnosis of a particular trading system.
Key ideas
- The question concerns whether one event queue can become a throughput bottleneck in a Python trading engine.
- A participant cautions that adding threads can slow a Python process because of the Global Interpreter Lock.
- The discussion raises data-storage and disk-I/O behavior but does not resolve it.
- No system details, measurements, or benchmarks are supplied to confirm queue performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.