Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid excessive reallocation in row compressors #6638

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

akuzm
Copy link
Member

@akuzm akuzm commented Feb 12, 2024

Memory operations can add up to tens of percents of the total
compression CPU load. To reduce the need for them, reserve for the
expected array sizes when initializing the compressor.

Based on measurements in this issue: https://github.com/timescale/Support-Dev-Collab/issues/1498#issuecomment-1936607692

We don't have a dataset which reproduces it well in tsbench, but I think it's a safe change anyway: https://grafana.ops.savannah-dev.timescale.com/d/fasYic_4z/compare-akuzm?orgId=1&var-branch=All&var-run1=3238&var-run2=3239&var-threshold=0.02&var-use_historical_thresholds=true&var-threshold_expression=2.5%20%2A%20percentile_cont%280.90%29&var-exact_suite_version=true

Disable-check: force-changelog-file

@akuzm akuzm changed the title Compress mem Avoid excessive reallocation in row compressors Feb 12, 2024
Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fc0e41c) 80.04% compared to head (f79a392) 80.01%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6638      +/-   ##
==========================================
- Coverage   80.04%   80.01%   -0.03%     
==========================================
  Files         190      190              
  Lines       37179    37135      -44     
  Branches     9450     9433      -17     
==========================================
- Hits        29761    29715      -46     
- Misses       3003     3016      +13     
+ Partials     4415     4404      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akuzm akuzm marked this pull request as ready for review February 12, 2024 15:06
Copy link

@svenklemm, @erimatnor: please review this pull request.

Powered by pull-review

simple8brle_compressor_init(&compressor->bits_used_per_xor);
bit_array_init(&compressor->xors);
bit_array_init(&compressor->xors,
/* expected_bits = */ GLOBAL_MAX_ROWS_PER_COMPRESSION * 12);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wny 12 here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Typical value we observe for some data sets. I'll add a comment.

Copy link
Contributor

@nikkhils nikkhils left a comment

Choose a reason for hiding this comment

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

LGTM

Memory operations can add up to tens of percents of the total
compression CPU load. To reduce the need for them, reserve for the
expected array sizes when initializing the compressor.
@akuzm akuzm enabled auto-merge (squash) February 14, 2024 13:47
@akuzm akuzm merged commit e44e0ad into timescale:main Feb 14, 2024
46 of 47 checks passed
@akuzm akuzm deleted the compress-mem branch February 14, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants