app/vlinsert/insertutil: optimize LogMessageProcessor#1021
Merged
Conversation
vadimalekseev
commented
Jan 17, 2026
Before this change, the logMessageProcessor incremented two global atomics for each inserted row, causing high contention and bottlenecking throughput on multi-core systems. This commit switches to per-flush atomic updates, significantly reducing the overhead.
40730a1 to
d54f03a
Compare
func25
reviewed
Jan 23, 2026
valyala
reviewed
Feb 5, 2026
Signed-off-by: Aliaksandr Valialkin <valyala@gmail.com>
…orage
The Storage.getPartitions() returns active partitions with the incremented reference counts.
The Storage.putPartitions() decrements reference counts on the given partitions.
Use these helpers instead of for { ... } loops across multiple paces.
This improves code radability and maintainability a bit.
…ns by passing partition_prefix to /internal/partition/snapshot/create endpoint This functionality is useful for bulk creation of snapshots for multiple per-day partitions. For example, partition_prefix=202601 creates snapshots for all the per-day partitions on January 2026. Use `partition_prefix` argument instead of `name` argument for the `/internal/partition/snapshot/create` endpoint in order to be consistent with `/internal/force_merge`. Support for the `name` argument for backwards compatibility. The /internal/partition/snapshot/create returns JSON-encoded list of paths to created snapshots now instead of a JSON string with a path to a single created snapshot.
…deletion of snapshots older than the given age While at it, implement /internal/partition/snapshot/delete_stale?max_age=<d> endpoint for deleting snapshots older than the given max_age=<d>. For example, max_age=1d removes snapshots older than one day. Updates #829 Thanks to @withlin for the initial implementation at #975
…shotMaxAge -> -snapshotsMaxAge
… the commit 0e142e4 There are docs.victoriametrics.com urls in the wild, which start with /VictoriaLogs/ . These urls lead to 404 pages now. For example, https://docs.victoriametrics.com/VictoriaLogs/FAQ.html#how-does-victorialogs-work and https://docs.victoriametrics.com/VictoriaLogs/keyConcepts.html#stream-fields . Fix it by returning back alases for such pages. Updates VictoriaMetrics/VictoriaMetrics#8602
…dd(1) + sync.WaitGroup.Done() This improves code readability a bit.
….1-0.20260119142925-34f242a6b861 to v1.134.1-0.20260126232947-e35a9a366c8a
- Reduce the number of arguments and return values at the recursive appendLogFields() function from 8 to 2. - Reduce the number of arguments and return values at the appendLogField() function at hot path from 7 to 3. This increases JSON parsing performance by ~10% according to the BenchmarkJSONParserParseLogMessage.
…a map. This optimizes the performance of LogRows.MustAdd() by ~10% when len(LogRows.streamFields) < 16 (typical scenario). In this case linear scan over a slice of strings is faster than map access. Thanks to @vadimalekseev for the suggestion at #1029 (comment)
…llisions (#1007) Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
…s parsing (#1003) Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
…rtificates reloading (#999) Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
Signed-off-by: cancaicai <2356672992@qq.com> Signed-off-by: Cancai Cai <77189278+caicancai@users.noreply.github.com>
…...)` The offset must be subtracted from the _time (or from any other field) instead of adding it, in order to be consistent with the offset at day_range() and week_range() functions. This also properly aligns buckets returned from /select/logsql/hits ant /select/logsql/stats_query_range endpoints when the `offset` query arg is passed to them. See #1066 (comment)
- Remove the duplicate entry in the docs/victorialogs/CHANGELOG.md - Add a reference from the docs for ipv4_range to the docs for ipv6_range in the `see also` section, so users could discover the related function. - Remove irrelevant links from the `see also` sections for ipv4_range and ipv6_range filters. - Use the proper ordering for imports at lib/logstorage/filter_ipv6_range.go : - Standard Go packages go first - Then the group for improting external pakages - Then the group for the packages in the current module - Allow searching for ipv4 addresses with ipv6_range() filter, since ipv4 addresses can be represented as ipv6 addresses ffff:ipv4. - Simplify the code for tryParseIPv6CIDR() a bit. - Add tests for tryParseIPv4CIDR() and tryParseIPv6CIDR(). Updates #84 Updates #1049
Signed-off-by: Yury Moladau <yurymolodov@gmail.com> Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Roman Khavronenko <roman@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
…eserve newlines (#1041) Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
….1-0.20260126232947-e35a9a366c8a to v1.135.1-0.20260204143121-09d2ce36e86d This is needed for reducing memory usage at #1042 The original commit, which should reduce memory usage, is VictoriaMetrics/VictoriaMetrics@09d2ce3
Signed-off-by: Phuong Le <39565248+func25@users.noreply.github.com> Co-authored-by: Phuong Le <39565248+func25@users.noreply.github.com>
…es (#1045) Signed-off-by: Aliaksandr Valialkin <valyala@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
the code is simplified according to the suggestion from @vadimalekseev at #1045 Updates #1044
… of identical log entries into LogRows Thanks to @vadimalekseev for the pointer at https://github.com/VictoriaMetrics/VictoriaLogs/pull/1021/changes#r2700991513
valyala
approved these changes
Feb 5, 2026
Contributor
|
@vadimalekseev , thank you for the performance improvement! |
There was a problem hiding this comment.
5 issues found across 192 files (changes from recent commits).
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="app/vmui/packages/vmui/src/components/Configurators/QueryEditor/LogsQL/parser.ts">
<violation number="1">
P2: Operator detection now uses the untrimmed part, so tokens like `AND ` or `OR ` (which include the trailing space added during splitting) won’t match and will be misclassified as filters. Trim before checking operators to preserve correct parsing.</violation>
</file>
<file name="app/vlagent/kubernetescollector/file_collector.go">
<violation number="1">
P2: Close the opened file before returning on fingerprint mismatch to avoid leaking file descriptors.</violation>
</file>
<file name="app/vmui/packages/vmui/src/components/Configurators/QueryEditor/LogsQL/utils.ts">
<violation number="1">
P2: The cursor/selection start is always shifted by the comment delta even when the insertion happens after the cursor (e.g., cursor in leading indentation). This makes the caret jump unexpectedly and misplaces the selection. Adjust deltaStart based on whether the cursor is after the insertion point.</violation>
</file>
<file name="app/vmui/packages/vmui/src/pages/OverviewPage/OverviewHits/OverviewHits.tsx">
<violation number="1">
P2: barsCount is used inside the effect but missing from the dependency array, so updates to barsCount won’t refresh the fetched data.</violation>
</file>
<file name="app/vmui/packages/vmui/src/components/Main/ShortcutKeys/ShortcutKeys.tsx">
<violation number="1">
P2: `withHotkey` disables the shortcut, but the tooltip always advertises the F1 hotkey. Consider hiding the shortcut label when `withHotkey` is false to avoid misleading users.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
|
FYI, this pull request has been included in VictoriaLogs v1.45.0. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
Before this change, the
logMessageProcessorincremented two global atomics for each inserted row, causing high contention and bottlenecking throughput on multi-core systems. This commit switches to per-flush atomic updates, significantly reducing the overhead.Checklist
The following checks are mandatory: