You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 23, 2023. It is now read-only.
Copy file name to clipboardexpand all lines: idx/memory/memory.go
+102-26
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,9 @@ var (
61
61
findCacheInvalidateMaxSize=100
62
62
findCacheInvalidateMaxWait=5*time.Second
63
63
findCacheBackoffTime=time.Minute
64
+
writeQueueEnabled=false
65
+
writeQueueDelay=30*time.Second
66
+
writeMaxBatchSize=5000
64
67
)
65
68
66
69
funcConfigSetup() {
@@ -73,6 +76,9 @@ func ConfigSetup() {
73
76
memoryIdx.IntVar(&findCacheSize, "find-cache-size", 1000, "number of find expressions to cache (per org). 0 disables cache")
74
77
memoryIdx.IntVar(&findCacheInvalidateQueueSize, "find-cache-invalidate-queue-size", 200, "size of queue for invalidating findCache entries")
75
78
memoryIdx.IntVar(&findCacheInvalidateMaxSize, "find-cache-invalidate-max-size", 100, "max amount of invalidations to queue up in one batch")
79
+
memoryIdx.BoolVar(&writeQueueEnabled, "write-queue-enabled", false, "enable buffering new metricDefinitions and writing them to the index in batches")
80
+
memoryIdx.DurationVar(&writeQueueDelay, "write-queue-delay", 30*time.Second, "maximum delay between flushing buffered metric writes to the index")
81
+
memoryIdx.IntVar(&writeMaxBatchSize, "write-max-batch-size", 5000, "maximum number of metricDefinitions that can be added to the index in a single batch")
76
82
memoryIdx.DurationVar(&findCacheInvalidateMaxWait, "find-cache-invalidate-max-wait", 5*time.Second, "max duration to wait building up a batch to invalidate")
77
83
memoryIdx.DurationVar(&findCacheBackoffTime, "find-cache-backoff-time", time.Minute, "amount of time to disable the findCache when the invalidate queue fills up.")
78
84
memoryIdx.StringVar(&indexRulesFile, "rules-file", "/etc/metrictank/index-rules.conf", "path to index-rules.conf file")
@@ -109,8 +115,8 @@ func ConfigProcess() {
109
115
typeMemoryIndexinterface {
110
116
idx.MetricIndex
111
117
LoadPartition(int32, []schema.MetricDefinition) int
112
-
UpdateArchive(idx.Archive)
113
-
add(*schema.MetricDefinition) idx.Archive
118
+
UpdateArchiveLastSave(schema.MKey, int32, uint32)
119
+
add(*idx.Archive)
114
120
idsByTagQuery(uint32, TagQuery) IdSet
115
121
PurgeFindCache()
116
122
ForceInvalidationFindCache()
@@ -254,24 +260,29 @@ type UnpartitionedMemoryIdx struct {
254
260
metaTagRecordsmap[uint32]metaTagRecords// by orgId
0 commit comments