summaryrefslogtreecommitdiffstats
path: root/health/guides/web_log/web_log_10m_response_time.md
blob: 603482a9bc0bb63d6791661cd0a70d650951f886 (plain)
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
### Understand the alert

This alert calculates the average `HTTP response time` of your web server over the last 10 minutes. If you receive this alert, it means that the `latency` of your web server has increased, and might be affecting the user experience.

### What does HTTP response time mean?

`HTTP response time` is a measure of the time it takes for your web server to process a request and deliver the corresponding response to the client. A high response time can lead to slow loading pages, indicating that your server is struggling to handle the requests or there are issues with the network.

### Troubleshoot the alert

1. **Check the server load**: A high server load can cause increased latency. Check the server load using tools like `top`, `htop`, or `glances`. If server load is high, consider optimizing your server, offloading some services to a separate server, or scaling up your infrastructure.

   ```
   top
   ```

2. **Analyze the web server logs**: Look for patterns or specific requests that may be causing the increased latency. This can be achieved by parsing logs and correlating the response time with requests. For example, for Apache logs:

   ```
   sudo cat /var/log/apache2/access.log | awk '{print $NF " " $0}' | sort -nr | head -n 10
   ```

   For Nginx logs:

   ```
   sudo cat /var/log/nginx/access.log | awk '{print $NF " " $0}' | sort -nr | head -n 10
   ```

3. **Network issues**: Check if there are any issues with the network connecting your server to the clients, such as high latency, packet loss or a high number of dropped packets. You can use the `traceroute` command to diagnose any network-related issues.

   ```
   traceroute example.com
   ```

4. **Review your server's configuration**: Check your web server's configuration for any issues, misconfigurations, or suboptimal settings that may be causing the high response time.

5. **Monitoring and profiling**: Use application monitoring tools like New Relic, AppDynamics, or Dynatrace to get detailed insights about the response time and locate any bottlenecks or problematic requests.

### Useful resources

1. [How to Optimize Nginx Performance](https://calomel.org/nginx.html)
2. [Apache Performance Tuning](https://httpd.apache.org/docs/2.4/misc/perf-tuning.html)