diff options
| author | Stefan Boberg <[email protected]> | 2023-10-20 13:25:58 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-20 13:25:58 +0200 |
| commit | 733dce4c722f101635d60709613d7c97c3bd30df (patch) | |
| tree | 548cfddd0329a2be1e11ddb0b08ce4ec7b238950 /src/zenserver/cache/httpstructuredcache.cpp | |
| parent | clean up GcContributor and GcStorage to be pure interfaces (#485) (diff) | |
| download | zen-733dce4c722f101635d60709613d7c97c3bd30df.tar.xz zen-733dce4c722f101635d60709613d7c97c3bd30df.zip | |
Cache (rpc) activitity recording improvements (#482)
this adds a new RPC recording path aimed at more continuous recording and analysis of recorded sessions
the new strategy is implemented alongside the original in order to retain the ability to read the older format
the main difference between v2 and v1 is that the new strategy splits the recording into segments which are independent from each other. This is done to enable long running sessions with automatic disk cleanup (not implemented yet), appending to an existing recording (not implemented) and/or partial analysis and processing. The recorder will start a new segment when some criteria is fulfilled, including the number of files in the segment directory, disk footprint etc
Diffstat (limited to 'src/zenserver/cache/httpstructuredcache.cpp')
| -rw-r--r-- | src/zenserver/cache/httpstructuredcache.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index 4ec7c56db..91f895b0b 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -1691,16 +1691,22 @@ HttpStructuredCacheService::ReplayRequestRecorder(const CacheRequestContext& Co for (uint64_t RequestIndex = 0; RequestIndex < RequestCount; ++RequestIndex) { WorkerPool.ScheduleWork([this, &Context, &JobLatch, &Replayer, RequestIndex]() { - IoBuffer Body; - std::pair<ZenContentType, ZenContentType> ContentType = Replayer.GetRequest(RequestIndex, Body); + IoBuffer Body; + zen::cache::RecordedRequestInfo RequestInfo = Replayer.GetRequest(RequestIndex, /* out */ Body); + if (Body) { uint32_t AcceptMagic = 0; RpcAcceptOptions AcceptFlags = RpcAcceptOptions::kNone; int TargetPid = 0; CbPackage RpcResult; - if (IsHttpSuccessCode( - HandleRpcRequest(Context, ContentType.first, std::move(Body), AcceptMagic, AcceptFlags, TargetPid, RpcResult))) + if (IsHttpSuccessCode(HandleRpcRequest(Context, + RequestInfo.ContentType, + std::move(Body), + AcceptMagic, + AcceptFlags, + TargetPid, + RpcResult))) { if (AcceptMagic == kCbPkgMagic) { @@ -1764,8 +1770,15 @@ HttpStructuredCacheService::HandleRpcRequest(HttpServerRequest& Request) auto HandleRpc = [this, RequestContext, Body = Request.ReadPayload(), ContentType, AcceptType](HttpServerRequest& AsyncRequest) mutable { - std::uint64_t RequestIndex = - m_RequestRecorder ? m_RequestRecorder->RecordRequest(ContentType, AcceptType, Body) : ~0ull; + uint64_t RequestIndex = ~0ull; + + if (m_RequestRecorder) + { + RequestIndex = m_RequestRecorder->RecordRequest( + {.ContentType = ContentType, .AcceptType = AcceptType, .SessionId = RequestContext.SessionId}, + Body); + } + uint32_t AcceptMagic = 0; RpcAcceptOptions AcceptFlags = RpcAcceptOptions::kNone; int TargetProcessId = 0; |