Re: limit for mmaping for readfile (Bug #19749)
| From: | Wez Furlong | Date: | Wed, 21 Apr 2004 11:10:33 +0000 |
| Subject: | Re: limit for mmaping for readfile (Bug #19749) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9457@lists.php.net to get a copy of this message | ||
Andi,
Do you think mmap'ing a series of smaller chunks is going to be
faster than mmap'ing the whole file, or faster than reading
chunks conventionally? (just asking; I've not done any tests)
The mmap code in the passthru function will fall back on reading
chunks in a loop if the mmap failed. The proposed mmap limit
really just a runaway brake to avoid the box swapping to death
if, say, 5 people start downloading 5 .iso images through a PHP
script using readfile().
My patch is "nice" at this stage in the release because it is a
minimal change that can't hurt anything; tweaking the passthru
code is a bit more worrying :/
--Wez.
----- Original Message -----
From: "Andi Gutmans" <andi@zend.com>
To: "Wez Furlong" <wez@thebrainroom.com>; <internals@lists.php.net>
Sent: Wednesday, April 21, 2004 10:52 AM
Subject: Re: [PHP-DEV] limit for mmaping for readfile (Bug #19749)
> Wez,
>
> I have played with mmap() in the past. I found that mapping in relatively
> small blocks such as 1MB does not really hurt performance. I suggest not
to
> add yet another INI option but to do it with smaller blocks. I think even
> 256KB wouldn't make a big difference.
>
> Andi
>
> At 10:10 PM 4/20/2004 +0100, Wez Furlong wrote:
> >http://bugs.php.net/bug.php?id=19749
> >
> >It's been playing on my mind recently that this bug
> >hasn't been addressed; the problem was how to guess
> >precisely what limit to set for mmaping when doing
> >something like readfile().
> >[note that some comments are missing from the bugdb
> >for that bug]
> >
> >Well, we can solve the problem by allowing the
> >sysadmin to decide, as you can see in my patch
> >against PHP 5:
> >
> >http://www.php.net/~wez/mmap-limit.diff
> >
> >The default limit is 8MB. If the limit is set to 0,
> >no limit is applied.
> >
> >This is separate from memory_limit, so PHP could
> >potentially use double the default memory amount for a
> >short period of time. This is still better than allowing
> >it to eat all the RAM when someone decides to readfile()
> >large media files for example.
> >
> >--Wez.
> >
> >--
> >PHP Internals - PHP Runtime Development Mailing List
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>