Aliaksandr Valialkin
7d5d33fd71
lib/storage: return marshaled metric names from SearchMetricNames
...
Previously SearchMetricNames was returning unmarshaled metric names.
This wasn't great for vmstorage, which should spend additional CPU time
for marshaling the metric names before sending them to vmselect.
While at it, remove possible duplicate metric names, which could occur when
multiple samples for new time series are ingested via concurrent requests.
Also sort the metric names before returning them to the client.
This simplifies debugging of the returned metric names across repeated requests to /api/v1/series
2022-06-28 18:16:32 +03:00
Aliaksandr Valialkin
15da802f5f
lib/storage: put into query trace the number of found entries in SearchMetricNames
2022-06-28 14:52:39 +03:00
Aliaksandr Valialkin
399d4c36ae
app/vmselect: optimize /api/v1/series a bit for time ranges smaller than one day
2022-06-28 12:55:20 +03:00
Aliaksandr Valialkin
6386f117c8
all: show timeRange in traces in human-readable format instead of timestamps in milliseconds
2022-06-27 13:42:57 +03:00
Aliaksandr Valialkin
926fccbb8d
lib/storage: add querytracer to more contexts
...
querytracer has been added to the following storage.Storage methods:
- RegisterMetricNames
- DeleteMetrics
- SearchTagValueSuffixes
- SearchGraphitePaths
2022-06-27 12:53:49 +03:00
Aliaksandr Valialkin
6c66804fd3
all: locate throttled loggers via logger.WithThrottler() only once and then use them
...
This reduces the contention on logThrottlerRegistryMu mutex when logger.WithThrottler()
is called frequently from concurrent goroutines.
2022-06-27 12:34:30 +03:00
Aliaksandr Valialkin
270ad39359
lib/storage: properly take into account already registered series when -storage.maxHourlySeries
or -storage.maxDailySeries
limits are enabled
...
The commit 5fb45173ae
takes into account only newly registered series
when applying cardinality limits. This means that the cardinality limit could be exceeded with already registered series.
This commit returns back accounting for already registered series when applying cardinality limits.
2022-06-20 13:53:41 +03:00
Aliaksandr Valialkin
7a79e7c0ef
lib/storage: create per-day indexes together with global indexes when registering new time series
...
Previously the creation of per-day indexes and global indexes
for the newly registered time series was decoupled.
Now global indexes and per-day indexes for the current day are created toghether for new time series.
This should speed up registering new time series a bit.
2022-06-19 22:32:41 +03:00
Aliaksandr Valialkin
88e1221b35
lib/storage: do not register new series if -storage.maxHourlySeries
or -storage.maxDailySeries
limits are exceeded
...
Previously samples for new series weren't added as expected when series limits were reached,
but new series were still registered in indexdb.
2022-06-19 22:03:02 +03:00
Aliaksandr Valialkin
c5ac176153
lib/storage: reset metric id caches for the previous and the current hour
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2698
2022-06-19 22:02:51 +03:00
Aliaksandr Valialkin
45fa9d798d
app/vmselect: accept focusLabel
query arg at /api/v1/status/tsdb
2022-06-14 18:39:00 +03:00
Aliaksandr Valialkin
fb77843639
lib/storage: show top labels with the highest number of series in cardinality explorer
2022-06-14 16:34:13 +03:00
Aliaksandr Valialkin
3167fbc21d
lib/storage: improve error message when -search.max* command-line flag values are exceeded
2022-06-14 13:28:21 +03:00
Aliaksandr Valialkin
4af43a4a75
lib/storage: test GetTSDBStatusWithFiltersForDate on a global time range
2022-06-12 14:28:37 +03:00
Aliaksandr Valialkin
61e03f172b
app/vmselect: optimize /api/v1/labels
and /api/v1/label/.../values
handlers when match[]
query arg is passed to them
2022-06-12 14:06:24 +03:00
Aliaksandr Valialkin
cb39eada77
all: improve query tracing coverage for indexdb search
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1403
2022-06-09 20:04:02 +03:00
Aliaksandr Valialkin
a9ea3fee38
lib/querytracer: make it easier to use by passing trace context message to New and NewChild
...
The context message can be extended by calling Donef.
If there is no need to extend the message, then just call Done.
2022-06-08 21:16:12 +03:00
Dmytro Kozlov
f2754c3e90
Cardinality explorer ( #2625 )
...
* Cardinality explorer
* vmui, vmselect: updated field name, added description to spinner
* make vmui-update
* updated const name, make vmui-update
* lib/storage: changes calculation for totalSeries values
* added static files
* wip
* wip
* wip
* wip
* docs/CHANGELOG.md: document cardinality explorer feature
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2233
Co-authored-by: f41gh7 <nik@victoriametrics.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-06-08 18:54:27 +03:00
Roman Khavronenko
5f33445f66
lib/storage: limit max mergeConcurrency value for systems with high number of CPUs ( #2673 )
...
Workers count for merges affects the max part size during merges. Such behaviour
protects storage from running out of disk space for scenario when all workers
are merging parts with the max size.
This works very well for most cases. But for systems where high number of CPUs
is allocated for vmstorage components this could significantly impact the max
part size and result in more unmerged parts than expected.
While checking multiple production highly loaded setups it was discovered that
`max_over_time(vm_active_merges{type="storage/big}[1h]}"` rarely exceeds 2,
and `max_over_time(vm_active_merges{type="storage/small}[1h]}"` rarely exceeds 4.
The change in this commit limits the max value for concurrency accordingly.
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2022-06-07 15:02:55 +03:00
Roman Khavronenko
e9ee043879
lib/storage: make indexdb/tagFilters
cache size configurable ( #2667 )
...
The default size of `indexdb/tagFilters` now can be overridden via
`storage.cacheSizeIndexDBTagFilters` flag.
Please, be careful with changing default size since it may
lead to inefficient work of the vmstorage or OOM exceptions.
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2663
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: Nikolay <nik@victoriametrics.com>
2022-06-01 14:57:39 +03:00
Aliaksandr Valialkin
fedfc9e686
lib/storage: stop background merge when storage enters read-only mode
...
This should prevent from `no space left on device` errors when VictoriaMetrics
under-estimates the additional disk space needed for background merge.
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2603
2022-06-01 14:22:12 +03:00
Aliaksandr Valialkin
afced37c0b
all: add initial support for query tracing
...
See https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#query-tracing
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1403
2022-06-01 02:31:44 +03:00
Aliaksandr Valialkin
945e9fa8c4
lib/storage: make fmt
2022-05-31 12:42:48 +03:00
Aliaksandr Valialkin
727cc119b6
lib/storage: do not take into account series from the next day when match[]
filter is passed to /api/v1/status/tsdb
2022-05-31 12:42:48 +03:00
Aliaksandr Valialkin
38beb9fe04
lib/storage: add ability to change the indexdb rotation time offset with -retentionTimezoneOffset command-line flag
...
This is a follow-up for 0fbf59199a
See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2574
2022-05-25 16:07:14 +03:00
阳明
e4df648ea0
lib/storage: Remove the effect of time zone on next retention period ( #2568 ) ( #2574 )
2022-05-25 15:10:19 +03:00
Dmytro Kozlov
4f40dc9829
{vmbackup, vmbackup/snapshot}: fixed problem with snapshot backup in another snapshot folder ( #2535 )
...
* {vmbackup, vmbackup/snapshot}: validate snapshot name
* vmbackup/snapshot: added another checks
* backup/actions: added check that we ignore backup_complete.ignore file
* vmbackup: moved snapshot to lib directory
* lib/snapshot: added functions description
* lib/snapshot: fixed typo
* vmbackup: code cleanup
* wip
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-05-04 22:12:48 +03:00
Aliaksandr Valialkin
361b08c30e
lib/storage: leave the last sample per each discrete interval during the deduplicaton
...
This aligns better with staleness logic in Prometheus - https://prometheus.io/docs/prometheus/latest/querying/basics/#staleness
2022-05-02 21:59:31 +03:00
Artem Navoiev
11db05a4ff
lib/{storage,flagutil} - Add option for snapshot autoremoval ( #2487 )
...
* lib/{storage,flagutil} - Add option for snapshot autoremoval
- add prometheus-like duration as command flag
- add option to delete stale snapshots
- update duration.go flag to re-use own code
* wip
* lib/flagutil: re-use Duration.Set() call in NewDuration
* wip
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-05-02 11:24:12 +03:00
Aliaksandr Valialkin
81b7a31cb1
app/vmstorage: properly handle maxSeries
limit passed from vmselect to vmstorage
2022-04-12 11:19:07 +03:00
Aliaksandr Valialkin
cb319b15bb
lib/storage: increase the number of rawRowsShard shards on systems with more than 4 CPU cores
...
This should improve data ingestion scalability on systems with many CPU cores
2022-04-06 19:50:41 +03:00
Aliaksandr Valialkin
123a88bb65
lib/storage: reuse sync.WaitGroup objects
...
This reduces GC load by up to 10% according to memory profiling
2022-04-06 14:00:50 +03:00
Nikolay
4cf6219e07
lib/{storage,regexpcache}: replaces regexpCacheMap with LRU cache ( #2293 )
...
* lib/{storage,regexpcache}: replaces regexpCacheMap with LRU cache
It should decrease memory usage for regexp caching
with storing cacheEntry by pointer - golang map should be able to effectivly shrink it's size
original issue with this case - unexpected map grows and storage OOM
Apply suggestions from code review
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
Adds missing metrics for regexp cache and regexpPrefixes cache
* wip
* wip
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-03-26 12:57:27 +02:00
Aliaksandr Valialkin
b843f0e229
app/vmselect: add fine-grained limits for the number of returned/scanned time series for various APIs
2022-03-26 11:28:14 +02:00
Aliaksandr Valialkin
e35c9124b7
lib/storage: reduce the interval for checking for free disk space from 30 seconds to 1 second
...
This should reduce the probability of out of disk space panics when -storage.minFreeDiskSpaceBytes is set to low values.
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2305
2022-03-18 16:53:19 +02:00
Aliaksandr Valialkin
a6d65fc824
lib/storage: typo fix after e7831ae154
2022-03-18 16:53:19 +02:00
jduncan0000
e7831ae154
Fix for issue #2255 - matchTagFilters for positive empty-match filters ( #2304 )
...
* fix for issue 2255 - matchTagFilters for positive empty-match filters
* add example to comments
* formatting
* add test for positive empty match
* formatting
2022-03-18 13:08:54 +02:00
Aliaksandr Valialkin
191977b324
lib/storage: trashing -> thrashing typo in docs
...
This is a follow-up for 918ed5cb32
2022-03-16 13:28:29 +02:00
Aliaksandr Valialkin
b47f18f555
lib/{mergeset,storage}: tune compression levels for small blocks
...
This should reduce CPU usage spent on compression
2022-02-25 15:34:13 +02:00
Aliaksandr Valialkin
28b610db07
lib/storage: document why job-like and instance-like labels must be stored at mn.Tags[0] and mn.Tags[1]
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2244
2022-02-25 13:21:53 +02:00
Aliaksandr Valialkin
d1881fa582
lib/storage: add a comment to indexSearch.containsTimeRange() on why it allows false positives
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2239
2022-02-24 12:48:33 +02:00
Aliaksandr Valialkin
02a922b53f
lib/storage: properly handle series selector matching multiple metric names plus a negative filter
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2238
This is a follow-up for 00cbb099b6
2022-02-24 12:11:53 +02:00
Aliaksandr Valialkin
244c23ea2c
lib/workingsetcache: reduce the default cache rotation period from hour to 20 minutes
...
This should reduce memory usage under high time series churn rate
2022-02-23 13:42:27 +02:00
Aliaksandr Valialkin
fcaa0c5202
lib/storage: optimize /api/v1/status/tsdb
call by skipping all the artificially created tag entries at once
...
This is a follow-up for b71be42d90
2022-02-21 19:00:04 +02:00
Roman Khavronenko
bd7837d524
lib: allow to configure cache size by type ( #2206 )
...
* lib: allow to configure cache size by type
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1940
Signed-off-by: hagen1778 <roman@victoriametrics.com>
* Apply suggestions from code review
* wip
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-02-21 13:55:51 +02:00
Aliaksandr Valialkin
5260d7a954
lib/storage: typo fix after c3affb0c4f
2022-02-17 12:56:33 +02:00
Aliaksandr Valialkin
d9bdb42219
lib/storage: simplify code for searching for label values
...
This is a follow-up after 9dd191b27c
2022-02-17 12:39:14 +02:00
Aliaksandr Valialkin
2ebc3d21c3
lib/storage: properly skip composite tag entries when searching for tag names or tag values
...
This is a follow-up for b71be42d90
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2200
2022-02-16 23:02:18 +02:00
Aliaksandr Valialkin
63bc89dd81
lib/storage: document why tsid cache is reset before saving it to disk
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2205
2022-02-16 18:37:29 +02:00
Aliaksandr Valialkin
ee066aa0d5
lib/storage: use binary search instead of full scan for skipping artificial tags when searching for tag names or tag values
...
This should improve performance for /api/v1/labels and /api/v1/label/<label_name>/values
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2200
2022-02-16 18:17:27 +02:00