I recently noticed a significant throughput drop when runnning Ballerina/Java programs in Docker container on Docker desktop for Mac.
Issue type - Performance issue
OS Version/build - Mac OS Mojave 10.14.6 (18G3020)
App version - Docker Desktop for Mac 188.8.131.52 (40693)
Steps to reproduce - Given in the medium article linked in this post below
All the details about the problem can be found in the following medium article, including steps to reproduce it.
I executed two simple programs, a Ballerina Program and a Java Program to test this and ran them natively on the OS and inside a Docker container and compared the throughput. The services and the JMeter client ran on the same MacBook. The throughput results are as follows.
1.Ballerina Hello service on Mac OS natively — 37862 requests/second
2. Ballerina Hello service in a Docker container on Mac OS — 4246 requests/second
3. Netty echo service on Mac OS natively — 68693 requests/second
4. Netty echo service in a Docker container on Mac OS— 6222 requests/second
As you can see there is a significant drop in throughput when executing the services inside a Docker container.
Then I ran the same tests on two Linux machines. The services ran on one while the JMeter client ran on the other. The throughput results are as follows.
1.Ballerina Hello service on Ubuntu natively — 19465 requests/seconds
2. Ballerina Hello service in a Docker container on Ubuntu— 18675 requests/seconds
3. Netty echo service on Ubuntu natively — 25254 requests/seconds
4. Netty echo service in a Docker container on Ubuntu — 23210 requests/seconds
This time the performance drop is not that significant.
I have been unable to figure out what is causing this performance degradation. Can someone please help me to understand and correct this issue?