What should we do before run wg/wrk test?

Tossapon Nuanchuay
ntossapo
Published in
1 min readJan 21, 2017

Wrk (Wg/Wrk) is a modern popular HTTP benchmark tool which is widely used to find out and evaluate server’s service rate to improve the system.

We can execute wrk test without kernel setup but the result will be inefficient and unacceptable.

The result will show about socket connection errors because Linux is limited only 1024 opening files at the same time. wrk needs to operate many files in order to create HTTP connections(socket). it’s OK, if we run the test less than 1024 connections. BUT!! 1024 is not enough for the large scale web. You can check how many files can open at the same time using command:

$ ulimit -a

Because in a fresh Linux, We can open only 1024 files at the same time, so we need to setup some of Linux kernel parameters.

***CAUTION!! WE NEED TO OPERATE IN ROOT PRIVILEGE***

  1. fs.file-max
$ sysctl -w fs.file-max=<10% of your RAM>

2. ulimit

$ ulimit -n 655350

After the setup and run the test, Socket connection error will be decrease. Socket Connection Error depend on many factor such as limited file opening, Network port remaining, etc.

Reference

--

--