2

I'm trying to test the throughput between two docker containers using Iperf3 (any throughput tester app) connected to OVS (openvswitch) and DPDK on ubuntu 18.04 (VMWare workstation). The goal of this is to compare the performance of OVS-DPDK vs Linux kernel in some scenarios.

I can't find a proper solution, which explains how to connect OVS+DPDK to the docker containers so that the containers can pass TCP/UDP traffic to each other.

I'd appreciate your help explaining how to connect two docker containers with OVS+DPDK. The configuration that needs to be done in the docker containers, and the ones that need to be done in the host OS.

BTW I don't have traffic from outside.

Thanks

Edit

  • DPDK version is 20.11.0
  • OVS version is 2.15.90
  • Iperf3

Here are the steps I take:

  1. I install dpdk using apt: sudo apt install openvswitch-switch-dpdk

  2. set the alternative as: sudo update-alternatives --set OvS-vswitchd /usr/lib/openvswitch-switch -dpdk/OvS-vswitchd-dpdk

  3. Allocate the hugepages and update the grub.

  4. mount hugepages

  5. bind NIC to DPDK: sudo dpdk-devbind --bind=vfio-pci ens33. Although I don't need this step because I don't have traffic from outside if I don't bind my NIC the sudo service openvswitch-switch restart fails.

  6. I create a bridge: ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev

  7. I create two ports for my containers: ovs-vsctl add-port br0 client -- set Interface client type=dpdk options:dpdk-devargs=<binded_nic_pci_addr> and ovs-vsctl add-port br0 server -- set Interface server type=dpdk options:dpdk-devargs=<binded_nic_pci_addr>. (server port number: 1, client port number: 2)

  8. Open bidirectional flow between ports:

    1. sudo ovs-ofctl del-flows br0
    2. sudo ovs-ofctl add-flow br0 in_port=1,action=output:2
    3. ovs-ofctl add-flow br0 in_port=2,action=output:1

After step 8 I don't know how to connect my iperf3 docker containers to use these ports. I appreciate your help in letting me know how to connect containers to the ports and test the network.

Edit 2

Based on Vipin's answer these steps won't work considering my requirements.

Mohammad Siavashi
  • 1,192
  • 2
  • 17
  • 48
  • @MohammaSiavashi, the content of the question is confusing because it appears like `if the intention is to use OVS without DPDK, why are using OVS-DPDK? but if the intention is to use OVS-DPDK you should be using DPDK-iperf`. Hence is the real question, for getting best performance `I would like to use DPDK-OVS as virtual switch between 2 VM, but I am having difficulty in allowing traffic to Kernel`. – Vipin Varghese Apr 26 '21 at 01:55
  • @VipinVarghese Thanks for your hint. I'm looking to use Iperf3 with ovs+dpdk to test throughput between two docker containers. I mean running two Iperf3 containers, one as server and one as client and connect these two with ovs+dpdk. I'm new to this field and couldn't find a working solution so far. Could you please share your solution? Thanks – Mohammad Siavashi Apr 26 '21 at 05:51
  • please share DPDK version, OVS version, COnfiguration for OVS, ports inside Dockers and ovs rules. – Vipin Varghese Apr 26 '21 at 06:17
  • @VipinVarghese I added the details to the edit section of the question. Please check. Thanks. – Mohammad Siavashi Apr 26 '21 at 09:56
  • @VipinVarghese BTW, If there is any better way that I don't have to bind my NIC I also appreciate sharing it. Thanks – Mohammad Siavashi Apr 26 '21 at 09:57
  • 1
    Please find the answer for your query. If you find it useful accept and upvote. – Vipin Varghese Apr 27 '21 at 02:33
  • @VipinVarghese Thanks, sure I'll do. But could you please add the configuration I need to do in the containers? That could be a great help. – Mohammad Siavashi Apr 27 '21 at 03:03
  • since you have mentioned you want to run iperf3 you will have to redirect the packet to the kernel interface. I have already shared the answer. I am unable to find any error or logs as you have not mentioned the same in your question update. I can make myself available for quick sync via call. will wait for you. – Vipin Varghese May 04 '21 at 17:44
  • @VipinVarghese Thanks for the update, I still stuck in the problem. If using TAP then the kernel will get involved which I need to bypass. What is the alternative of iperf3 that I can use for this purpose? – Mohammad Siavashi May 05 '21 at 02:15
  • @VipinVarghese I created a room name `OVS-DPDK`. Let's take the conversation there. Thanks. https://chat.stackoverflow.com/rooms/231963/ovs-dpdk – Mohammad Siavashi May 05 '21 at 02:25
  • @MohamamdSiavashi thanks for coming in chat and allowing me to clarify things for you. As discussed the edit `Based on Vipin's answer these steps won't work considering my requirements.` is a misunderstanding. Clarifications are clear how to run iperf3 (kernel sockets) with DPDK-OVS. Please accept and upvote close the current ticket – Vipin Varghese May 05 '21 at 04:38
  • @MohammadSivashi humble request, based on the chat discussion I have updated the conversation to clarify the points. Requesting you open new question for running without OVS-DPDK separately. Please accept and close the current question. – Vipin Varghese May 05 '21 at 12:14

1 Answers1

2

[EDIT: update to reflect only using OVS-DPDK and iperf3 on container]

There are multiple ways one can connect 2 dockers to talk directly with each other using to run iperf3.

  1. Virtual Interface like TAP-1|MAC-VETH-1 from Docker-1 is connected to TAP-2| MAC-VETH-2 via Linux Bridge.
  2. Virtual port-1 (TAP|memif) from OVS-DPDK to Docker-1 and virtual port-2 (tap|memif) to Docker-2 via DPDK-OVS

