https://github.com/cheind/zmqdockertest
https://github.com/cheind/zmqdockertest
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cheind/zmqdockertest
- Owner: cheind
- Created: 2020-12-16T14:44:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T04:05:43.000Z (about 4 years ago)
- Last Synced: 2025-03-25T16:22:09.854Z (over 1 year ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## About
This minimal working example benchmarks throughput metrics for ZMQ running bare-metal or virtualized through docker.
**tl/dr** ZMQ virtualized using WSL2 on Windows achieves higher throughput than bare Windows (2x) or virtualized using Windows containers (10x).
## Method
The example code consists of single producer/consumer node interacting via `PUSH/PULL` sockets. The producer sends *N* pre-allocated messages each of size *B*. Each message contains a large byte array `np.array` and a wallclock timestamp of the sender. The consumer awaits *N* messages and performs minimal bookkeeping for throughput computation plus sanity checks. `pickle` is used for serialization of python objects.
After the last message is consumed, the consumer
- computes the time elapsed *E* as the difference of the current consumer wallclock time and the message timestamp of the first message received and
- the sum of all bytes received *B*.
The reported throughput is then computed as `B/E`.
The example may be run directly on the host OS or virtualized in docker. When run in bare OS, two processes are spawned. When run in Docker, two separate containers are used.
## Results
|Os|Container Backend|Transport|Bytes/Sec|
|--|--|--|--|
|Ubuntu 20.4|Linux|TCP/IP|1.4GiB/Sec|
|Ubuntu 20.4|Linux|IPC|1.6GiB/Sec|
|Windows 10.1904|WSL2|ICP|1.5GiB/Sec|
|Windows 10.1904|WSL2|TCP/IP|1.5GiB/Sec|
|Windows 10.1904|Windows Container|TCP/IP|154.4MiB/sec|
|Windows 10.1904|no-container|TCP/IP|604.2MiB/sec|
## Run
### Docker
Linux and Windows (WSL2)
```
docker-compose up
```
Windows (Windows Container Backend)
```
docker-compose -f docker-compose.win.yml up
```
### Bare
```
conda create -n zmqtest python=3.8 pip
conda activate zmqtest
pip install -r requirements.txt
python -m src
```