topdown: Prevent unnecesssary client creation and disable HTTP keep-alives
This commit includes two fixes to the http.send built-in: 1) Prevent inter-query cache from creating client on every request The http.send inter-query cache creates a http.client on every request even if the response is cached and fresh. This change prevents this from happening as it's not required. 2) Disable HTTP keep-alives Currently http.send uses the http.DefaultTransport instance while creating a http client on every unique request. Since we do not set the keep-alive timeout for a connection, the default value (90 secs) is used. When a policy is queried hundreds or thousands of times per second, these new connections stay open till their idle connection timeout is reached. Eventually connection resource utilization adds up resulting in errors such as "too many openfiles". This change attempts to fix this by disabling HTTP keep-alives. Fixes: #4015 Fixes: #4016 Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
A
Ashutosh Narkar committed
3e829a37ac262ab0c124115349d2826420865e31
Parent: 8a1aab3