Understanding Cumulative Frequency Graph
Tags: performance, analytics, monitoring, testing
Published: 2021-10-08 11:17:56

Have you ever analyzed network traffic with Wireshark? If you have, you've almost certainly come across Stevens' graph. For a given TCP stream, the Stevens graph depicts TCP sequence numbers over time. The Stevens graph is an example of a cumulative frequency graph. Below is an example of it.

![stevens-sequence-number-graph](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9xwaxd11pcp4c4khzywh.PNG)

The cumulative frequency graph is rarely seen or used in performance testing. When conducting performance testing or analyzing data, you're more likely to come across bar charts, scatter plots, histograms, and other types of graphs. In my opinion, the reason you don't see cumulative graphs used more often is that they are unfamiliar and difficult to interpret.

Occasionally you will encounter a cumulative frequency graph, such as the Stevens' graph above. Understanding how to interpret one is a useful skill to have as a performance engineer. It's helpful to know the three basic graph patterns (concave up, linear, and concave down). Knowing these patterns at a basic level will make it easier to discover anomalies in the graph (patterns that deviate from the usual).

In this article, I'll describe these three patterns and provide some examples from real applications. I've also left a cumulative graph for you to look at at the end and analyze.

Let's start with two graphs created using fictitious data. The first is a conventional response time graph, while the second is a cumulative response time graph. Both are related, include the same information, and are generated using the same data set. Also, the likelihood of seeing a perfect bell curve graph in the real world is low. But for the sake of this article, let's pretend it exists. It is easier to explain the concepts with it.

![Together_one](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bc8hfal2ptybmpu1jc42.png)
 
As shown in the graph above, when the variable is nonnegative, as in this case the response time, the cumulative frequency graph never decreases. It either increases or remains the same. When the variable is a count (e.g. requests, response time, errors, number of packets), the graph is technically a step function. There are three fundamental patterns/parts in this step function. They are Concave up, Linear, and Concave down.

![1633648822779](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/obprlnencli94sdab2ex.png)

* As the variable count increases, the cumulative graph will become "concave up." It's a concave up curve in the shape of a U. Because it is non decreasing, the curve will appear to be the right side of the U symbol.
* When the variable count stays the same, the cumulative curve is linear. The slope of the curve indicates the count.
* The cumulative curve will appear "concave down" when the variable count decreases or is zero. When the curve is exactly horizontal (zero slope), it indicates that the variable has no count. The concave down curve appears to be an upside down U. The curve will appear to be the left side of the upside down U sign because it is non decreasing. 

For a given variable, the cumulative frequency graph does not have to have all three patterns. The data for that variable will have a large influence on it. For example, the first cumulative graph below only has a linear pattern. It does not have the other two patterns. On the other hand, all three patterns are present in the other two graphs. I've also created the typical graph (requests/sec & requests/min) for each cumulative graph that you would be accustomed to seeing in performance testing/engineering. These graphs are of a real applications.

![image-first](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jlgbiis5nh89q5y3l9lh.jpg)

![image-two](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fy3ytssgrokdqeqirmd.jpg)

![image009](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjhlwcyekuhgpj686h83.jpg)
 
  
When there is too much raw data to plot using a scatter plot, I found this type of graph as another option for visualizing the data.

With the above information, here is another real-world example. It is a cumulative response time (sec) & a number of requests graph of an application. I'll leave it up to you to interpret and make sense of it.

![final-jpg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02rick0k4zysan2r31c2.jpg)

I hope this article has given you a basic understanding of how to examine a cumulative graph the next time you come across one.

------------------------------------------------------------------

Thanks for reading!

If you enjoyed this article feel free to share it on social media 🙂

Say Hello on: [Linkedin](https://www.linkedin.com/in/harinderseera/) | [Twitter](https://twitter.com/harinderseera) | [Polywork](https://www.polywork.com/harinderseera) 

Blogging: [Dev](https://dev.to/harinderseera) | [Hashnode](https://harinderseera.hashnode.dev/)

Github: [hseera](https://github.com/hseera)