For scenario 2 one needs to add TAP interface to OVS. because end application iperf3 is using Kernel Stack for TCP|UDP termination. One can use the below settings (modified based on OVS-DPDK version) to achieve the result.

sudo ./utilities/ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
sudo ./utilities/ovs-vsctl add-port br0 myeth0 -- set Interface myeth0 type=dpdk options:dpdk-devargs=net_tap0,iface=tap0
sudo ./utilities/ovs-vsctl add-port br0 myeth1 -- set Interface myeth1 type=dpdk options:dpdk-devargs=net_tap1,iface=tap1
sudo ./utilities/ovs-ofctl add-flow br0 in_port=1,action=output:2
sudo ./utilities/ovs-ofctl add-flow br0 in_port=2,action=output:1

Note:

  1. as mentioned in comments, I am not in favour with this approach as TAP PMD defeats the benefit of bypassing Kernel (Docker1 ==> Kenrel TAP-1 ==> DPDK PMD ==> OVS ==> DPDK PMD ==> kernel TAP2 ==> Docker2)
  2. If one needs to simply check iperf3 performance, please use DPDK-iperf3 such as github project which do the same.
  3. reason for recommending TAP PMD over KNI PMD is using 2 CPU cores (DPDK thread and Kernel thread) tap and KNI are on par around 4Gbps with iperf3

[EDIT-1] based on the conversation https://chat.stackoverflow.com/rooms/231963/ovs-dpdk, @MohammadSiavashi

  1. Iperf3 requires either kernel or userspace network stack.
  2. In Linux docker, one can use the kernel stack to achieve this.
  3. DPDK-OVS will only bypass the Linux kernel bridge.
  4. Hence easiest alternative is to use TAP interface to inject back to the kernel for dockers.
  5. There is an alternative (as shared in the answer) for userspace network stack and iperf3 purely on DPDK.
  6. OVS-DPDK is not mandatory for current testing, because one can run testpmd, l2fwd, skeleton instead of running OVS-DPDK.
  7. one can always use the userspace network stack instead of Kernel network stack too.

Current agreement:

  • Dockers run on the host and use Kernel stack bifurcated by namespace and groups
  • With the current understanding @MohammadSiavashi will try out TAP PMD based OVS-DPDK and alternate to userspace iperf3.
Vipin Varghese
  • 4,540
  • 2
  • 9
  • 25
  • Thanks for your nice clarification. What I need is absolutely scenario 5. I still got two questions. 1. Do I need to bind the NIC in step 5? (If I don't I can't reload the daemon) 2. You're creating two ports for containers, but how can I make the containers use these ports? If you can address these questions it would be absolutely a great help to me and for future references. thanks – Mohammad Siavashi Apr 27 '21 at 02:54
  • Thanks to include the question in the answer that helps a lot. BTW, the question is based on "containers", not "VM"s, but the details you shared helps a lot, however, If you could have additional instructions based on containers that would be awesome since AFAIK these details could not be found anywhere else for beginners. Thanks much. – Mohammad Siavashi Apr 27 '21 at 14:49
  • 1
    @MohammadSiavashi ahh ok, glad to hear I was of some help. Thanks – Vipin Varghese Apr 27 '21 at 14:54
  • Would you please mind adding instructions for docker containers so I can accept it as the best answer? – Mohammad Siavashi Apr 28 '21 at 11:52
  • @MohammadSiavashi I think you are askign for steps to adding tap as an interface to the existing bridge. It should be there in OVS documentation, if not I will add this soon. – Vipin Varghese Apr 28 '21 at 14:32
  • Please check the edited question to clearly get my requirement. Especially the bold part. I also offered a bounty. Thanks. – Mohammad Siavashi Apr 29 '21 at 23:17
  • The goal of this is to compare the performance of OVS-DPDK vs Linux kernel in some scenarios, so I assume TAP will not help in this case. – Mohammad Siavashi Apr 29 '21 at 23:18
  • 1
    as shared please explore memif PMD (memif master on OVS and memif client on docker) – Vipin Varghese Apr 30 '21 at 02:56
  • Thanks. You got the bounty. I will select as best answer once I successfully test the TAP pmd solution probably today. Thanks – Mohammad Siavashi May 06 '21 at 00:11
  • When setting up TAP pmd with the commands in the answer, I notice a significant drop in Bitrate in iperf3. Say from 16Gbits/sec to 12Gbits/sec. Is this normal? shouldn't it goes higher? – Mohammad Siavashi May 06 '21 at 01:07
  • TAP will use kernel therads, can you please ensure TAP kernel are pinned to cores independent to DPDK-OVS or OS others. – Vipin Varghese May 06 '21 at 02:58
  • @MohammadSiavashi thanks for the bounty, my real concern to closing the ticket is to help others in community to get answers and also help you raise the next question specific to use case. – Vipin Varghese May 06 '21 at 03:04
  • I took the time to test. Using ifconfig, I noticed that almost no traffic is going through the TAP0 and TAP1 while docker veth interfaces are passing the traffic. Any action I need to take in the containers ? – Mohammad Siavashi May 10 '21 at 23:18
  • @MohammadSiavashi live debug is much easier to understand what is the issue. I am available on skype, hangout and zoom. send me the invite – Vipin Varghese May 11 '21 at 02:38
  • Can I have your Skype Id please? – Mohammad Siavashi May 25 '21 at 23:05
  • vipinpv85. what is yours? – Vipin Varghese May 26 '21 at 02:28