Re: PHP and Linux performance tweaks
| From: | Richard Lynch | Date: | Thu, 15 Nov 2001 00:50:34 +0000 |
| Subject: | Re: PHP and Linux performance tweaks | ||
| References: | 1 2 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-4957@lists.php.net to get a copy of this message | ||
Rasmus Lerdorf wrote:
>> I have read that one performance tweak for Linux is to mount the
>> filesystem with the "noatime" option (meaning the kernel does not update
>> the timestamp whenever files are accessed).
>>
>> The site relies highly on PHP sessions, and it seems to me that there
>> would be trouble with the /tmp/ session files if I configure Linux to
>> mount the filesystem with the "noatime" option. As I understand it, the
>> PHP session mechanism runs a "stat" operation every time it evaluates
>> whether to delete session files. This being the case, I guess the logical
> But yes, if you use the standard "files" save_handler on a filesystem that
> does not set the atime it will not work. You can see that for yourself in
> the ext/session/mod_files.c file in the ps_files_cleanup_dir() function:
>
> /* check whether its last access was more than maxlifet
> ago */ if (VCWD_STAT(buf, &sbuf) == 0 &&
> (now - sbuf.st_atime) > maxlifetime) {
Musings from a naive user who really doesn't know $#!^ about what he's
saying :-)
Like, if you changed that to sbuf.st_mtime or whatever checks the
*MODIFIED* time of the file, it would work more or less okay, no?...
I mean, assuming your application actually *CHANGES* session variables with
some reasonable degree of frequency...
Then old files will get cleaned up when they haven't been *ALTERED* in a
long time, rather than accessed, but that should work reasonably well for
most cases, I should think...
Try this at your own risk...
> VCWD_UNLINK(buf);
> nrdels++;
> }
>
> Of course, you could set the gc to 0 and do your own garbage collection on
> your session files by some other criteria. Not quite sure how you would
> determine old and non-active sessions without an atime though.
--
Like music? http://l-i-e.com/artists.htm