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

Cache compression #234

Merged
merged 1 commit into from
Aug 23, 2019
Merged

Conversation

mrowqa
Copy link
Contributor

@mrowqa mrowqa commented Jul 31, 2019

Based on #223. Some initial implementation of compression for cache system.

Things to discuss:

  • configuring compression level - I have temporarily added command line option for it, but it looks like too many details. It'd be probably better to have some performance presets for wasmtime (mentioned in Relocation of memory.grow and memory.size #199),
  • compression algorithm, currently using zstd
    • I preferred using official implementation with Rust bindings rather than some custom implementation; currently we require cmake and clang anyway, but we will probably want to not depend on them in future,
    • I did a quick research on different algorithms and other good choice could be lzma2. Anyway, it's hard to compare usage of specific algorithms without good benchmarks on our specific use case. I just do some quick test runs for having an approximated comparison.

@mrowqa
Copy link
Contributor Author

mrowqa commented Jul 31, 2019

Some perf runs:

With such comparisons it'd be nicer to have some chart. Anyway, looking at bigger files:

  • start without cache: lvl=3;5 not noticeable, lvl=10 very little overhead, lvl=20 big overhead
  • start with cache: lvl=3;5 visible overhead, but still not that big, lvl=10 visible improvement to previous one, still slower than no compression, lvl=20 again, visible improvement to previous level, still slower than without cache (note: the cache were probably read from OS filesystem cache; "hot buffer" in terminology of databases)
  • compression ratio: more or less 10% +-5%, each tested level introduced noticeable improvements. Cache without compression has low-mid entropy (what felt strange at first glance since usually code has high entropy).

@mrowqa
Copy link
Contributor Author

mrowqa commented Aug 10, 2019

Rebased onto #230. I haven't removed the config option for compression level, but we'll do it soon anyway, when working on the cache daemon.

@mrowqa mrowqa marked this pull request as ready for review August 20, 2019 00:09
@mrowqa mrowqa mentioned this pull request Aug 22, 2019
Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

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

Looks good!

@sunfishcode sunfishcode merged commit 479592f into bytecodealliance:master Aug 23, 2019
@mrowqa mrowqa deleted the cache-compression branch August 23, 2019 23:39
grishasobol pushed a commit to grishasobol/wasmtime that referenced this pull request Nov 29, 2021
…ecodealliance#234)

This sort of conversion is useful for extracting custom error types from the
runtime when the error type is not Clone. Even when it is, it's more
efficient to unwrap it that to clone it.
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.

None yet

2 participants