Being in Enterprise Messaging Platform Business for more than a decade, we always receive this question from various enterprises on how we calculate TPS of my platform.
How do I calculate throughput / TPS of my SMS/smpp application?
TPS (Throughput Per Second) is one of the most important aspects for any Enterprise Messaging Entity. Having high TPS is always desirable, however, many times we tend to make a mistake while calculating inbound and outbound TPS of our system.
It may be noted that TPS of any system depends on multiple factors and should be calculated with ideal conditions of CPU, RAM and network.
A typical Client Server TPS can be measured between Network to Network or Application to Application or a mix of both. Following example explains TPS between a Client Application to a SMPP Server at Network Stack.
Mainly there are 3 parameters which define your overall throughput per sec / TPS.
1. Latency (in milliseconds):
Round-trip delay time-the one-way time from the source (SMPP Client / ESME) sending a packet to the destination (SMPP Server / SMSC) receiving it plus the one-way time from the destination (SMPP Server / SMSC) sending a response packet back to the source (SMPP Client / ESME) receiving it, including the amount of time that a destination system (SMPP Server / ESME) spent in processing the packet at SMSC.
2. Window Size
It is relevant for Asynchronous protocols (such as SMPP) and defines the max allowed number of unacknowledged packets can be in network pipeline ).
3. Number of Sessions
In order to make use of the SMPP Protocol, a SMPP session must be established between the ESME and Message Centre or SMPP Routing Entity.
Let’s understand the flow of SMS again.
Step1: SMPP Client (ESME) sends out SMS traffic to an SMPP Server (SMSC).
Step2: SMPP Server Application acknowledges SMS to the SMPP Client
Step3: SMPP Client sends out the SMS traffic with the help of SMPP Protocol (TCP / IP) via biding TCP/SMPP sessions connecting to SMPP Server.
Here is a mathematical formula to design your application TPS:
TPS = Window Size * Number of Sessions / Latency
Setting up following parameters will be able to generate a TPS of 500 SMS / Second
Window Size = 10
Number of Sessions = 5
Latency = 100 milliseconds (0.1 seconds)
TPS = 10 * 5 / 0.1 = 500 SMS / Second
According to individual needs, TPS can be set and monitored.
Setting a high value of Windows Size is not recommended due to following reasons:
- Sending more Async messages to the server, will trigger more Async responses at client side. Which may trigger High CPU usages because you need to process all PDUs received in your network stack (receive buffer).
- Any abrupt (non graceful) socket disconnection may result in message loss which may be near equal to windows size.
We also discourage using a lot of sessions in your application as sessions are highly resource intensive.
Instead of overloading your application to meet higher TPS requirements, you can plan horizontally scaling your system.