Very slow network performance


Set-up: two Macs on the same local network; the first runs an MQTT broker (mosquitto); the second runs Docker for Mac. Two C++ programs run on the second Mac and exchange data multiple times through the MQTT broker (on the first Mac).

Native run: when I ran the two C++ programs natively, the network performance was very fast as expected. The programs were built with XCode 7.3.

Docker runs: when I ran either of the C++ programs, or both of them, in Docker, the network performance dropped to very slow. Rough measurements by my watch told me that it was at least 8 times slower, maybe more, than the native run. The Docker image is based on ubuntu:latest, and the programs were built by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609.

I tried to use the host network (–network=“host” in Docker run) but it didn’t help.

I am new to Docker and I don’t know how to improve the network performance. Are there any settings to make the network performance close to the native run? I would expect it to be slower, but not this slow.

P/S: in theory, the Docker runs could have been slow not because of the networking but because the C++ programs were generally slow in Docker. But I doubt this was the case because in my experience, the general performance of C++ code in Docker is about as fast as in the native environment.


Docker for Mac: version: mac-v1.12.0-beta20
OS X: version 10.11.4 (build: 15E65)
logs: /tmp/20160721-161700.tar.gz
[OK] docker-cli
[OK] app
[OK] moby-syslog
[OK] virtualization
[OK] menubar
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux