# OmbuLabs Blog

If I were to ask you: tell me in one word or a number here, how satisfied are your users with the response times of your application. What would you say?

I would say the apdex score is 0.98 and that’s pretty awesome. Now, if you are wondering what is this apdex score and what does the 0.98 value tell us, you have come to the right place.

Continue reading to understand this better.

## What is an Apdex score?

It is known as Application Performance Index and is an industry standard to measure the satisfaction of the users with the response times of the web application.

The apdex score is in the range of 0 to 1. Here 0 means the user is highly frustrated and 1 means the user is satisfied with the response times.

The user’s response is categorically divided into

• Satisfactory
• Tolerating
• Frustrated

To place an apdex score into one the above categories, you must decide on a threshold value T and then use the following logic to categorize it:

 Response time Category < = T Satisfactory > T & < 4T Tolerating > = 4T Frustrated

For example: if T is set to 0.5 s and the response completes in 1.6 s, based on the table above the response time falls between > 0.5 and < 4 * 0.5 s, so the user would be at a level of tolerating the response times.

## How do you choose the value of the threshold T ?

There is no standard value that one should set for their applications. The answer, like to most decisions in engineering, is it depends.

This time, it depends on how your application is doing. If the application has been running for a while and you are aware of the response times, then you might want to use this table to select the T value:

 Target Apdex score Percentile value to use for T 0.85 70% 0.90 80% 0.95 90% 0.98 96%

So for an app that has been running for a while, you may want to choose a higher value for the apdex score. Let’s say, for example, 0.95. From the table, for an apdex of 0.95, you should set the threshold as the 90th percentile response time value.

## What if we choose the wrong value for threshold (T) ?

• If you choose a value that is way more than your 99th percentile value for response times, chances are you will have a near perfect apdex score. In reality, this may not be the case. For example: if the 99th percentile value for response times is 1 s and the threshold value you chose is 3 s, this means that, since 99% of the requests will have a response time of less than the value of T, you may get an apdex of 0.99. With a value of 0.99, your application’s users should be satisfied with the response times.

• If you choose a value that is way more than the 99th percentile value for response time, chances are you may get a lot of false positives. For example, let’s consider the 99th percentile value as 1 s and the T value as 200 ms. From the value of T you can infer that a percentage of your users would be just tolerating the application’s response times and a few would be frustrated. But this happens because you have set the value of T to be too low and some false positives would have been recorded. This is exactly why the value of T is never set for life. It should always be moving towards a higher value. You should set a value and then try to improve the response time of the application. Once you get there, you should reset the value of T to a higher value and then work on the application’s response times until you reach a state where the value of T is acceptable to you.

## How to calculate Apdex score?

The apdex score is a ratio of the total number of the satisfied requests and tolerating requests to the total number of requests.

The only caveat is that the weight given to the satisfied requests is 1 and the weight given to the tolerating requests is 0.5.

So the formula looks like this:

``````
APDEX_SCORE = [(No. of satisfied requests) + (No. of tolerating requests  * 0.5)] / (No. of total requests)

``````

Let’s consider, for example, that for a period of 1 hour the application receives 1000 requests. The value set for the threshold is 200 ms.

Out of those 1000 requests,

• 800 requests had a response time of less than 200 ms. They count as satisfied requests.
• 100 requests had a response time between 200 ms and 800 ms. They count as tolerating requests.
• 100 requests had a response time over 800 ms. They count as frustrated requests.

Based on above formula, the apdex score would be calculated as

``````= (800 + (100 * 0.5)) / 1000
= (800 + 50) / 1000
= 0.85
``````

The resulting apdex score came up to 0.85 in our hypothetical scenario.

## Apdex in New Relic and DataDog

Both APM tools have different ways to configure the value of T for all your applications and different ways to show the apdex score. However, the underlying workings of the score remain same. You can read more about the configuration in New Relic here for services and here for Frontend applications and and in Datadog.

If you prefer to watch a video on it, check the New Relic APM Tutorial: Understanding Apdex video for similar details.