@@ -72,6 +72,8 @@ nlohmann::json ClientConnectionDetails::to_json(
7272 */
7373static std::vector<FrontEndThread> threads;
7474std::vector<Hdr1sfMicroSecHistogram> scheduler_info;
75+ std::vector<Hdr1sfMicroSecHistogram> dispatch_socket_histogram;
76+ std::vector<Hdr1sfMicroSecHistogram> cookie_notification_histogram;
7577
7678/*
7779 * Number of worker threads that have finished setting themselves up.
@@ -309,11 +311,14 @@ void FrontEndThread::do_dispatch(SOCKET sfd,
309311 BucketManager::instance ().associateInitialBucket (*c);
310312 success = true ;
311313 } catch (const std::bad_alloc&) {
312- LOG_WARNING_RAW (" Failed to allocate memory for connection" );
314+ LOG_WARNING_CTX (" Failed to allocate memory for connection" ,
315+ {" worker_tid" , index});
313316 } catch (const std::exception& error) {
314- LOG_WARNING_CTX (" Failed to create connection" , {" error" , error.what ()});
317+ LOG_WARNING_CTX (" Failed to create connection" ,
318+ {" error" , error.what ()},
319+ {" worker_tid" , index});
315320 } catch (...) {
316- LOG_WARNING_RAW (" Failed to create connection" );
321+ LOG_WARNING_CTX (" Failed to create connection" , { " worker_tid " , index} );
317322 }
318323
319324 if (!success) {
@@ -382,8 +387,13 @@ void FrontEndThread::dispatch(SOCKET sfd,
382387 last_thread = tid;
383388
384389 try {
385- thread.eventBase .runInEventBaseThread (
386- [&thread, sock = sfd, port = std::move (descr)]() {
390+ using namespace std ::chrono;
391+ const auto scheduled = steady_clock::now ();
392+ thread.eventBase .runInEventBaseThreadAlwaysEnqueue (
393+ [&thread, sock = sfd, port = std::move (descr), scheduled]() {
394+ const auto now = steady_clock::now ();
395+ dispatch_socket_histogram[thread.index ].add (
396+ duration_cast<microseconds>(now - scheduled));
387397 thread.do_dispatch (sock, port);
388398 });
389399 } catch (const std::bad_alloc& e) {
@@ -427,6 +437,8 @@ void worker_threads_init() {
427437 const auto nthr = Settings::instance ().getNumWorkerThreads ();
428438
429439 scheduler_info.resize (nthr);
440+ dispatch_socket_histogram.resize (nthr);
441+ cookie_notification_histogram.resize (nthr);
430442
431443 try {
432444 threads = std::vector<FrontEndThread>(nthr);
0 commit comments