Re: CGI output performance

From: Date: Sat, 19 May 2001 12:21:02 +0000
Subject: Re: CGI output performance
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-55881@lists.php.net to get a copy of this message
Did you check how using sendfile() instead of write() effects this benchmark? Andi At 10:22 AM 5/19/2001 +0200, Sascha Schumann wrote:
    Hi,
    while looking at the strace output of readfile() in a CGI
    context, I noticed that the CGI code (a) uses stdio and (b)
    that it only outputs chunks with a maximum size of 16KB.
    The effect is clearly visible (reproducible, both tests were
    run with a warmed-up cache):
    $ time ./php-mmap-fwrite ./script >/dev/null
    2.75user 0.47system 0:03.22elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (244391major+65minor)pagefaults 0swaps
    $ time ./php-mmap-write ./script >/dev/null
    0.03user 0.01system 0:00.04elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (284major+64minor)pagefaults 0swaps
    E.g. using write() is about 80 times faster on Linux than the
    limited fwrite() version.
    fwrite() was probably chosen because it is a standardized
    function and is expected to work everywhere.  So, what we
    would need to do is to add a check whether write() works on
    the system before using it.
    Are there any objections to such a change?
    - Sascha                                     Experience IRCG
      http://schumann.cx/                http://schumann.cx/ircg
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.dev (#55881) next »