You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2015/07/02 10:59:07 UTC

[Bug 58091] New: mod_socache_memcache does not reuse memcache connections

https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

            Bug ID: 58091
           Summary: mod_socache_memcache does not reuse memcache
                    connections
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_socache_(dbm|dc|memcache|shmcb)
          Assignee: bugs@httpd.apache.org
          Reporter: valentin.vidic@carnet.hr

While trying to use memcache for SSL sessions

  SSLSessionCache memcache:127.0.0.1

I noticed the connection to the memcache server is not reused but dropped and
recreated on every request. This can be checked using tcpdump.

The cause of this behavior seems to be incorrect TTL setting in
mod_socache_memcache.c:

  #ifndef MC_DEFAULT_SERVER_TTL
  #define MC_DEFAULT_SERVER_TTL 600
  #endif

This is than used when creating memcache server:

        rv = apr_memcache_server_create(p,
                                        host_str, port,
                                        MC_DEFAULT_SERVER_MIN,
                                        MC_DEFAULT_SERVER_SMAX,
                                        thread_limit,
                                        MC_DEFAULT_SERVER_TTL,
                                        &st);

My guess is the author wanted a TTL of 600 seconds (10 minutes) which is
reasonable, but the problem is the units for this parameter are in microseconds
so the connection does not have a chance of reuse in next 600 microseconds.

Changing this constant to 600 * 1000 * 1000 restores the intended behavior of
caching the connection for 10 minutes.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

--- Comment #1 from Christophe JAILLET <ch...@wanadoo.fr> ---
Hi,

looks good to me.
See http://marc.info/?l=subversion-dev&m=139866123837158 for the same kind of
issue in svn.

Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

--- Comment #4 from Christophe JAILLET <ch...@wanadoo.fr> ---
Change of default value + new option to configure the TTL (MemcacheConnTTL)
proposed in r1696105


(In reply to Yann Ylavic from comment #2)
> The timeouts with the memcache have to be synced (a little lower here).

What do you mean? Can you elaborate?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

--- Comment #3 from Yann Ylavic <yl...@gmail.com> ---
I would also advocate a low (15/20 seconds) default (or at worse hard) timeout.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Christophe JAILLET <ch...@wanadoo.fr> ---
This is in 2.4.17

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

--- Comment #2 from Yann Ylavic <yl...@gmail.com> ---
The parameter would preferably be configurable, so that a close from the
memcache side (which may also have a timeout) does not produce an error.

The TTL is an idle timeout, active only when the connection is unused, hence
reset on each use.
There is also no mechanism to test the connection before reusing it in
mod_socache_memcache, unlike in mod_proxy.
The timeouts with the memcache have to be synced (a little lower here).

The current code inhibited that potential error.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

Valentin Vidic <va...@carnet.hr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |valentin.vidic@carnet.hr

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 58091] mod_socache_memcache does not reuse memcache connections

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58091

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk

--- Comment #5 from Christophe JAILLET <ch...@wanadoo.fr> ---
Proposed for backport in r1696139

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org