# Threshold settings

yCrash application monitors several macro metrics to detect the problems in the application. If these metrics values are breached beyond a certain threshold then alerts are generated. Say for example the default threshold value for maximum Garbage collection pause time is: 5 seconds. If your application's garbage collection pause time exceeds 5 seconds, then alerts will be generated. For certain applications (like trading applications) 5 seconds might be a too high value, on the other hand it might be acceptable value for several other applications.

yCrash provides a mechanism to customize these thresholds values based on the application's need. In this post, let's see what are the metrics that can be customized and how to customize them.

# Customizable Macro Metrics Thresholds:

Macro metrics monitor the high-level resource consumption of your application and system. The following thresholds can be customized:

Metric Default Value Description
appMemoryPercentage 50 Specifies the maximum percentage of total device (or container) memory that your application is allowed to consume. If the application’s memory usage exceeds this limit, yCrash will create an incident on the dashboard.
Example: If this value is set to 50% and your system has 16 GB RAM, an incident will be triggered when the application uses more than 8 GB of memory.
appCpuPercentage 80 Specifies the maximum percentage of total device (or container) CPU that your application is allowed to consume. If the application’s CPU usage exceeds this limit, yCrash will create an incident on the dashboard.
Example: If this value is set to 80%, an incident will be triggered when the application’s CPU usage exceeds 80%.
diskPercentage 80 If overall host (or container) disk utilization goes beyond this percentage on any one file mount, then a warning message will be reported. Default value is 80%.
systemMemoryPercentage 50 Specifies the maximum percentage of total device (or container) memory that your system is allowed to consume. If the system's memory usage exceeds this limit, yCrash will create an incident on the dashboard.
Example: If this value is set to 50% and your system has 16 GB RAM, an incident will be triggered when the system uses more than 8 GB of memory.
systemCPUPercentage 80 Specifies the maximum percentage of total device (or container) CPU that your system is allowed to consume. If the system's CPU usage exceeds this limit, yCrash will create an incident on the dashboard.
Example: If this value is set to 80%, an incident will be triggered when the system's CPU usage exceeds 80%.
overallResponseTime 10000 Defines the overall response time taken to process the request of all activities and serve the response. The overall response time will be calculated by the average of all the activities served within the m3 frequency. This has to be specified in milliseconds.
transactionResponseTime - If certain transactions are known to take longer to respond, you can configure transaction-specific thresholds for response time. This allows you to fine-tune alerting behavior — alerts will only be triggered when a transaction exceeds its defined threshold. By setting appropriate thresholds for each transaction, you can prevent unnecessary alerts for transactions that are expected to have longer response times. This has to be specified in milliseconds. The APIs that are mentioned in the transactionResponseTime will be excluded from the overallResponseTime.

# Customizable GC Metrics Thresholds:

GC metrics help you monitor the health and efficiency of your application's garbage collection process. The following thresholds can be customized:

Metric Default Value Description
gcMaxPauseTime 5 Maximum garbage collection pause time defined in seconds. To learn more about this metric refer to the 'Latency' section in this post (opens new window). If pause time goes above this value, then a warning message will be reported. Default value is 5 seconds.
gcThroughputPercentage 90 If the total amount of time an application spends in Garbage collection drops below this percentage, then a warning message will be reported. To learn more about this metric refer to the 'Throughput' section in this post (opens new window). Default value is 90%.

# Customizable Thread Metrics Thresholds:

Thread metrics help identify concurrency issues within your application. The following thresholds can be customized:

Metric Default Value Description
threadConsistentCpuPercentage 40 If thread CPU percentage goes beyond this percentage, then a warning message will be reported. Default value is 40%.
socketReadThreadsSize 10 Defines the maximum allowable number of socket threads. If the number of active socket threads exceeds this threshold, a error message will be generated. This helps ensure that the application does not consume excessive resources or encounter performance issues due to too many open socket connections
blockedThreadsSize 5 Defines the maximum allowable number of blocked threads. If the number of blocked threads exceeds this threshold, an indication will be raised in the RCA (Root Cause Analysis) report. This ensures that potential performance bottlenecks caused by excessive thread blocking are promptly identified and addressed.

# How to customize these metrics?

  1. Place this threshold-settings.json file in the yCrash Server’s upload directory. If you use remote storage,
    you can store the threshold-settings.json file in the root directory of the remote storage (AWS S3, Google Cloud Storage). The yCrash application checks if the file exists locally first. If found, it reads from there. Otherwise, it looks for the file in the remote storage.

  2. The threshold-settings.json file structure should look like this:

{
  "globalSetting": {
    "gcMaxPauseTime": 9,
    "gcThroughputPercentage": 20,
    "appMemoryPercentage": 90,
    "appCpuPercentage": 90,
	"diskPercentage": 80,
    "systemMemoryPercentage": 50,
    "systemCpuPercentage": 80,
    "threadConsistentCpuPercentage": 40,
    "socketReadThreadsSize": 44,
    "blockedThreadsSize": 5,
    "overallResponseTime": 10000,
    "transactionResponseTime": {
      "/API1": 5000,
      "/API2": 10000
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Suppose if you would like to override only gcMaxPauseTime property and retain default values for other properties then you can just specify the gcMaxPauseTime property in the JSON file, like this:

{
   "globalSetting":{
      "gcMaxPauseTime":9.0
   }
}
1
2
3
4
5

Say suppose you are monitoring multiple applications and would like to set different threshold values by each application, you can do so as well. You can see different threshold values configured for aps and ecpr applications in the below example.

{
  "globalSetting": {
    "gcMaxPauseTime": 9,
    "gcThroughputPercentage": 90,
    "appMemoryPercentage": 90,
    "appCpuPercentage": 90,
	"diskPercentage": 80,
    "systemMemoryPercentage": 50,
    "systemCpuPercentage": 80,
    "threadConsistentCpuPercentage": 90,
    "socketReadThreadsSize": 10,
    "blockedThreadsSize": 5,
    "overallResponseTime": 10000,
    "transactionResponseTime": {
      "/API1": 5000,
      "/API2": 10000
    }
  },
  "appsSetting": [
    {
      "app": "aps",
      "threshold": {
        "gcMaxPauseTime": 8,
        "gcThroughputPercentage": 80,
        "appMemoryPercentage": 80,
        "appCpuPercentage": 80,
		"diskPercentage": 70,
        "systemMemoryPercentage": 60,
        "systemCpuPercentage": 70,
        "socketReadThreadsSize": 10,
        "blockedThreadsSize": 5,
        "overallResponseTime": 10000,
        "transactionResponseTime": {
          "/API1": 5000,
          "/API2": 10000
        }
      }
    },
    {
      "app": "ecpr",
      "threshold": {
        "gcMaxPauseTime": 7,
        "gcThroughputPercentage": 70,
        "appMemoryPercentage": 70,
        "appCpuPercentage": 70,
		"diskPercentage": 70,
        "systemMemoryPercentage": 70,
        "systemCpuPercentage": 60,
        "socketReadThreadsSize": 10,
        "blockedThreadsSize": 5,
        "overallResponseTime": 10000,
        "transactionResponseTime": {
          "/API1": 5000,
          "/API2": 10000
        }
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

# Escaping Special Characters

If you want to add special characters, such as Carriage return \r, Tab \t, Double quote ", Backslash \.. they need to be escaped properly. Learn about it from here.