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>
diff --git a/http/http_body.hpp b/http/http_body.hpp
index 46070cc..f4bfed5 100644
--- a/http/http_body.hpp
+++ b/http/http_body.hpp
@@ -178,7 +178,11 @@
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: