Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process values, as: * N of currently run cpu threads (in threadpool) * Length of primary threadpool queue * Length of secondary threadpool queue. These elements makes 3 metrics: primary queue, secondary queue, and total queue, which is sum of pri + second + N. These metrics sampled the same way as linux does for load average - that is sliding exponential window for 1, 5 and 15 minutes, by a sample once in 5 seconds. You can see 'load', 'load_primary', and 'load_secondary' in 'show status' output. You can see 'Queue now+pri+sec=total', and 'Load average' line in 'status' output. Also, set env MANTICORE_TRACE_LOAD to true will trace actual values as they updated (each 5s) in search.log with 'info' priority (that is simple and useful when playing with settings, running searchd with '--console' key).
- Loading branch information
Showing
7 changed files
with
180 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// Copyright (c) 2023, Manticore Software LTD (https://manticoresearch.com) | ||
// All rights reserved | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License. You should have | ||
// received a copy of the GPL license along with this program; if you | ||
// did not, you can find it at http://www.gnu.org | ||
// | ||
|
||
#pragma once | ||
|
||
#include "std/ints.h" | ||
|
||
// implement exponential sliding stat | ||
|
||
class ExpMeter_c | ||
{ | ||
double m_fSum = 0.0; | ||
double m_fVal = 0.0; | ||
BYTE m_uSamples = 0; | ||
const BYTE m_uTimeConstant; | ||
|
||
public: | ||
explicit ExpMeter_c ( BYTE uTimeConstant ) | ||
: m_uTimeConstant { uTimeConstant } | ||
{} | ||
|
||
[[nodiscard]] double Value() const noexcept { return m_fVal; } | ||
|
||
void Reset() | ||
{ | ||
m_fSum = 0.0; | ||
m_fVal = 0; | ||
m_uSamples = 0; | ||
} | ||
|
||
template<typename NUM> | ||
void Tick ( NUM tSample ) noexcept | ||
{ | ||
m_fSum += tSample; | ||
if ( m_uSamples < m_uTimeConstant ) | ||
++m_uSamples; | ||
else | ||
m_fSum -= m_fVal; | ||
|
||
m_fVal = m_fSum / m_uSamples; | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.