{"id":1115,"date":"2021-07-08T20:24:05","date_gmt":"2021-07-09T03:24:05","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=1115"},"modified":"2023-08-11T18:21:00","modified_gmt":"2023-08-12T01:21:00","slug":"linux-bridge-vs-openvswitch-how-to-improve-virtualization-network-performance","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/linux-bridge-vs-openvswitch-how-to-improve-virtualization-network-performance\/","title":{"rendered":"Linux Bridge vs OpenVSwitch &#8212; How to Improve Virtualization Network Performance"},"content":{"rendered":"\r\n<p><em>How to fix packet loss and latency in high bandwidth VPS servers by upgrading to OpenVSwitch<\/em><\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2021\/07\/network1-1024x682.jpeg\" alt=\"interconnected light beams in a city\" class=\"wp-image-1130\" title=\"\" srcset=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2021\/07\/network1-1024x682.jpeg 1024w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2021\/07\/network1-300x200.jpeg 300w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2021\/07\/network1-200x133.jpeg 200w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2021\/07\/network1-1536x1024.jpeg 1536w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2021\/07\/network1-2048x1365.jpeg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Virtualization is one of the most pervasive and transformational technologies in the hosting world to have come along in the last decade. Despite this, maintaining the efficient operation of virtual machines is not always easy. In this article, we\u2019ll go into one of the most common causes of performance problems we see on virtual machines our customers are running, detailing the symptoms, troubleshooting process, and one very effective solution.<\/p>\r\n\r\n\r\n\r\n<p>One of the most challenging questions we get asked from customers running a Virtual Machine Host Node is \u2018Why is the network running badly on this new VM?\u2019 Generally this starts a search of all network infrastructure to ensure proper operation of all aspects of the network, from the host node OS interface itself to the routers handling the traffic. More often than not, this exhaustive search turns up no obvious problems. At all points there are no troubles and all links are operating at full speed. Meanwhile the VM is experiencing high latency, packet loss, and lower than normal speed throughput when it should not be.<\/p>\r\n\r\n\r\n\r\n<p>At this point, what is the problem? You can continue scouring for ghosts on the network or you can take a moment to consider one common component involved in every node running a hypervisor: the Linux bridge.<\/p>\r\n\r\n\r\n\r\n<p>The Linux bridge is a neat piece of software that acts as a virtual ethernet switch. This \u201cbridges\u201d the virtual network interfaces for each Virtual Machine and the physical network interface card. Due to this, it performs the management of all traffic from virtual machines, and without it they would not have access to the network at all. Thankfully, this software is installed automatically due to being part of the Linux kernel. It is also simple to configure, and once it is active, you simply tell your VMs to use that as their network interface and the job is done.<\/p>\r\n\r\n\r\n\r\n<p>However, this simplicity does come with some drawbacks. Most notably, as one of the older solutions to this network problem, it does not incorporate the currently known best practices for ensuring high performance software bridging.\u00a0<\/p>\r\n\r\n\r\n\r\n<p>There are some situations where the Linux bridge interface can become overwhelmed which can cause some of the symptoms we mentioned earlier:<\/p>\r\n\r\n\r\n\r\n<p>Does your setup require > 10gbps networking or have a proportionately high number of VMs compared to most? How about your node being part of a single very large network with lots of mac or IP addresses? These types of situations that generate high packet counts, large amounts of broadcast traffic, or otherwise higher bandwidth requirements can cause the bridge to function at a subpar level or just outright crash.<\/p>\r\n\r\n\r\n\r\n<p>So what is a good solution to this problem?\u00a0<\/p>\r\n\r\n\r\n\r\n<p>This is where we can look at a 3rd party utility to provide a better performing bridge platform that can not only perform better under a higher load, but can also offer additional options for more complicated networking. One of the most popular high performance linux bridge alternatives is OpenVSwitch.<\/p>\r\n\r\n\r\n\r\n<p>OpenVSwitch provides an alternative to the standard built-in Linux bridge and can be used with many different operating systems and virtualization platforms. In our experience with Proxmox, using OpenVswitch instead of Linux bridge noticeably increased performance of our VMs while also enhancing stability.<\/p>\r\n\r\n\r\n\r\n<p>If you want to give this a try, you will need to install and configure it. We\u2019ll talk about how to get OpenVSwitch installed with Proxmox.<\/p>\r\n\r\n\r\n\r\n<p>While OpenVSwitch is more difficult to set up than Linux bridge, it is actually still pretty easy.. FIrst all you need to do is install it from the default Proxmox repository via command line.\u00a0<\/p>\r\n\r\n\r\n\r\n<p class=\"has-text-align-left\"><em><span class=\"has-inline-color has-black-color\">\u2018apt install openvswitch-switch\u2019<\/span><\/em><\/p>\r\n\r\n\r\n\r\n<p>It will install all the required packages and that is it for the installation. The configuration is a little more involved. Since you can&#8217;t run a Linux bridge and OpenVSwitch interfaces at the same time, swapping to this configuration will require any running VMs to be offline. Because of this, it is more convenient to setup OpenVSwitch when you first set up a server, before you have active virtual machines running.<\/p>\r\n\r\n\r\n\r\n<p>A simple bridge setup with OpenVSwitch involves 3 interfaces. The physical interface configuration, the bridge interface, and the default vlan interface. Here is the simple configuration for the physical interface<\/p>\r\n\r\n\r\n\r\n<p>First back up your network interfaces file at \u201c\/etc\/network\/interfaces\u201d and or replace your appropriate physical interface with the following to create an OVSPort. We will be creating the bridge \u201cvmbr0\u201d in\u00a0 the next section, but it is also defined here. Also note there is a VLAN option. This configuration is assuming you have untagged traffic coming into the host node. Since OpenVSwitch wants VLAN aware traffic, we redefine all traffic to be on \u201cvlan1\u201d as the default.<\/p>\r\n\r\n\r\n\r\n<p><em>auto ens6<br>allow-vmbr0 ens6<br>iface ens6 inet manual<br>  \u2003ovs_bridge vmbr0<br>\u2003 ovs_type OVSPort<br>\u2003 ovs_options tag=1 vlan_mode=native-untagged<\/em><\/p>\r\n\r\n\r\n\r\n<p>Next, you will need to define the actual bridge for your VMs to use. This part is very similar to Linux bridge, but it is using OpenVSwitch instead. We simply setup the bridge that is aware of the various OVS ports.<\/p>\r\n\r\n\r\n\r\n<p><em>allow-ovs vmbr0<br>iface vmbr0 inet manual<br>\u2003 ovs_type OVSBridge<br>\u2003 ovs_ports ens6 vlan1<\/em><\/p>\r\n\r\n\r\n\r\n<p>Finally, the last interface is the vlan interface. As mentioned earlier, OpenVSwitch wants to use a VLAN aware layout. The above traffic will be routed to vlan1 and we define the actual interface here for the host node on the bridge.\u00a0<\/p>\r\n\r\n\r\n\r\n<p><em>allow-vmbr0 vlan1<br>iface vlan1 inet static<br>\u2003 ovs_type OVSIntPort<br>\u2003 ovs_bridge vmbr0<br>\u2003 ovs_options tag=1<br>\u2003 address ###.###.###.###<br>\u2003 netmask ###.###.###.###<br>\u2003 gateway ###.###.###.###<\/em><\/p>\r\n\r\n\r\n\r\n<p>Once all 3 sections here are set up in your network interfaces file according to your network requirements, you should only have to reboot your server to activate the changes.\u00a0<\/p>\r\n\r\n\r\n\r\n<p>Now that we have the new OpenVSwitch bridge setup, you should be able to see it in your Proxmox control panel with appropriate OpenVSwitch (OVS) interfaces:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"919\" height=\"409\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image2-1.png\" alt=\"proxmox networking screenshot\" class=\"wp-image-1616\" title=\"\" srcset=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image2-1.png 919w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image2-1-300x134.png 300w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image2-1-200x89.png 200w\" sizes=\"(max-width: 919px) 100vw, 919px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>There is one more important thing you need to remember now when creating your virtual machines. Since the traffic needs to be vlan aware for the new bridge to function correctly, you need to have every VM attached to that vlan in their advanced configuration. Simply add the tag number 1 to each as you create it. That&#8217;s all there is to it.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"895\" height=\"394\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image1-1.png\" alt=\"proxmox network device screenshot\" class=\"wp-image-1617\" title=\"\" srcset=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image1-1.png 895w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image1-1-300x132.png 300w, https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2022\/09\/image1-1-200x88.png 200w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>This is a very simple configuration and implementation of OpenVSwitch and it is certainly capable of a lot more than just a bridge. To see more available options, such as Bonding or RSTP options, you can refer to the documentation here:<\/p>\r\n\r\n\r\n\r\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/pve.proxmox.com\/wiki\/Open_vSwitch\" target=\"_blank\">Proxmox: Open V Switc<\/a><a href=\"https:\/\/pve.proxmox.com\/wiki\/Open_vSwitch\" target=\"_blank\" rel=\"noreferrer noopener\">h<\/a><\/p>\r\n\r\n\r\n\r\n<p>For people interested in learning more about the exact performance characteristics of openvswitch vs linux bridge, this PDF report from the Dept. of Electrical, Electronic and Information Engineering\u00a0 University of Bologna \u2013 Italy has a wealth of information on the subject:<\/p>\r\n\r\n\r\n\r\n<p><a href=\"https:\/\/ioflood.com\/s3-5-callegati-performance.pdf\">Performance of Network Virtualization in Cloud Computing Infrastructures: The OpenStack Case.<\/a><\/p>\r\n\r\n\r\n\r\n<p>In this article we talked about a common problem with virtual machine network performance. Often, this is a problem with the performance of the default \u201clinux bridge\u201d software, which can be overcome by use of OpenVSwitch. We covered how to install and configure OpenVSwitch on Proxmox. The process for other virtualization platforms will differ somewhat but may be quite similar. Implementation of OpenVSwitch can often address these performance issues with linux bridge. As this is something we\u2019ve done for quite a few of our customers, we wanted to share this information with the broader community.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\"><strong>Do you love servers?<\/strong><\/h2>\r\n\r\n\r\n\r\n<p>We hope this article has helped you learn about improving virtualization network performance. See some of our other articles if you want to know more about similar topics regarding performance optimization, RAID, or server configuration and administration.If you love servers like we do, we\u2019d love to work together! IOFLOOD.com offers dedicated servers to people like you, and as part of that service, we optimize and test the network card driver when installing your OS to maximize performance. To get started today,<a href=\"https:\/\/ioflood.com\/phoenix-dedicated-servers.php\"> click here to view our dedicated servers<\/a>, or email us at sales[at]ioflood.com to ask for a custom quote.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>How to fix packet loss and latency in high bandwidth VPS servers by upgrading to OpenVSwitch Virtualization is one of the most pervasive and transformational technologies in the hosting world to have come along in the last decade. Despite this, maintaining the efficient operation of virtual machines is not always easy. In this article, we\u2019ll [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":951,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,11,28,16,9],"tags":[],"class_list":["post-1115","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-networking","category-performance-tuning","category-routing","category-sysadmin","cat-3-id","cat-11-id","cat-28-id","cat-16-id","cat-9-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/1115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=1115"}],"version-history":[{"count":9,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/1115\/revisions"}],"predecessor-version":[{"id":3168,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/1115\/revisions\/3168"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/951"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=1115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=1115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=1115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}