Traffic Emulation with VMware TENS and Load Balancer Introduction


Traffic emulators play a key role in testing the reliability and performance of networks. They are used to check the impact of high data traffic on the network infrastructure. This ensures that applications work in production and can withstand high loads. Not only applications, but also load balancers can be tested and sized accordingly with the help of traffic emulators.

Before we dive into the detailed installation of VMware TENS (Traffic Emulator for Network Service) and a specific use case, we will first explain the basics of a load balancer. Let’s start with the basic question: What is a load balancer?

LoadBalancer

Load balancers distribute requests evenly across multiple application instances to efficiently distribute the load on servers. This is important because a single server can only handle limited client requests. To improve the performance of the application as the number of users grows, additional servers can be placed behind the load balancer. Load balancers ensure the stability of an application and ensure its fail-safe operation. If a server fails - due to a defect or planned maintenance, the load balancer automatically redirects the requests to the remaining servers. This keeps the application highly available and provides the clients with an uninterrupted service.

Before an application is introduced in a production environment, it should be tested in advance along with the load balancer performance. A safe approach is to test the performance with a traffic emulator beforehand.

It should be mentioned in advance that a traffic emulator cannot exactly replicate the actual load behavior of productive traffic. Therefore, it is not guaranteed that the application and the load balancer will behave under the traffic emulator as they would in production operation. Nevertheless, testing provides a clue as to how the application and the load balancer should be scaled.

VMware Tens

A traffic emulator like VMware TENS allows you to simulate realistic traffic patterns. By mimicking user behavior, sessions, and requests, it can be ensured that the load balancer works under real conditions.

Traffic Emulator

A traffic emulator can help test the performance limits of the load balancer. The emulator can simulate the maximum load and check how the load balancer responds to it. The results of the tests can identify bottlenecks or weaknesses before the application is released for production.

Let’s take a closer look at VMware TENS and evaluate why it is advantageous for testing and validating load balancer functions.

The TENS architecture can be represented as follows:

TENS Architecture

The architecture separates the control plane and the data plane from each other. In the control plane, the Traffic Engine Controller (TEC) takes over the management and control for the distributed Traffic Engine Datapaths (TE-DP). Through the TEC, any number of TE-DPs can be deployed to test applications.

Use Case

In the following use case, we prepare the controller and the Datapath virtual machine (VM) so that we can run TENS and send emulated traffic to a web server.

TensUseCase

Before we start with the setup of TENS, the following dependencies should be installed on the Controller VM as well as DP VM:

Checklist
  • Controller & DP
    • openssh-server
    • python
    • docker
  • Controller only
    • git
    • pip
      • scp
      • paramiko
    • net-tools
    • wget
Quick install on Controller & DP
apt install openssh-server
apt-get install python3 python-is-python3
# docker installation on Ubuntu
apt-get update && \
apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
apt-get update && \
apt-get install -y --force-yes docker-ce
Quick install on Controller only
apt install git
apt-get install ipython3
apt-get install pip
pip install scp paramiko
apt-get install net-tools

After the dependencies are installed, we can clone VMware TENS into our home directory on the Controller VM:

git clone https://github.com/vmware/te-ns.git

To run TENS, we need to navigate to the te-ns/te directory and run ipython3.

Now we can define WHAT to do and HOW the application should be tested.

The following configurations define how the traffic is mapped and what should be done with it. In addition, we define how many datapaths should be used to send requests to the target address. For a deep dive into the individual configurations and values, you can read the documentation on Github.

from TE_WRAP import *

# WHAT to do
resource_config = {'res' : {
    'default-get-post-ratio': '1:0',
    'get-profiles': {'g1': [{'uri': 'index.html'}]},
    'http-version': '1.1',
    'vip-list': [{'get-profile': 'g1', 'vip': 'http://tensdp.local:81'}]
}}

