Motivation
Because of high memory usage per each connection, possible denial of service exists when large resources are consumed by slow clients.
Related issues: #1714, depends on #498 (single large response fully cached may cause DoS)
Testing
Scenario to reproduce
Host1 (slow clients):
Start a lot of slow (1 byte per second) downloads:
curl --output /dev/null -H 'Connection: close' --parallel-max 999 --parallel --parallel-immediate 'http://tempesta-host/[1-10000]' --limit-rate 1B
Host2 (legitimate client):
Try to access resource: curl -v --output /dev/null http://tempesta-host
Depending on the load, result could be:
- Empty response, client hangs for some time, and receive [FIN,ACK] from Tempesta:
curl: (52) Empty reply from server
- Partial response is downloaded and connection is closed by the Tempesta side [RST, ACK]:
{ [1132 bytes data]
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
Tempesta
cat /proc/net/sockstat show high value of TCP memory usage
ss -l show high Send-Q values
- DMESG contains messages:
TCP: out of memory -- consider tuning tcp_mem
tempesta.cfg
listen 80 proto=http;
server 127.0.0.1:8000;
cache 0;
Backend
Backend on port 8000 should return a large response.
Tested on 200MB, larger responses could trigger #1714
Scenario for quick reproduction
- Reduce TCP memory bound:
sysctl -w net.ipv4.tcp_mem='100 100 100'
- Start first (slow) client:
curl -v --output /dev/null http://127.0.0.1 --limit-rate 1B
- While first client is running, start second client:
curl -v --output /dev/null http://127.0.0.1
- Second client hangs until the first client has finishing downloading.
Motivation
Because of high memory usage per each connection, possible denial of service exists when large resources are consumed by slow clients.
Related issues: #1714, depends on #498 (single large response fully cached may cause DoS)
Testing
Scenario to reproduce
Host1 (slow clients):
Start a lot of slow (1 byte per second) downloads:
curl --output /dev/null -H 'Connection: close' --parallel-max 999 --parallel --parallel-immediate 'http://tempesta-host/[1-10000]' --limit-rate 1BHost2 (legitimate client):
Try to access resource:
curl -v --output /dev/null http://tempesta-hostDepending on the load, result could be:
curl: (52) Empty reply from serverTempesta
cat /proc/net/sockstatshow high value of TCP memory usagess -lshow highSend-QvaluesTCP: out of memory -- consider tuning tcp_memtempesta.cfg
Backend
Backend on port 8000 should return a large response.
Tested on 200MB, larger responses could trigger #1714
Scenario for quick reproduction
sysctl -w net.ipv4.tcp_mem='100 100 100'curl -v --output /dev/null http://127.0.0.1 --limit-rate 1Bcurl -v --output /dev/null http://127.0.0.1