From ad8dc13150b640ae9613e1edd8cc8c2c72b1e6b2 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 13 Aug 2024 18:24:53 -0400 Subject: Reduce thread contention on HTTPStats singleton access via simpleton. The main thread and http thread had significant contention in asset-fetch heavy scenarios that could result in main thread and http thread stalls when the http thread was accessing the HTTPStats singleton and the master singleton dependency list had to be queried. The HTTP thread is the primary user of HTTPStats with the main thread only calling into it during shut down to query the stats for the session. --- indra/llcorehttp/httprequest.cpp | 2 ++ indra/llcorehttp/httpstats.h | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llcorehttp') diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 216d407deb..2aaf71f8a4 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService() HttpRequestQueue::init(); HttpRequestQueue * rq = HttpRequestQueue::instanceOf(); HttpService::init(rq); + HTTPStats::createInstance(); has_inited = true; } @@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService() if (has_inited) { + HTTPStats::deleteSingleton(); HttpService::term(); HttpRequestQueue::term(); has_inited = false; diff --git a/indra/llcorehttp/httpstats.h b/indra/llcorehttp/httpstats.h index f12e59da0c..5c0f26d34e 100644 --- a/indra/llcorehttp/httpstats.h +++ b/indra/llcorehttp/httpstats.h @@ -35,12 +35,12 @@ namespace LLCore { - class HTTPStats : public LLSingleton + class HTTPStats final : public LLSimpleton { - LLSINGLETON(HTTPStats); - virtual ~HTTPStats(); - public: + HTTPStats(); + ~HTTPStats(); + void resetStats(); typedef LLStatsAccumulator StatsAccumulator; -- cgit v1.2.3