aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-06 13:59:18 +0200
committerGitHub <[email protected]>2021-10-06 13:59:18 +0200
commitfa48ebf89e06edc9d3bdd26b119417df20902bdd (patch)
tree2ea8c3e06282ff537d5985b94f8dc129bd60e9e8 /zenhttp/include
parentAdded option to specify path to logfile. (diff)
downloadzen-fa48ebf89e06edc9d3bdd26b119417df20902bdd.tar.xz
zen-fa48ebf89e06edc9d3bdd26b119417df20902bdd.zip
Support for asynchronous HTTP response processing (#19)
This change introduces WriteResponseAsync which can be used to move potentially slow request handler code (like upstream lookups) off the I/O service thread to ensure we are always able to serve as many HTTP requests as possible. The current implementation defaults to 16 async worker threads and there is currently no back-pressure. - Added RequestStats - Metrics for network requests. Aggregates tracking of duration, payload sizes into a single class for ease of use - Added some metrics on upstream communication Co-authored-by: Per Larsson <[email protected]>
Diffstat (limited to 'zenhttp/include')
-rw-r--r--zenhttp/include/zenhttp/httpserver.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/zenhttp/include/zenhttp/httpserver.h b/zenhttp/include/zenhttp/httpserver.h
index 6a7dc8a70..3e6608f11 100644
--- a/zenhttp/include/zenhttp/httpserver.h
+++ b/zenhttp/include/zenhttp/httpserver.h
@@ -97,6 +97,8 @@ public:
void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::string_view ResponseString);
void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, IoBuffer Blob);
+ virtual void WriteResponseAsync(std::function<void(HttpServerRequest&)>&& ContinuationHandler) = 0;
+
protected:
enum
{