You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-1Lines changed: 80 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,13 @@ As a dynamic library, don’t forget that libmodsecurity must be installed to a
57
57
58
58
### Unix (Linux, MacOS, FreeBSD, …)
59
59
60
-
On unix the project uses autotools to help the compilation process.
60
+
On unix the project uses autotools to help the compilation process. Please note that if you are working with `git`, don't forget to initialize and update the submodules. Here's a quick how-to:
The source tree includes a Benchmark tool that can help measure library performance. The tool is located in the `test/benchmark/` directory. The build process also creates the binary here, so you will have the tool after the compilation is finished.
247
+
248
+
To run, just type:
249
+
250
+
```shell
251
+
cd test/benchmark
252
+
$ ./benchmark
253
+
Doing 1000000 transactions...
254
+
255
+
```
256
+
257
+
You can also pass a lower value:
258
+
259
+
```shell
260
+
$ ./benchmark 1000
261
+
Doing 1000 transactions...
262
+
```
263
+
264
+
To measure the time:
265
+
```shell
266
+
$ time ./benchmark 1000
267
+
Doing 1000 transactions...
268
+
269
+
real 0m0.351s
270
+
user 0m0.337s
271
+
sys 0m0.022s
272
+
```
273
+
274
+
This is very fast because the benchmark uses the minimal `modsecurity.conf.default` configuration, which doesn't include too many rules:
275
+
276
+
```shell
277
+
$ cat basic_rules.conf
278
+
279
+
Include "../../modsecurity.conf-recommended"
280
+
281
+
```
282
+
283
+
To measure with real rules, run one of the download scripts in the same directory:
The tool is a straightforward wrapper application that utilizes the library. It creates a ModSecurity instance and a RuleSet instance, then runs a loop based on the specified number. Within this loop, it creates a Transaction object to emulate real HTTP transactions.
311
+
312
+
Each transaction is an HTTP/1.1 GET request with some GET parameters. Common headers are added, followed by the response headers and an XML body. Between phases, the tool checks whether an intervention has occurred. All transactions are created with the same data.
313
+
314
+
Note that the tool does not call the last phase (logging).
315
+
316
+
Please remember to reset `basic_rules.conf` if you want to try with a different ruleset.
0 commit comments