-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathBENCHMARK.txt
122 lines (83 loc) · 3.74 KB
/
BENCHMARK.txt
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Table of contents:
1. How to benchmark ?
2. How to analyze ?
1. What can be benchmarked ?
============================
At every request Itools saved into a file (log/access) some infos :
- Request ip address
- Request date (HTTPDATE format)
- Request verb
- Request route
- Request HTTP version
- Request status
- Request processing time (in seconds with milliseconds resolution.)
Generating a file containing many lines such as :
localhost - - [23/Mar/2017:13:56:07 +0100] "GET / HTTP/1.1" 200 0.497
2. How to analyze ?
===================
You can decide to analyze on the flow or after copying the file.
There are many possible stack to analyze :
- Using small tools such as GOACCESS (https://goaccess.io)
- Using more complex stack such as the InfluxDATA TICK STACK
You can use the tool you want.
The most important think is the log format that of course can be overrided in every tool
2.2 Using command line
----------------------------
List the 20 slowest requests:
$ awk '{print $11 , $6 , $7}' access | sort -r | head -n 20
List the 20 slowest POST requests:
$ awk '{print $11 , $6 , $7}' access | grep POST | sort -r | head -n 20
2.2 Using the GOACCESS tool
----------------------------
Goaccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
In the terminal :
$ goaccess FILE --log-format '%h %^[%d:%t %^] "%r" %s %b %T' --time-format '%H:%M:%S' --date-format '%d/%b/%Y'
Generate an HTML report :
$ goaccess FILE --log-format '%h %^[%d:%t %^] "%r" %s %b %T' --time-format '%H:%M:%S' --date-format '%d/%b/%Y' -a -o report.html
2.3 Using the InfluxDATA TICK STACK
------------------------------------
TICK Stack is composed of 4 tools :
- Telegraf (https://github.com/influxdata/telegraf)
- InfluxDB (https://github.com/influxdata/influxdb)
- Chronograf (https://github.com/influxdata/chonograf)
- Kapacitor (https://github.com/influxdata/kapacitor)
Only the first 2 are needed to benchmark.
Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
It will automatically read the data from the file (as an input) and save them in an output (InfluxDB).
Here is a telegraf configuration file :
```
# Telegraf Configuration
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
## Logging configuration:
debug = false
quiet = false
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
urls = ["http://influxdb:8086"] # InfluxDB HTTP API
database = "telegraf" # Database name where to store data
write_consistency = "any"
timeout = "5s"
###############################################################################
# SERVICE INPUT PLUGINS #
###############################################################################
# Stream and parse log file(s).
[[inputs.logparser]]
files = ["/var/log/benchmark.log"]
from_beginning = false
[inputs.logparser.grok]
patterns = ["%{IPORHOST:client_ip} %{NOTSPACE:ident} %{NOTSPACE:auth} \\[%{HTTPDATE:ts:ts-httpd}\\] \"(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})\" %{NUMBER:resp_code:tag} (?:%{NUMBER:loading_time:float})"]
## Name of the outputted measurement name.
measurement = "benchmark"
```