<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SwiftWave Blog]]></title><description><![CDATA[SwiftWave is a self-hosted lightweight PaaS solution to deploy and manage your applications on any VPS without any hassle 👀]]></description><link>https://blog.swiftwave.org</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1698693877556/PGVF2zAUu.png</url><title>SwiftWave Blog</title><link>https://blog.swiftwave.org</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 02:07:27 GMT</lastBuildDate><atom:link href="https://blog.swiftwave.org/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Docker Swarm Overlay Network Test]]></title><description><![CDATA[Introduction
SwiftWave is a self-hosted lightweight PaaS solution to deploy and manage your applications on any VPS without any hassle 👀
For container management, SwiftWave uses Docker Swarm, and we are rearchitecting it to be able to set up SwiftWa...]]></description><link>https://blog.swiftwave.org/docker-swarm-overlay-network-test</link><guid isPermaLink="true">https://blog.swiftwave.org/docker-swarm-overlay-network-test</guid><category><![CDATA[Docker]]></category><category><![CDATA[Swarm]]></category><category><![CDATA[swiftwave]]></category><category><![CDATA[#selfhosted]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Tanmoy Sarkar]]></dc:creator><pubDate>Tue, 31 Oct 2023 08:41:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1698693295223/1db1c728-c8a3-41da-b0d1-8e92bd99aea6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p><a target="_blank" href="https://github.com/swiftwave-org/swiftwave">SwiftWave</a> is a self-hosted lightweight PaaS solution to deploy and manage your applications on any VPS without any hassle 👀</p>
<p>For container management, SwiftWave uses Docker Swarm, and we are rearchitecting it to be able to set up SwiftWave in multiple nodes.</p>
<p>We are using HaProxy, which will handle ingress traffic, and HAProxy is available only on specific nodes. So internally, there will be a lot of east-west traffic.</p>
<p>That's why we are testing and will try to fix the issues as well.</p>
<h2 id="heading-lab-setup">Lab Setup</h2>
<p>We have chosen AWS to test this.</p>
<p>We created 2 EC2 instances with 1Gb memory and 1vCPU <em>t2.micro</em>, installed Docker and set up Docker Swarm.</p>
<p>For bandwidth testing, we chose to use <a target="_blank" href="https://iperf.fr/">iperf3</a>.</p>
<p>To test Bandwith, you need to start the iperf3 server on one host by</p>
<pre><code class="lang-bash">iperf3 -s
</code></pre>
<p>On the client side, we need to run</p>
<pre><code class="lang-bash">iperf3 -c &lt;ip_of_iperf3_server&gt;
</code></pre>
<p>That's all. This will show us the maximum network bandwidth available.</p>
<h2 id="heading-bandwidth-test-between-hosts">Bandwidth Test between Hosts</h2>
<p>Before proceeding with the bandwidth test between containers, we test the bandwidth test between hosts.</p>
<p><img src="https://lh7-us.googleusercontent.com/NpFkB6iU0_g4py3RCYQFNpXvqaaREk_jd2Ckgp6WjD6u1sJU5SvYvE7srHtoMX81c030v8EeYA0mda5Unn8foSE9A5GKCP4deLx5VOGZOAmw4wqEQRYHce4X2GK-rk08giCBv69cCZyUqLeKxltLR-M" alt /></p>
<p>As you can see, we are getting around <mark>~ 1 Gb/sec</mark> speed on upload and download.</p>
<p>As per AWS documentation as well, t2.micro instances also have network bandwidth of around ~ 1 Gbps</p>
<p>So, we are getting total bandwidth.</p>
<h2 id="heading-bandwidth-test-between-containers">Bandwidth Test between Containers</h2>
<p>Now, we will test bandwidth test between two containers (each container must be on a separate host) on the overlay network in the docker swarm.</p>
<ol>
<li><p>Let's create an attachable overlay network first.</p>
<p> On the swarm manager node run,</p>
<pre><code class="lang-bash"> sudo docker network create --driver overlay --attachable swarm_test_network
</code></pre>
</li>
<li><p>Now run the iperf3 server in a container on the hosts and connect to the overlay network. Using <a target="_blank" href="https://hub.docker.com/r/networkstatic/iperf3">networkstatic/iperf3</a> docker image for this.</p>
<pre><code class="lang-bash"> sudo docker service create --network swarm_test_network --mode global networkstatic/iperf3 -s
</code></pre>
</li>
<li><p>Get the IP of the container running the iperf3 server of any hosts.<br /> - First, list down the running containers by <code>sudo docker ps</code></p>
<p> - Then inspect the container for the IP address</p>
<p> <img src="https://lh7-us.googleusercontent.com/9DNw-MO0LzyA4ajpU9rep3hGbG-LjeqpObo5hWLSXy-hnwyLaOFzS9hAjIrFFeZX17CiO5ZemsiMIHs3csR9eGvM6fXXazqGUPF7nuglDMtBYxyYa3-2oE2Eg92WS6XnaNqEgFjIjJ9vKv0KL8a4Dhs" alt /></p>
<p> We go the IP address <code>10.0.1.41</code></p>
</li>
<li><p>Now, let's move to the second host and go inside a container to run the test.</p>
</li>
<li><p>Here is the test result</p>
<p> <img src="https://lh7-us.googleusercontent.com/JTfPmGyfXQEdhnV7tCoDODopbwGDj8jlejWq5u0KjZYd1_ST-9BaG67tvrurnhJ880FSyAjc4G6ZHSp-X1nXbsnLDHSwcE3dsosj-z78l4S3JXpbVLmjCIsq6BIVcSgO-YZm3NtgOwsBfcqhJOdPfrE" alt /></p>
</li>
</ol>
<p>We can observe that the maximum bandwidth is ~340 Mbps, almost 1/3 of the actual bandwidth 🥲.</p>
<h2 id="heading-troubleshoot-slow-network-bandwidth">Troubleshoot Slow Network Bandwidth</h2>
<p>First of all, we thought it might be the limitation of the overlay network as it's a Layer 2 network. But overlay (virtual network) network built on top of tun, tap interfaces, and iptable. So we can achieve total bandwidth on overlay as well.</p>
<p>In the end, we found the issue 😅.</p>
<p>After inspecting the main <code>eth0</code> interface (network interface to AWS internal network on the specific subnet) and docker-created network interfaces, we found the issue.</p>
<p><code>eth0</code> <strong>interface details</strong></p>
<p><img src="https://lh7-us.googleusercontent.com/lLAg-wcFgiUpDWMjhpv7Pc0JUVOtNDf4CVStMDPe6jhjJ0o9qDqjhud1mxTbcPRfGXnESAe_irYvJErNNqT7wiaTImSGIt4tmblY2hD0Wc-L2wmsRgagwU41_TqKEsasNRynEP6xn3NrAwJOjRkq9VE" alt /></p>
<p><strong>Any docker interface details</strong></p>
<p><img src="https://lh7-us.googleusercontent.com/oDPD1O5C7NZeONgMRr4UrUxWK1s7LM6YFJ0XnzuIIrILqizKJid5i4Obcqn6gfXwjerZhPXhG-R14BzJcrq9gCvTJcmrAPsMQbIqV1R9sT_yxH5ME7h6_wUcN_0OV5QuzR8KyIjwNVBsgOn_kjGVPIk" alt /></p>
<p><code>eth0</code> interface has <mark>9001 MTU,</mark> but the <code>docker0</code> interface has only <mark>1500 MTU</mark>, which is too low; 1/6 of <code>eth0</code> interface.</p>
<p><strong>Solution</strong></p>
<p>Let's update the MTU of our overlay network.</p>
<p>We deleted the old <code>swarm_test_network</code> and create a new network</p>
<pre><code class="lang-bash">docker network create --driver overlay \
  --attachable \
  --opt com.docker.network.driver.mtu=9001 \
  swarm_test_network
