> > Hi Nick, Hi all > > Please have a look at the following lines copied from phpcacheadmin. i > noticed that a huge amount of memory was taken by phpaccelerator, so i > had a look at the files : there are three versions of one file still in > the cache ??? or am i missing something ... it would be waste of memory > right? Hi, This isn't really strange, but needs some explanation. What you have here is 3 different files being cached, and they haven't expired yet. It happens that they had the same path, and of course each one replaced the other but PHPA doesn't know that as it doesn't use file paths to identify files but instead the inode and device number. The inumber gives a hash into a table of entries in the shm cache and lookup is pretty efficient. An MD5 of the file path would have advantages, but would be slower, and after initial performance tests I rejected that. Cache entries have a time-to-live value, and if an entry isn't accessed in that time it will be removed the next time the cache stats are checked. If PHPA runs out of shm memory then it'll remove entries that are the oldest, one at a time, until the requested memory can be allocated. So, particularly if you don't get messages in the log saying that it's removing entries to free up space, what you saw is of no consequence. Whether the shared memory is used or unused makes no difference to your system. If you do end up with a significant amount of waste, then you could reduce the shm_ttl value such that unaccessed entries expire quicker, and you can set the ttl value in httpd.conf, giving different ttl values to different files. If you have files that 'by design' are changed frequently, then you should probably exclude them from being cached, either in the shm cache, or both the shm cache and file cache. Remember that everytime a file is changed, PHPA will run its optimiser, write a cache file, possibly free an existing shm entry (if the inumber on the source file hasn't changed), and cache an shm entry. If the file changes often then this overhead is probably better avoided. Another way to avoid old entries in the shm cache would be to overwrite a file to replace its contents rather than creating a new file. Whether that's possible depends on what your system is doing to create the files that you're caching. If PHPA spots an updated file it will replace any existing shm cache entry provided that the entry isn't in use. If it is in use, then it 'obsoletes' the existing entry, and caches a new version of the file. For a short time there'll be more than one version of what really is the same file (same inumber), but when the last active request completes for an obsoleted file, PHPA removes the old version. Hope that makes some sense :) nick ------------------------------------------------------------------------ www.php-accelerator.co.uk Home of the free PHP Accelerator To post, send email to phpa@xxxxxxxxxxxxx To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe