mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Implement a faster Discourse.cache
This is a bottom up rewrite of Discourse cache to support faster performance and a limited surface area. ActiveSupport::Cache::Store accepts many options we do not use, this partial implementation only picks the bits out that we do use and want to support. Additionally params are named which avoids typos such as "expires_at" vs "expires_in" This also moves a few spots in Discourse to use Discourse.cache over setex Performance of setex and Discourse.cache.write is similar.
This commit is contained in:
14
script/benchmarks/cache/bench.rb
vendored
14
script/benchmarks/cache/bench.rb
vendored
@ -79,3 +79,17 @@ end
|
||||
# redis get string marshal: 12789.2 i/s - same-ish: difference falls within error
|
||||
# Rails read cache string: 10486.4 i/s - 1.25x slower
|
||||
# Discourse read cache string: 10457.1 i/s - 1.26x slower
|
||||
#
|
||||
# After Cache re-write
|
||||
#
|
||||
# Comparison:
|
||||
# redis setex string: 13390.9 i/s
|
||||
# redis setex marshal string: 13202.0 i/s - same-ish: difference falls within error
|
||||
# Discourse cache string: 12406.5 i/s - same-ish: difference falls within error
|
||||
# Rails cache string: 12289.2 i/s - same-ish: difference falls within error
|
||||
#
|
||||
# Comparison:
|
||||
# redis get string: 13589.6 i/s
|
||||
# redis get string marshal: 13118.3 i/s - same-ish: difference falls within error
|
||||
# Rails read cache string: 12482.2 i/s - same-ish: difference falls within error
|
||||
# Discourse read cache string: 12296.8 i/s - same-ish: difference falls within error
|
||||
|
Reference in New Issue
Block a user