</code></pre>
<p>After this, we follow the same steps [discussed above] to start containers and run the test.</p>
<p><strong>Result -</strong></p>
<p><img src="https://lh7-us.googleusercontent.com/0Aup1aGoWb0XJWzAu6nGjeDsP6f0pZqGRD56VkX0z6o1mPIi-IPYxmUtUx2t6LiLl13i_3G5ARpY_xvmuFn6bth20H073OTVQbGh7qnMAa9F8Nl2fmUhsOwUVovlHfNkuVetBmCrtskRyaFO41xBZIw" alt /></p>
<p>Now, we are getting total bandwidth on the overlay network 🔥🔥.</p>
<h2 id="heading-final-test">Final Test</h2>
<p>We have already found the solution (set max MTU at docker interfaces). We want to test this with a high network bandwidth.</p>
<p>This time, we create two EC2 instances with 1 Gb memory 1 vCPU, and maximum 5Gbps of network bandwidth. [t3.micro instance]</p>
<p>This is the test result.</p>
<p><img src="https://lh7-us.googleusercontent.com/pS_5hGqVu3nTVhjIDBemRloWJ1Ng37-0h64OWwlAs890ojDAK9H1mHlBiUySvOYwGcun_xcxkjLv_39mf9vT2jAdM8Y3ZgMyyAEWiLyyrwtAlqSPZFZqg9iqvni17KJ2C2YFMwIIYF1Mmqc1yraWbUI" alt /></p>
<p>In the case of the host-to-host bandwidth test, it was 4.5 Gbits / sec. So, between the containers over the swarm network, the bandwidth of 4.35 Gbits / sec is a good number.</p>
<p>🥳🥳 We are getting almost the total bandwidth.</p>
<hr />
<p>If you have read the blog till the end, subscribe to the newsletter for more updates.</p>
<p>Make sure to star project <a target="_blank" href="https://github.com/swiftwave-org/swiftwave">SwiftWave</a> (<a target="_blank" href="https://github.com/swiftwave-org/swiftwave">https://github.com/swiftwave-org/swiftwave</a>) on GitHub to keep it growing.</p>
<hr />
]]></content:encoded></item></channel></rss>