Bug 7879 - Memoize::Memcached two times slower than it should be
Summary: Memoize::Memcached two times slower than it should be
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: 3.6
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Dobrica Pavlinusic
QA Contact: Ian Walls
URL:
Keywords:
Depends on:
Blocks: 7119
  Show dependency treegraph
 
Reported: 2012-04-02 21:15 UTC by Dobrica Pavlinusic
Modified: 2017-06-14 22:10 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Memoize::Memcached 2x speedup (1.88 KB, patch)
2012-04-02 21:15 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Dobrica Pavlinusic 2012-04-02 21:15:16 UTC
Created attachment 8791 [details] [review]
Memoize::Memcached 2x speedup

While profiling Koha with memcached turned on I was stunned by NYTProf results:

Calls 	P 	F 	Exclus  Inclus  Subroutine
55	2	1	1.70s	1.70s	Memoize::Memcached::EXISTS
55	2	1	1.68s	1.68s	Memoize::Memcached::FETCH

Code analysts showed that it generates two FETCH requests for each item.

Attached patch fixes upstream module and might be beneficial on existing Koha installations which use memcached.

It uses shared variable, and it's safe in CGI installations.

Having shared variable showed another characteristic of current code: 

55	2	1	33.8ms	33.8ms	Memoize::Memcached::EXISTS
55	2	1	362µs	362µs	Memoize::Memcached::FETCH

This is good, but a little bit too fast. Examining hit and miss ratio stored in Koha::Persistant::stats it turns out that we are accessing memcache 106 times, but only 4 times for new values.
Comment 1 Jonathan Druart 2015-02-20 16:09:31 UTC
Dobrica, this is still valid? Where is the "discussion"?
Comment 2 Owen Leonard 2016-08-10 14:38:33 UTC
This report was made on a very old version of Koha and hasn't been updated since. I think we should consider it closed.
Comment 3 Jonathan Druart 2016-08-10 14:54:08 UTC
(In reply to Owen Leonard from comment #2)
> This report was made on a very old version of Koha and hasn't been updated
> since. I think we should consider it closed.

Bug 16770 removed this dependency.
Comment 4 Mason James 2016-08-11 01:53:35 UTC
(In reply to Owen Leonard from comment #2)
> This report was made on a very old version of Koha and hasn't been updated
> since. I think we should consider it closed.

fyi, this is still probably a valid issue for M::M (but, its not technically a Koha bug)

 http://search.cpan.org/~tcohen/Memoize-Memcached-0.04/lib/Memoize/Memcached.pm

i think this M::M bug may describe the problem?
 https://rt.cpan.org/Public/Bug/Display.html?id=112659