save to disk functionality

Justin Matlock jmat@shutdown.net
Sun, 2 Nov 2003 17:29:52 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C3A166.ECD11F50
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Here's something that would be quite useful for me; I don't know about =
anyone else -- but I can see how it would create some dramatic speed =
increases for most sites on a memcached restart...=20

How about adding "save to disk" functionality to memcached via a command =
line option?

When it gets hit by a certain signal (TERM?), it dumps the memory cache =
to a file specified on the command line.  When it starts up, it reads =
that cache file and repopulates itself (expiring out any data that =
expired during the 'downtime').

I've started experimenting with storing session data in memcached vs. =
using MySQL.  I've been able to dramatically speed up the site this way, =
but "Very Bad Things" happen to my logged in members if my memcached =
server is restarted. PHP has other distributed memory-based session =
handlers available (msession), but I've found memcached is about 60% =
faster (!).

As much as I would love to have memcached on it's own stable dedicated =
server, I just can't afford to do that yet -- so it runs on all of my =
webserver machines... there's something strange about my Apache =
2.0.47/SSL configuration that occasionally locks up the machine -- it =
zombie's httpd and refuses to let go of port 443, no matter what I do; I =
have to initiate a controlled restart.. having memcached be able to =
start back where it left off would be incredibly useful (and would speed =
other things up, as it wouldn't have to "rebuild" the cache from the =
database). =20

In the same vein, I suppose there could be a periodic "save to disk" =
function that will dump the memory cache every "x" minutes, just in case =
there is a system failure that prevents a normal shutdown.... (I'm just =
throwing that idea out -- it probably wouldn't be worth it -- I'd bet it =
would slow memcached down during normal operations).

Any thoughts?

Justin
------=_NextPart_000_0007_01C3A166.ECD11F50
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Here's something that would be quite =
useful for me;=20
I don't know about anyone else -- but I can see how it would create some =

dramatic speed increases for most sites on a memcached restart... =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How about adding "save to disk" =
functionality to=20
memcached via a command line option?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>When it gets hit by a certain signal =
(TERM?), it=20
dumps the memory cache to a file specified on the command line.&nbsp; =
When it=20
starts up, it reads that cache file&nbsp;and repopulates itself =
(expiring out=20
any data that expired during the 'downtime').</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I've started experimenting with storing =
session=20
data in memcached vs. using MySQL.&nbsp; I've been able to dramatically =
speed up=20
the site this way, but "Very Bad Things" happen to my logged in members =
if my=20
memcached server is restarted. PHP has other distributed memory-based =
session=20
handlers available (msession), but I've found memcached is about 60% =
faster=20
(!).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>As much as I would love to have =
memcached on it's=20
own stable dedicated server, I just can't afford to do that yet -- so it =
runs on=20
all of my webserver machines... there's something strange about my =
Apache=20
2.0.47/SSL configuration that occasionally locks up the machine -- it =
zombie's=20
httpd and refuses to let go of port 443, no matter what I do; I have to =
initiate=20
a controlled restart.. having memcached be able to start&nbsp;back =
where&nbsp;it=20
left off would be incredibly useful (and would speed other things up, as =
it=20
wouldn't have to "rebuild" the cache from the database).&nbsp; =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In the same vein, I suppose there could =
be a=20
periodic "save to disk" function that will dump the memory cache every =
"x"=20
minutes, just in case there is a system failure that prevents a normal=20
shutdown.... (I'm just throwing that idea out -- it probably wouldn't be =
worth=20
it -- I'd bet it would slow memcached down during normal=20
operations).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Any thoughts?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Justin</FONT></DIV></BODY></HTML>

------=_NextPart_000_0007_01C3A166.ECD11F50--