How to install wrk on linux system?
1. Purpose
In this post, I will demo how to install wrk
, a web url performance test tool on linux/unix/mac systems.
2. The solution
2.1 How to install wrk?
On linux systems, to ensures that your package manager (APT) has the most up-to-date information about available packages, versions, and dependencies, we should update the local cache
first:
root@launch-advisor-20191120:/etc/nginx# apt update....
Then we install the wrk
tool using apt install
command:
root@launch-advisor-20191120:/etc/nginx# apt install wrkReading package lists... DoneBuilding dependency treeReading state information... DoneE: Unable to locate package wrk
You can see that we got an error E: Unable to locate package wrk
, why?
And wrk
can only run on Unix-like systems. Such as linux, mac, solaris, etc. It can only be compiled on these systems.
So we can install it from source
:
Download wrk source code:
sudo apt-get install build-essential libssl-dev git -ygit clone https://github.com/wg/wrk.git wrk
Then build it:
cd wrksudo make
Then we can use the binary:
# move the wrk executable to your PATHsudo cp wrk /usr/local/bin
2.2 Verify the installation of wrk
root@launch-advisor-20191120:~/wrk# wrkUsage: wrk <options> <url> Options: -c, --connections <N> Connections to keep open -d, --duration <T> Duration of test -t, --threads <N> Number of threads to use
-s, --script <S> Load Lua script file -H, --header <H> Add header to request --latency Print latency statistics --timeout <T> Socket/request timeout -v, --version Print version details
Numeric arguments may include a SI unit (1k, 1M, 1G) Time arguments may include a time unit (2s, 2m, 2h)root@launch-advisor-20191120:~/wrk#
It works.
3. Summary
In this post, I demonstrated how to install wrk , a great performance test tool . That’s it, thanks for your reading.
Final Words + More Resources
My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!