mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Profiling] Add TTL to cached frames and executables (#144292)
* Add TTL to cached frames and executables * Fix misspelled constant
This commit is contained in:
parent
6bc74ae155
commit
1fdf4a6453
1 changed files with 11 additions and 2 deletions
|
@ -36,6 +36,9 @@ import { ProjectTimeQuery } from './query';
|
|||
|
||||
const BASE64_FRAME_ID_LENGTH = 32;
|
||||
|
||||
const CACHE_MAX_ITEMS = 100000;
|
||||
const CACHE_TTL_MILLISECONDS = 1000 * 60 * 5;
|
||||
|
||||
export type EncodedStackTrace = DedotObject<{
|
||||
// This field is a base64-encoded byte string. The string represents a
|
||||
// serialized list of frame IDs in which the order of frames are
|
||||
|
@ -270,7 +273,10 @@ export async function mgetStackTraces({
|
|||
return { stackTraces, totalFrames, stackFrameDocIDs, executableDocIDs };
|
||||
}
|
||||
|
||||
const frameLRU = new LRUCache<StackFrameID, StackFrame>({ max: 100000 });
|
||||
const frameLRU = new LRUCache<StackFrameID, StackFrame>({
|
||||
max: CACHE_MAX_ITEMS,
|
||||
maxAge: CACHE_TTL_MILLISECONDS,
|
||||
});
|
||||
|
||||
export async function mgetStackFrames({
|
||||
logger,
|
||||
|
@ -339,7 +345,10 @@ export async function mgetStackFrames({
|
|||
return stackFrames;
|
||||
}
|
||||
|
||||
const executableLRU = new LRUCache<FileID, Executable>({ max: 100000 });
|
||||
const executableLRU = new LRUCache<FileID, Executable>({
|
||||
max: CACHE_MAX_ITEMS,
|
||||
maxAge: CACHE_TTL_MILLISECONDS,
|
||||
});
|
||||
|
||||
export async function mgetExecutables({
|
||||
logger,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue