summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-03-29 20:49:27 +0300
committerEd Tanous <ed@tanous.net>2024-05-03 01:05:41 +0300
commite428b440ddb09ffd575d4969793df15e29c02c39 (patch)
tree3b49aa72421d3d328b65d688704a1a8f3b3254e2
parent5ffd11f248f155614bf30b498cb01a4e2065094d (diff)
downloadbmcweb-e428b440ddb09ffd575d4969793df15e29c02c39.tar.xz
Increase the file buffer
When we added file buffer, this number was picked arbitrarily. Prior to the file body patch series, files were buffered entirely in ram, regardless of what size they were. While not doing that was an improvement, I suspect that we were overly conservative in the buffer size. Nginx picks a default buffer size somewhere in the 8k - 64k range dependent on what paths the code takes. Using the higher end of that range seems like a better starting point, but generally we have more ram on the bmc than we have users. Increase the buffer to 64K. Tested: Unit tests pass. [1] https://docs.nginx.com/nginx-management-suite/acm/how-to/policies/http-backend-configuration/#buffers Change-Id: Idb472ccae02a8519c0976aab07b45562e327ce9b Signed-off-by: Ed Tanous <ed@tanous.net>
-rw-r--r--http/http_body.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/http/http_body.hpp b/http/http_body.hpp
index 46070cc60f..f4bfed58ec 100644
--- a/http/http_body.hpp
+++ b/http/http_body.hpp
@@ -178,7 +178,11 @@ class HttpBody::writer
value_type& body;
size_t sent = 0;
- constexpr static size_t readBufSize = 4096;
+ // 64KB This number is arbitrary, and selected to try to optimize for larger
+ // files and fewer loops over per-connection reduction in memory usage.
+ // Nginx uses 16-32KB here, so we're in the range of what other webservers
+ // do.
+ constexpr static size_t readBufSize = 1024UL * 64UL;
std::array<char, readBufSize> fileReadBuf{};
public: