diff options
| author | Stefan Boberg <[email protected]> | 2021-10-06 13:59:18 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-06 13:59:18 +0200 |
| commit | fa48ebf89e06edc9d3bdd26b119417df20902bdd (patch) | |
| tree | 2ea8c3e06282ff537d5985b94f8dc129bd60e9e8 /zenserver/cache/structuredcache.h | |
| parent | Added option to specify path to logfile. (diff) | |
| download | zen-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 'zenserver/cache/structuredcache.h')
| -rw-r--r-- | zenserver/cache/structuredcache.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/zenserver/cache/structuredcache.h b/zenserver/cache/structuredcache.h index 703e24ed3..ad7253f79 100644 --- a/zenserver/cache/structuredcache.h +++ b/zenserver/cache/structuredcache.h @@ -30,12 +30,12 @@ enum class CachePolicy : uint8_t; * * {BucketId}/{KeyHash} * - * Where BucketId is an alphanumeric string, and KeyHash is a 40-character hexadecimal - * sequence. The hash value may be derived in any number of ways, it's up to the - * application to pick an approach. + * Where BucketId is a lower-case alphanumeric string, and KeyHash is a 40-character + * hexadecimal sequence. The hash value may be derived in any number of ways, it's + * up to the application to pick an approach. * * Values may be structured or unstructured. Structured values are encoded using Unreal - * Engine's compact binary encoding + * Engine's compact binary encoding (see CbObject) * * Additionally, attachments may be addressed as: * @@ -62,8 +62,7 @@ public: ~HttpStructuredCacheService(); virtual const char* BaseUri() const override; - - virtual void HandleRequest(zen::HttpServerRequest& Request) override; + virtual void HandleRequest(zen::HttpServerRequest& Request) override; void Flush(); void Scrub(ScrubContext& Ctx); @@ -104,6 +103,7 @@ private: std::unique_ptr<UpstreamCache> m_UpstreamCache; uint64_t m_LastScrubTime = 0; metrics::OperationTiming m_HttpRequests; + metrics::OperationTiming m_UpstreamGetRequestTiming; CacheStats m_CacheStats; }; |