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.
master
Rye Mutt 2024-08-13 18:24:53 -04:00
parent 31774e82c4
commit ad8dc13150
2 changed files with 6 additions and 4 deletions

View File

@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService()
HttpRequestQueue::init(); HttpRequestQueue::init();
HttpRequestQueue * rq = HttpRequestQueue::instanceOf(); HttpRequestQueue * rq = HttpRequestQueue::instanceOf();
HttpService::init(rq); HttpService::init(rq);
HTTPStats::createInstance();
has_inited = true; has_inited = true;
} }
@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService()
if (has_inited) if (has_inited)
{ {
HTTPStats::deleteSingleton();
HttpService::term(); HttpService::term();
HttpRequestQueue::term(); HttpRequestQueue::term();
has_inited = false; has_inited = false;

View File

@ -35,12 +35,12 @@
namespace LLCore namespace LLCore
{ {
class HTTPStats : public LLSingleton<HTTPStats> class HTTPStats final : public LLSimpleton<HTTPStats>
{ {
LLSINGLETON(HTTPStats);
virtual ~HTTPStats();
public: public:
HTTPStats();
~HTTPStats();
void resetStats(); void resetStats();
typedef LLStatsAccumulator StatsAccumulator; typedef LLStatsAccumulator StatsAccumulator;