From: Dan F. <dfr...@cs...> - 2005-05-03 14:07:52
|
Folks, I have a question for experienced PHP developers. There is a lot of information I can imagine wanting to cache across sessions in PHP. For example in WikiLens, a ratings database, or per-item statistics (# ratings, averages, etc). This is stuff that will fit in-memory for the forseeable future. What's the best way to do that in PHP? I've looked at a couple of PEAR modules (e.g., "Cache" included in PhpWiki), and they seem to be file-based. This is astonishing to me. Clearly memory can be 1000 times faster than disk (although there are usually memory-based disk caches, too). Is it really best to use file-based caches? I thought about writing a shared memory-based cache, and a colleague warned me away from it, saying shared memory access in PHP is iffy. Thoughts? Dan |
From: Charles C. <ch...@ru...> - 2005-05-03 14:43:58
|
Dan, My understanding is that, to avoid potential memory (and other resource) leaks taking down the webserver, there has been a conscious design decision to implement php as not keeping any memory context between http requests. I understand that there are ways around this but they are not straightforward. Regards, Charles > -----Original Message----- > From: Dan Frankowski [mailto:dfr...@cs...] > Sent: 03 May 2005 22:08 > To: 'php...@li...' > Subject: [Phpwiki-talk] PHP persistent caching > > Folks, > > I have a question for experienced PHP developers. There is a lot of > information I can imagine wanting to cache across sessions in PHP. For > example in WikiLens, a ratings database, or per-item statistics (# > ratings, averages, etc). This is stuff that will fit in-memory for the > forseeable future. > > What's the best way to do that in PHP? I've looked at a couple of PEAR > modules (e.g., "Cache" included in PhpWiki), and they seem to be > file-based. This is astonishing to me. Clearly memory can be 1000 times > faster than disk (although there are usually memory-based disk caches, > too). Is it really best to use file-based caches? I thought about > writing a shared memory-based cache, and a colleague warned me away from > it, saying shared memory access in PHP is iffy. > > Thoughts? > > Dan |
From: Dan F. <dfr...@cs...> - 2005-05-03 15:32:56
|
Charles, Thanks for your thoughts. My first thought would be to use a shared memory segment. See http://us4.php.net/shmop. Memory leaks are an issue, but not a show-stopper. One has to program well and be careful to get a high-performing system. Dan Charles Corrigan wrote: >Dan, > >My understanding is that, to avoid potential memory (and other resource) leaks taking down the webserver, there has been a conscious >design decision to implement php as not keeping any memory context between http requests. I understand that there are ways around >this but they are not straightforward. > >Regards, >Charles > > > >>-----Original Message----- >>From: Dan Frankowski [mailto:dfr...@cs...] >>Sent: 03 May 2005 22:08 >>To: 'php...@li...' >>Subject: [Phpwiki-talk] PHP persistent caching >> >>Folks, >> >>I have a question for experienced PHP developers. There is a lot of >>information I can imagine wanting to cache across sessions in PHP. For >>example in WikiLens, a ratings database, or per-item statistics (# >>ratings, averages, etc). This is stuff that will fit in-memory for the >>forseeable future. >> >>What's the best way to do that in PHP? I've looked at a couple of PEAR >>modules (e.g., "Cache" included in PhpWiki), and they seem to be >>file-based. This is astonishing to me. Clearly memory can be 1000 times >>faster than disk (although there are usually memory-based disk caches, >>too). Is it really best to use file-based caches? I thought about >>writing a shared memory-based cache, and a colleague warned me away from >>it, saying shared memory access in PHP is iffy. >> >>Thoughts? >> >>Dan >> >> > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: NEC IT Guy Games. >Get your fingers limbered up and give it your best shot. 4 great events, 4 >opportunities to win big! Highest score wins.NEC IT Guy Games. Play to >win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 >_______________________________________________ >Phpwiki-talk mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phpwiki-talk > > |
From: Joby W. <joby@u.washington.edu> - 2005-05-03 16:03:42
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 You can also use a file based cache on tmpfs. The link below is a great article on the basics of using tmpfs. http://www-106.ibm.com/developerworks/library/l-fs3.html You could even put an SQLite database on tmpfs, to get better performance. Joby Walker ITI SSG, University of Washington - -- PGP key: https://staff.washington.edu/joby/joby-u-pub.asc Dan Frankowski wrote: > Folks, > > I have a question for experienced PHP developers. There is a lot of > information I can imagine wanting to cache across sessions in PHP. For > example in WikiLens, a ratings database, or per-item statistics (# > ratings, averages, etc). This is stuff that will fit in-memory for the > forseeable future. > > What's the best way to do that in PHP? I've looked at a couple of PEAR > modules (e.g., "Cache" included in PhpWiki), and they seem to be > file-based. This is astonishing to me. Clearly memory can be 1000 times > faster than disk (although there are usually memory-based disk caches, > too). Is it really best to use file-based caches? I thought about > writing a shared memory-based cache, and a colleague warned me away from > it, saying shared memory access in PHP is iffy. > > Thoughts? > > Dan > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwiki-talk -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCd6DRgA0gpghkf88RAt2bAKDCNZqcu72yeUuNd2i1+KSNX6r9EACdEsgC 0u68wnvtQJnpI1eqCJ7pSwM= =deOK -----END PGP SIGNATURE----- |
From: Reini U. <ru...@x-...> - 2005-05-04 05:31:10
|
Dan Frankowski schrieb: > I have a question for experienced PHP developers. There is a lot of > information I can imagine wanting to cache across sessions in PHP. For > example in WikiLens, a ratings database, or per-item statistics (# > ratings, averages, etc). This is stuff that will fit in-memory for the > forseeable future. > > What's the best way to do that in PHP? I've looked at a couple of PEAR > modules (e.g., "Cache" included in PhpWiki), and they seem to be > file-based. This is astonishing to me. Clearly memory can be 1000 times > faster than disk (although there are usually memory-based disk caches, > too). Is it really best to use file-based caches? I thought about > writing a shared memory-based cache, and a colleague warned me away from > it, saying shared memory access in PHP is iffy. > > Thoughts? Are you aware about our max-size limitation of sessions how we are using them? If this could be solved we could put much more into regular sessions and wouldn't need external libs, such as http://www.phpclasses.org/browse/package/439.html I'm running a stable windows server with Turck MMCache for some time now using shmem for the internal bytecode. http://www.apachefriends.org/en/xampp.html -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ http://phpwiki.org/ |
From: Dan F. <dfr...@cs...> - 2005-05-09 15:13:01
|
Reini Urban wrote: > Dan Frankowski schrieb: > >> I have a question for experienced PHP developers. There is a lot of >> information I can imagine wanting to cache across sessions in PHP. >> For example in WikiLens, a ratings database, or per-item statistics >> (# ratings, averages, etc). This is stuff that will fit in-memory for >> the forseeable future. >> >> What's the best way to do that in PHP? I've looked at a couple of >> PEAR modules (e.g., "Cache" included in PhpWiki), and they seem to be >> file-based. This is astonishing to me. Clearly memory can be 1000 >> times faster than disk (although there are usually memory-based disk >> caches, too). Is it really best to use file-based caches? I thought >> about writing a shared memory-based cache, and a colleague warned me >> away from it, saying shared memory access in PHP is iffy. >> >> Thoughts? > > > Are you aware about our max-size limitation of sessions > how we are using them? No, I don't know about this. > If this could be solved we could put much more into regular sessions > and wouldn't need external libs, such as > http://www.phpclasses.org/browse/package/439.html Thanks for the ref! This looks like a useful package. Note that I don't think stuffing the ratings DB (or stats like # rats or avg item rating) into each user session will help me. I want it cached *across* user sessions, so each user isn't burdened with re-reading, re-calculating. I plan to try the shmem thing. > I'm running a stable windows server with Turck MMCache for some time > now using shmem for the internal bytecode. > http://www.apachefriends.org/en/xampp.html Cool, thanks. Dan |