Tuesday, December 1, 2015

Moniter/Listen/Load test http request Linux

There is a simple tool tcpflow to capture the actual headers coming to your host

tcpflow port 80

To be more specific use.
tcpflow -p -c -i eth0 port 80 | grep -oE '(GET|POST|HEAD) .* HTTP/1.[01]|Host: .*'

Capture only number of hits: 
tcpflow -p -c -i eth0 port 80 | grep 'Date'


Use ab tool (apache2-tools) to benchmark the load on apache or any other http server like pyhton,node etc

ab -n 1000 -c 10 http:ipaddresss:port/                    / is important after port number 

-n number of request to send
-c total request to send per sec / concurrent req


You can use rate limit to allow number of connection per sec/min/hr with --limit module in IPTABLES

Iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 10/second --limit-burst 10 -j ACCEPT

No comments:

Post a Comment

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...