Reputation: 2025
I have some issues with Python asyncio performance on OS X. I have Macbook pro 2015 with 16gb RAM. But can't get the same performance on OS X (El Capitan) as on Ubuntu. Even given the fact that I am running Ubuntu inside VM (vagrant, 4gb RAM) with OS X host.
OS X benchmark with wrk:
wrk -t8 -d 10s -c 300 http://127.0.0.1:9090 ⏎
Running 10s test @ http://127.0.0.1:9090
8 threads and 300 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 628.63us 1.45ms 16.32ms 89.46%
Req/Sec 696.05 834.65 5.51k 88.89%
19498 requests in 10.08s, 361.78KB read
Socket errors: connect 0, read 20482, write 0, timeout 0
Requests/sec: 1934.40
Transfer/sec: 35.89KB
Ubuntu:
wrk -t8 -d 10s -c 300 http://127.0.0.1:9090
Running 10s test @ http://127.0.0.1:9090
8 threads and 300 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 5.49ms 14.33ms 408.97ms 99.22%
Req/Sec 3.58k 1.41k 8.42k 70.91%
204333 requests in 10.06s, 3.70MB read
Socket errors: connect 0, read 3, write 977, timeout 0
Requests/sec: 20311.64
Transfer/sec: 376.88KB
Server code: https://gist.github.com/ssbb/5f6c2c043880e0e917c3254d06c52a7e
ulimit -a
on Ubuntu: https://gist.github.com/ssbb/e468b3ede5470da25699e4da4506b77c
ulimit -a
on OS X: https://gist.github.com/ssbb/f2a846975069a1d62a313790ad8d26ce
sysctl -a
on OS X: https://gist.github.com/ssbb/c78d5da7ae9e3670175f643309cf9f6b
sysctl -a
on Ubuntu: https://gist.github.com/ssbb/9a00cc3856135369b16ddc0083d2bc88
Why I have so much difference between Ubuntu/OS X. Also I tried to run this server on Arch Linux (not VM, just second OS) and have the same results as OS X.
Do Ubuntu have some "hacks" for TCP stack?
Upvotes: 1
Views: 319
Reputation: 17366
MacOSX has slower network stack implementation that linux, it's well known fact.
I don't know why Arch Linux is slower than Ubuntu on your machine. Network stack is implemented by linux kernel itself, linux distros with the same kernel version should display almost the same performance.
Upvotes: 1