Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Memory improvements#161

Open
inqrphl wants to merge 23 commits into
sni:master from
inqrphl:memory-improvements
Open

Memory improvements #161
inqrphl wants to merge 23 commits into
sni:master from
inqrphl:memory-improvements

Conversation

@inqrphl

@inqrphl inqrphl commented Apr 29, 2026
edited
Loading

Copy link
Copy Markdown

Improvements for faster startup, smaller peak memory consumption and tracing

add option: MaxParallelPeerInitializations

Additional semaphore used during the peer initialization. Controls how many peers can do the initial table synchronization at the same time.

During startup with an lmd connected to many backends, the bandwidth is shared between all of them. In a bandwidth limited scenario, this leads to lmd trying to download all of them at once and parse them, due to low bandwidth. It is kept in a state where its doing a lot of things at once, possibly increasing peak memory consumption.

It is better to limit the backends being processed, so that their tables can be downloaded, parsed and put into in-memory rows quickly. This semaphore is only used during initialization

There is already another config option called MaxParallelPeerConnections, but that is peer specific. It controls how many connections that peer can make.

add option: JsonParsingLibrary

can be used to switch between rsync and simdjson-go .

Unsure if this will ultimately help at the end, the idea was that simdjson-go can help with its AVX2/AVX512 optimizations.

This may speed up parsing, or improve memory consumption, especially on server processors with AVX512 support / with multiple AVX512 units per core. Could not test it comprehensively, as my laptop does not support it.

The toggle is left there for further testing.

add struct: ObjectInitializationMetadata

used for keeping track of all table initializations of a peer. Than print out more detailed times for total fetch time, parse time, lock time, prep time, total rows, size, download speed etc.

Download speed may especially be important.

Add tests that directly parse livestatus query results.

Mainly used to check simdjson-go for now

Ahmet Oeztuerk added 14 commits April 29, 2026 13:11
mainly done for the improvements to garbage collector
https://go.dev/doc/go1.26#new-garbage-collector 
add a modified library with capacity limits for testing
peer keeps an *simdjson.ParsedJson pointer
add a pointer to peer in request, gets reused during initialization
NewResultSet is renamed to NewResultSetRjson
add NewResultSetSimdjson function, uses simdjson instead of Rjson
add some tests for simdjson parsing
tracks the table initialization metrics for all 11 tables, merges them as well
it is a sum of many requests and their stats. it does not have a single request.
leaving the request as is would be misleading
useful to switch between rjson and simdjson libraries without recompiling.
@inqrphl inqrphl marked this pull request as draft April 29, 2026 14:07

@inqrphl inqrphl left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked through non-code changes

inqrphl commented May 7, 2026
edited
Loading

Copy link
Copy Markdown
Author

I can rename the MaxParallelPeerInitializations to MaxParallelBackendInitializations to differentiate it better from MaxParallelPeerConnections if needed

@inqrphl inqrphl marked this pull request as ready for review May 7, 2026 15:18
@inqrphl inqrphl marked this pull request as draft May 7, 2026 15:37
JsonParsingLibrary is renamed to JSONParsingLibrary
@inqrphl inqrphl marked this pull request as ready for review May 7, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /