Bug 7879

Summary: Memoize::Memcached two times slower than it should be
Product: Koha Reporter: Dobrica Pavlinusic <dpavlin>
Component: Architecture, internals, and plumbingAssignee: Dobrica Pavlinusic <dpavlin>
Status: CLOSED INVALID QA Contact: Ian Walls <koha.sekjal>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, mtj
Version: 3.6   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16770
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 7119    
Attachments: Memoize::Memcached 2x speedup

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