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: Enable compression by default for values > 1kB #31147

Merged
merged 1 commit into from Nov 14, 2017

Conversation

jeremy
Copy link
Member

@jeremy jeremy commented Nov 14, 2017

Compression has long been available, but opt-in and at a 16kB threshold.
It wasn't enabled by default due to CPU cost. Today it's cheap and
typical cache data is eminently compressible, such as HTML or JSON
fragments.

Compression dramatically reduces Memcached/Redis mem usage, which means
the same cache servers can store more data, which means higher hit
rates.

To disable compression, pass compress: false to the initializer.

@jeremy jeremy changed the title Cache: Enable compression by default for values > 1kB. Cache: Enable compression by default for values > 1kB Nov 14, 2017
@schneems
Copy link
Member

Looks like you’ve got conflicts.

Idea seems good. Any numbers you can share? This already being used across Basecamp?

Compression has long been available, but opt-in and at a 16kB threshold.
It wasn't enabled by default due to CPU cost. Today it's cheap and
typical cache data is eminently compressible, such as HTML or JSON
fragments.

Compression dramatically reduces Memcached/Redis mem usage, which means
the same cache servers can store more data, which means higher hit
rates.

To disable compression, pass `compress: false` to the initializer.
@jeremy jeremy force-pushed the cache-compression-by-default branch from c0e0b30 to c78ce4f Compare November 14, 2017 03:02
@jeremy
Copy link
Member Author

jeremy commented Nov 14, 2017

Yup, for months now. Great results alongside cache key recycling. Together, these are crucial for a well-behaved Redis cache. Clear highlights: large drop in cache network bandwidth; large increase in # of active cache entries. We will be sharing more along with Rails 5.2 release.

@jeremy jeremy added this to the 5.2.0 milestone Nov 14, 2017
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

3 participants