Re: Disk IO performance
| From: | Per Jessen | Date: | Mon, 29 Nov 2010 12:00:18 +0000 |
| Subject: | Re: Disk IO performance | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309743@lists.php.net to get a copy of this message | ||
Daniel Molina Wegener wrote:
> On Sunday 28 November 2010,
> Larry Garfield <larry@garfieldtech.com> wrote:
>
>> There are many things that everybody "knows" about optimizing PHP
>> code. One of them is that one of the most expensive parts of the
>> process is loading code off of disk and compiling it, which is why
>> opcode caches
>> are such a bit performance boost. The corollary to that, of course,
>> is that more files = more IO and therefore more of a performance hit.
>
> It depends on the implementation that PHP uses to open the file. For
> example on Linux and similar operating systems, PHP uses the mmap(2)
> function instead of read(2) or fread(2) functions, so it maps the
> complete file into memory, that is more faster than using partial file
> reads.
I doubt if a read(file,1Mb) and an mmap(file,1Mb) will be very
different. The file has got to be hauled in from disk regardless of
which function you choose.
--
Per Jessen, Zürich (2.6°C)