Professional Documents
Culture Documents
Dvs Property Enhancement of Ens Switch in Vmware NSX-T: A Report
Dvs Property Enhancement of Ens Switch in Vmware NSX-T: A Report
ON
By
AT
A Practice School II of
ON
By
AT
A Practice School II of
Title of the Project: DVS Property Enhancement of ENS Switch in VMware NSX-T
ID No. : 2019H1030157H
Name : Prakhar Gupta
Discipline : M.E. Computer Science
Project Areas: NSX Data Plane for vSphere, Enhanced Network Stack, Load Balancer, Network
Virtualization, Networking
Prakhar Gupta
Signature of Student Signature of PS Faculty
Date: 21st March, 2021
3
BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE
PILANI (RAJASTHAN)
Title of the Project: DVS Property Enhancement of ENS Switch in VMware NSX-T
Usefulness of the project to the on-campus courses of study in various disciplines. Project should
be scrutinized keeping in view the following response options. Write Course No. and Course
Name against the option under which the project comes.
4
Acknowledgement
I would like to take this opportunity to express my gratitude towards the head of this organization,
VMware, for providing me with this opportunity to be a part of VMware as an intern. I would like to
express my very great appreciation to Mr. Binu Pillai (Senior Manager) for his guidance,
motivation, valuable and constructive suggestions. I wish to acknowledge the assistance given
by My Mentor Mr. Ankur Sharma, (Staff Engineer II) for all the support and day to day
activities here. I express my warm regards to my other mentor Mr. Alex RN (Senior Software
Engineer) for helping me out with setting up the development environment and giving ramp up
sessions.
I would like to thank our PS faculty, Prof. Chandra Shekar R K for his constant support
during this program and for always being readily approachable when in need.
I would also like to thank my fellow interns who helped me understand various things.
5
Table of Contents
I. Abstract 3
III. Acknowledgement 5
1. Introduction 7
2. Literature Survey 8
3. Problem Statement 10
4. Development Setup 10
4.1 Development Build Setup 10
4.2 Building and deploying ESXi hypervisor 10
4.3 Building and deploying NSX data path 10
4.4 Development Flow 10
5. Proposed Solution 11
6. Learnings 11
7. References 12
6
1. Introduction
VMware provides cloud computing and virtualization software and services. And these
virtualization software creates an abstraction layer over computer hardware that allows the
hardware elements of a single computer to be divided into multiple virtual computers. And these
services and VMware products enable enterprises to build Software-defined data centers, which
extends virtualization concepts such as abstraction, pooling, and automation to all data center
resources: compute, storage and networking. VMware core product NSX provides network and
security virtualization products for the SDDC that enables networks to be virtualized and control
them logically in software.
For improving the network performance, VMware developed Enhanced Network Stack (ENS)
that provides a fast packet processing path for its Software Forwarding Element called the NSX
vSwitch. Inspired by DPDK, VMware uses few of its techniques in the ESXi kernel to improve
the data plane processing eciency. ENS has a simpler packet buffer representation, employs
dedicated polling contexts for processing the packets, performs NUMA aware memory accesses
and has lockless shared data structures.
An ENS enabled vSwitch employs dedicated kernel threads to poll, process the packets received
and forward the packets to the concerned virtual ports. These ports are logically connected to
either the virtual NICs of the VMs or the physical NICs of the server. Each port is polled by a
single kernel thread to avoid synchronization between the threads. However, a single kernel
thread may poll multiple ports. A single vSwitch may use a pool of kernel threads, each pinned
to a CPU core respectively. In order to further improve the packet processing eciency and to
lower the packet drop, ENS dynamically load balances the ports among the available kernel
threads. The ENS Thread Load Balancer (TLB) takes into consideration different costs such as
communication, stability, VM affinity and device affinity cost, for re-balancing the virtual ports.
Each vSwitch has a single TLB context assigned to it, which periodically runs to perform the
balancing if required.
This document describes the customer requirements and its solution which is setting up default
load balance metric for the system as well as for the two modes interrupt and polling in which
ENS enabled vSwitch works by doing an enhancement of dvs property which can be used to
apply properties on distributed switches. For this purpose net-dvs command is used on the ESXi
shell and which will also show a lot of information about the distributed virtual switch which is
connected to the hosts.
7
2. Literature Survey
VMware developed an Enhanced Network Stack (ENS) to better support the increasing
performance requirements of the NFV workloads. This approach re-architects the network stack
using few of the libraries given by Intel's Data Plane Development Kit (DPDK). The Software
Forwarding Element i.e. the vSwitch can be configured in the ENS mode. The virtual NICs of
the VMs and the physical NICs of the server are connected to these ports respectively. In this
mode, the virtual ports of the vSwitch are polled by a dedicated kernel thread for processing its
packets. A single port is polled by only one kernel thread, however, a single kernel thread may
poll multiple virtual ports. The kernel threads are pinned to the CPU cores in order to prevent
any scheduling delays. As compared to the default network stack, the new network stack uses a
simpler packet buffer representation, has optimized backend NIC emulation, improved packet
forwarding, NUMA aware memory accesses and lockless implementation of most of the shared
data structures. The below figure illustrates an ENS vSwitch with two kernel threads, three
virtual NIC ports and two physical NIC ports. Kernel thread 1 is polling the two ports and Kernel
thread 2 is polling three ports.
The kernel threads maintain a lot of statistics while it is processing the packets of its assigned
ports. It may happen that the ports being handled by a particular kernel thread are having a lot of
trac and the ports of some other kernel thread are having very low trac. In this case the CPU
power of the other kernel thread remains under-utilized, if the ports are statically allocated to the
8
kernel threads. For this, vSwitch has another thread called a Thread Load Balancer (TLB), which
periodically checks the statistics logged by the kernel threads, to load balance the ports among
the available kernel threads. It tries to increase the CPU utilization of the kernel threads, by re-
allocating the ports to different kernel threads depending on certain costs. These costs include -
the cost of communication between two ports, cost of re-allocating a port from one kernel thread
to another and cost of memory accesses. By increasing the CPU utilization the increased packet
rate and lower packet drop is achieved.
Net-dvs Command
The net-dvs command which can be used to apply properties on distributed switches and also can
be used to display information about the Distributed Switch configuration, which can be useful
in situations like troubleshooting.
when logged onto the ESXi shell, the net-dvs command can be run and will output a lot of
information about the dvSwitch that the host is connected to. The command displays data found
in the dvsdata.db file. This file is updated by the host at 5 minute intervals.
9
3. Problem Statement
DVS Property Enhancement of ENS Switch: Change the default load balance metric to CPU load
and implement an enhancement for dvs property through which users can set separate default
load balance metric for interrupt and polling mode of ENS enabled Switch.
4. Development Setup
5. Proposed Solution
10
● Changed the default metric to CPU load.
● Defined two dvs property for setting up default for interrupt and poll mode of ENS
Switch.
● Created a structure that will hold the default metric for both modes.
● Implemented callback write and clear for both modes that will set and unset the default
metric.
The assigned task has yet one last thing to be completed which is to make the implemented dvs
property consumable so that they can sync up with the ENS Switch.
Tools and Technologies used: C and Python programming, Git, Perforce, Bazel and Scons build
tools, Shell Scripting, SSH, Confluence, VMware ESXi, VMware vSphere, VMware NSX.
6. Learnings
It was a whole new learning experience as first I had to go through ramp up sessions and hands
on lab sessions through which I got familiar with the VMware core products and learned
concepts related to virtualization, enhanced network stack, thread load balancer.
11
7. References
[3] Luo Louis (San Francisco CA US). Enhanced Network Stack, July 2020.
[4] Matthew Portnoy. Virtualization Essentials. SYBEX Inc., USA, 1st edition, 2012.
12