# HOW to do it
session_config = {'ses'  : {
     'connection-range': [1, 1],
     'cycle-type': 'restart',
     'num-sessions': 1,
     'requests-range': [1, 1],
     'session-type' : 'MaxPerf',
     'session-ramp-delay' : 20,
     'session-ramp-step' : 1
    }
}

instanceProfileConfig = {'tedp_inst1' : {'res-tag': 'res', 'ses-tag': 'ses'}}

te_controller = {'host': 'tensctl.local',
            'user': 'root',
            'passwd':'VMware1!'}

# HOW much            
te_dp_dict = {
    'tensctl.local': {'instance_profile': {'tedp_inst1': 1},
                    'passwd': 'VMware1!',
                    'user': 'root'},
    'tensdp.local': {'instance_profile': {'tedp_inst1': 1},
                    'passwd': 'VMware1!',
                    'user': 'root'}
                    }
                    
te_ns_obj = TensTE(te_controller)

# setup controller and roll out container
te_ns_obj.setup_te()

# setup dp and roll out container
te_ns_obj.setup_tedp(te_dp_dict)

For starting and stopping the traffic emulator, as well as reading out metrics, the following commands can be executed:

te_ns_obj.start(resource_config, session_config, instanceProfileConfig, te_dp_dict)

te_ns_obj.get_vip_metrics("TOTAL")

te_ns_obj.stop()

te_ns_obj.clear_config()
In [8]: te_ns_obj.get_vip_metrics("TOTAL")
Out[8]: 
{'status': True,
 'statusmessage': {'vip=http://tensdp.local:81': {'bytes_download': 12736710.0,
   'connections': 61528.0,
   'cps': 1500.6829268292684,
   'failed_reqs': 0.0,
   'http_gets_rcvd': 61530.0,
   'http_gets_sent': 61530.0,
   'http_posts_rcvd': 0.0,
   'http_posts_sent': 0.0,
   'latency-error-percentage': '5.0406%',
   'latency_max': 0.073566,
   'latency_mean': 0.00024,
   'latency_min': 1e-05,
   'latency_p10': -0.00075,
   'latency_p90': 0.0012,
   'latency_p95': 0.00149,
   'latency_p99': 0.00198,
   'latency_p99.9': 0.0026,
   'latency_sd': 0.00076,
   'len_fail': 0.0,
   'persist_fail': 0.0,
   'reqs_sent': 61530.0,
   'resp_rcvd': 61530.0,
   'responses_1xx': 0.0,
   'responses_200': 61530.0,
   'responses_2xx': 61530.0,
   'responses_3xx': 0.0,
   'responses_404': 0.0,
   'responses_4xx': 0.0,
   'responses_5xx': 0.0,
   'rps': 1500.7317073170732,
   'sessions': 0.0,
   'tcp_failures': 0.0,
   'tput': 310651.46341463417}}}
Evaluation

The emulator’s ability to realistically represent traffic depends both on its own performance and the actual traffic pattern of the clients. Regarding the question of whether VMware TENS is capable of simulating client requests in your own environment, depends on various factors and should be evaluated in advance. Nevertheless, TENS serves as a point of reference and supports the scaling process of applications as well as load balancers.

Summary
  1. Load Balancer:
    • Distributes requests evenly across multiple application instances to efficiently distribute server load.
    • Ensures stability and fail-safety of the application.
    • Automatically redirects requests to remaining servers in case of server failures.
  2. Traffic Emulator:
    • Simulates user interactions with an application.
    • A traffic emulator provides clues for scaling, but cannot exactly replicate real load behavior.
    • Safety measure before productive operation.

Note

Troubleshooting

  • Minimale Anzahl an CPU Cores: 2 (1 Core per instance)
    • {'status': False, 'statusmessage': {'Resource insuffient to run te_dps': {'tensdp.local': {'currently-available': 0, 'currently-needed': 1}}}}
  • Install net-tools
    • {'status': False, 'statusmessage': 'Unable to get free ports'}

Hints

  • ssh access with public key possible
    • te_controller = {'host': 'tensctl.local', 'user': 'root'}

Useful Links