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

@schneems schneems commented Nov 14, 2017

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 jeremy:cache-compression-by-default branch to c78ce4f Nov 14, 2017
@jeremy
Copy link
Member Author

@jeremy 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
@jeremy jeremy merged commit ed10016 into rails:master Nov 14, 2017
2 checks passed
2 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jeremy jeremy deleted the jeremy:cache-compression-by-default branch Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.