Diameter Server Load Testing — A Guide
Diameter Server Load Testing — A Guide
Learn how to use JMeter to load test Diameter, a AAA protocol similar to Radius, and understand why the two go hand in hand.
Join the DZone community and get the full member experience.Join For Free
Sensu is an open source monitoring event pipeline. Try it today.
Diameter is a client/server application level protocol of AAA (authentication, authorization, accounting) type. Just like the Radius protocol, which is also of AAA type, the Diameter protocol services heavy loads of users. Therefore, servers operating over the Diameter protocol have to be load tested before switching to production mode. In this blog post we are going to discuss how to create scripts in Apache JMeter™ to load test services that use the Diameter protocol. To read about load testing the Radius server, click here.
In addition to Diameter, the other well known AAA protocols are Radius and TACACS+. Compared to them, the Diameter protocol provides better security, by utilizing TLS or IPsec. The Diameter protocol message also defines more commands, has a wider format of value and attribute pairs (AVP) and both commands and attributes can be extended, by adding new ones. Unlike Radius, Diameter uses TCP or SCTP protocols as transport mechanism, whereas Radius is known to use UDP protocol as transport mechanism.
Diameter also introduces the concept of an application. A Diameter application is a protocol that is an extension to the basic Diameter protocol, defined by a set of Diameter commands with corresponding attribute-value pairs (AVP). The basic Diameter protocol is described in RFC6733. Several examples of Diameter applications are the Diameter Network Access Server application (NAS), the Diameter Credit Control application CCA and the Diameter Extensible Authentication Protocol (EAP) application, described in the corresponding standards. For instance, the Diameter SIP application is described in RFC4740. So if we are going to load test Diameter server, we have to take in account all the applications it supports and design use cases and load testing scripts correspondingly.
The architecture of systems operating under the Diameter protocol is of clients processing requests from users and communicating with servers. But Diameter protocol systems may include other specific components, such as relay agents, proxy agents, redirect agents and translation agents. These are usually used in complex architectures with many Diameter servers as well as Diameter and Radius clients. The simplified architecture of a system working under the Diameter protocol is shown in the image below.
In this picture, Diameter clients, the Diameter server and the Diameter proxy agent are shown.
- Users communicate with the Clients by requesting access to a service or resources and by providing information for accounting purposes, like an accounting plan selection.
- Diameter clients receive users' requests for a service and send them to the server.
- The Diameter proxy agent is necessary if requests have to be redirected to other domains. In this image it's included only for generalization purposes.
- The communication between the client and the server can be done over the basic Diameter protocol or through a Diameter application with a specific commands set.
As JMeter is a universal tool, it is the right decision to use it to generate load for Diameter protocol requests. There are no Diameter protocol samplers in the JMeter suite, nor are there any in the JMeter plugins. Therefore, the only way to imitate Diameter requests and process the responses of these requests is to implement them in the code of JSR223 samplers.
There are a few open Diameter java libraries available. One of them is used for the demonstration purpose in this blog post. It can be downloaded from here. This library implements the Diameter base protocol and supports some of the widely used Diameter applications, such as credit control application (CCA), online charging (Ro), offline charging (Rf) and others. This library provides the interface for users to interact with Diameter networks and build components in Diameter networks, such as EAP, NAS, Home subscriber server (HSS) and others. By using this library it's possible to imitate the interaction of Diameter clients, such as NAS, HSS servers or others with the Diameter server, and load them with authentication, authorization, accounting and other requests. In order to work with this library, just drop the jar file to the /lib/ext folder of the JMeter installation directory.
Before we start with the implementation of the JMeter script, we need to set up the test bench against which the demonstrated script can be launched. The test bench is the Diameter server. There is a free Diameter server, that supports the basic set of the Diameter commands and several Diameter applications. This Diameter server can be downloaded from here. Instructions for the installation of the free Diameter server for different OS can be found there, too.
Besides the free version of the Diameter server, there are other versions, that have an evaluation period. One of them can be downloaded from here.
The basic configuration of the free Diameter includes the configuration of the Diameter server name, the realm that the Diameter server serves, protocol settings, TLS settings, list of peers and extensions, among which there are Diameter applications.
After the test environment is configured and Diameter java client library is downloaded and compiled, the next step is the creation of the JMeter script.
The JMeter script, that implements Diameter authentication and accounting requests is shown in the screenshot below.
The script implements a simple flow — authentication of users and sending a few accounting requests from each authenticated user.
1. The first step is to create constants that are used for the protocol initialization and the interaction between the JMeter and Diameter server. These constants are placed to the user defined variables configuration element of JMeter or they can be placed to the user defined variables section of the test plan. The screenshot of the constants is shown below. The constants include: server URL, realm definition, application ID, port, several command codes, and the paths to the configuration files.
2. The second step is configuring your thread group.
3. The third is writing the code for JSR223 samplers. The code of the JSR223 samplers that imitates DIAMETER protocol requests, can be written in JAVA, Groovy or other supported programming languages. In this article we will provide an example of JAVA code.
The code of the JSR223 samplers implements the following steps:
- Initialization of the Diameter protocol stack, the session factory and the network listener, which processes responses from the diameter server.
- After the session is established, the authentication request to the Diameter server is sent. If the user is successfully authenticated a few accounting requests follow.
- Accounting requests are implemented in another JSR223 sampler.
4. In order to verify the responses from the Diameter server, we need to add assertions. The JSR223 assertions, which are child elements for JSR223 samplers verify that samplers have returned successful responses. The assertions code is written in JAVA code as well.
5. To scale up the test, you need to add CSV files with Diameter clients accounts and users credentials to the thread group.
6. For debugging purposes, add a listener to the test plan and don't forget to remove it after the script is debugged and the load to the target Diameter server is ready to be launched.
This script demonstrates the simple load testing scenario of Diameter server with authentication and accounting requests. The scenarios of specific implementations can be different, but the approach stays the same.
Learn more advanced JMeter from our free JMeter academy.
Click here to subscribe to our newsletter.
Published at DZone with permission of Konsantine Firsanov , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.