Add LocalCache support for read_multi #306

Merged
merged 6 commits into from Dec 14, 2012

Conversation

Projects
None yet
2 participants
Contributor

chendo commented Dec 13, 2012

This PR gives read_multi the ability to read from and write to the LocalStore if one exists. This will allow DalliStore to handle prefetching.

I've also added a few benchmarks around LocalCache stuff (can remove from this PR if you want), as well as a basic read/write test on LocalCache to make sure I didn't break anything (can also remove if you want).

Benchmarks:

Testing 2.6.0 with ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
Found memcached 1.4.5 in PATH

# Memcache on local machine (avg 0.150ms)
# Without LocalCache support:
                                           user     system      total        real
mixed:rails:dalli                       1.410000   0.580000   1.990000 (  2.839741)
mixed:rails-localcache:dalli            1.330000   0.450000   1.780000 (  2.486433)
read_multi_big:rails:dalli              2.950000   0.850000   3.800000 (  4.372583)
read_multi_big:rails-localcache:dalli   3.000000   0.830000   3.830000 (  4.395815)

# With LocalCache support:
                                            user     system      total        real
mixed:rails:dalli                       1.390000   0.570000   1.960000 (  2.820537)
mixed:rails-localcache:dalli            1.320000   0.470000   1.790000 (  2.492305)
read_multi_big:rails:dalli              3.220000   0.920000   4.140000 (  4.703577)
read_multi_big:rails-localcache:dalli   1.870000   0.440000   2.310000 (  2.557784)


# Memcache on another machine on LAN (avg 0.859ms)
# Without LocalCache support:
                                            user     system      total        real
mixed:rails:dalli                       1.740000   0.830000   2.570000 ( 13.266845)
mixed:rails-localcache:dalli            1.580000   0.660000   2.240000 ( 11.157188)
read_multi_big:rails:dalli              3.260000   1.050000   4.310000 ( 14.746469)
read_multi_big:rails-localcache:dalli   3.270000   1.020000   4.290000 ( 14.919345)

# With LocalCache support:
                                            user     system      total        real
mixed:rails:dalli                       1.710000   0.830000   2.540000 ( 13.093916)
mixed:rails-localcache:dalli            1.580000   0.670000   2.250000 ( 11.187527)
read_multi_big:rails:dalli              3.250000   1.030000   4.280000 ( 14.982752)
read_multi_big:rails-localcache:dalli   1.870000   0.500000   2.370000 (  7.299156)

Let me know if I'm missing anything!

Collaborator

mperham commented Dec 14, 2012

This is top notch stuff, thanks @chendo.

Collaborator

mperham commented Dec 14, 2012

Changelog?

Contributor

chendo commented Dec 14, 2012

Ah whoops, I forgot about that. Will update.

mperham merged commit 179fc64 into petergoldstein:master Dec 14, 2012

1 check passed

default The Travis build passed
Details
Contributor

chendo commented Dec 14, 2012

Do you still want me to add a changelog in a new PR? Was at work

Contributor

chendo commented Dec 14, 2012

Ah nevermind, see that you added it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment