http_static: Fix timeout on large files 17/34617/6
authorMichal Kalderon <mkalderon@marvell.com>
Wed, 24 Nov 2021 09:33:15 +0000 (01:33 -0800)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 29 Dec 2021 22:48:40 +0000 (22:48 +0000)
commitfe2231f01fb56af21d6b4d6f63d7e1a2c4d14848
tree0d3fc1359f471b0ec6e455787ee9808790529f1d
parentfb079585cf6367eea279613bd7b9b810ab418edd
http_static: Fix timeout on large files

When trying to read files that are larger than the fifo
a timeout was reached on client side leading to an abort of the request
and a retry (sending another GET command).

The svm fifo notification request was set to notify when the fifo is no
longer full, this lead to an inefficient loop of sending small amounts
of data each time with a large overhead of context switch and waiting
for the next notification, eventually leading to a timeout.

Modifying the trigger on the svm-fifo to be notified on a preset threshold
value enabled sending larger amounts of data between context switches and
sending large files more efficiently. This solved the timeout issue.

In addition, cap the max write from application to 4MB to avoid running
into a case of trying to allocate chunks that are too large.

Reproduce:
Server:
http static server www-root /var/www/data uri tcp://0.0.0.0/80 cache-size 5m fifo-size 300

Client:
wget http://11.0.0.2/file_of_size_32M

Type: fix
Change-Id: Idfceedffd935da9486cde820e9dca5dad69d9ca5
Signed-off-by: Yuval Caduri <cyuval@marvell.com>
Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
src/plugins/http_static/static_server.c