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
+82-1Lines changed: 82 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,15 @@ 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 work with `git`, do not forget to initialize submodules and update them. Here is a brief howto:
The source tree has a Benchmark tool which can help to measure the library's performance. The tool is under the `test/benchmark/` directory. The build process also makes the binary here, so after the end of compiling you will have the tool.
249
+
250
+
To run, just type:
251
+
252
+
```shell
253
+
cd test/benchmark
254
+
$ ./benchmark
255
+
Doing 1000000 transactions...
256
+
257
+
```
258
+
259
+
Okay, this is a bit much, but you can pass a lower value:
260
+
261
+
```shell
262
+
$ ./benchmark 1000
263
+
Doing 1000 transactions...
264
+
```
265
+
266
+
To measure the time:
267
+
```shell
268
+
$ time ./benchmark 1000
269
+
Doing 1000 transactions...
270
+
271
+
real 0m0.351s
272
+
user 0m0.337s
273
+
sys 0m0.022s
274
+
```
275
+
276
+
This is very fast because the benchmark uses the minimal `modsecurity.conf.default` configuration, which has not so much rules:
277
+
278
+
```shell
279
+
$ cat basic_rules.conf
280
+
281
+
Include "../../modsecurity.conf-recommended"
282
+
283
+
```
284
+
285
+
To measure it with real rules, you should run one of the download scripts in the same directory:
The tool is a simple embedding application which uses the library. It creates a ModSecurity and a RuleSet instance, then runs a loop with number of you passed. Creates a Transaction (object) and emulates real HTTP transactions.
313
+
314
+
A transaction is a HTTP/1.1 GET request with a few GET parameters. Added common headers then the response: headers and an XML body. Between the phases it checks did any intervention happen or not. Every transaction is created with same data.
315
+
316
+
Note, that the tool does not call the last phase (logging).
317
+
318
+
Please don't forget to reset the `basic_rules.conf` content if you want to try it with another rule set.
0 commit comments