FAQ
I made a test on my console (cmd.exe)
ENV: WinXP SP 3 all updates, PHP 5.2.6 / PHP 5.2.6 non thread safe (NTS)
Intel Celeron 2.4 GHz 1 GB DDR Ram

It showed that the non thread safe is faster than the thread safe version.


NTS

Benchmark Time Peak Memory Peak Memory (Real)
-------------------------------------------------------------------
./benchmarks\ackermann 1.744 428704 524288
./benchmarks\array 0.067 6583320 7340032
./benchmarks\array2 0.059 6589168 7340032
./benchmarks\array3 0.841 364848 524288
./benchmarks\fibonacci 3.622 77976 262144
./benchmarks\hash 0.150 3921712 4194304
./benchmarks\hash2 0.130 144912 262144
./benchmarks\heapsort 0.410 1639960 1835008
./benchmarks\mandel 1.445 83352 262144
./benchmarks\mandel2 1.716 80312 262144
./benchmarks\matrix 0.410 357432 524288
./benchmarks\nestedloop 0.742 80368 262144
./benchmarks\sieve 0.532 1403920 1572864
./benchmarks\simple 0.425 77768 262144
./benchmarks\simplecall 0.553 76656 262144
./benchmarks\simpleucall 0.881 77344 262144
./benchmarks\simpleudcall 1.188 77440 262144
./benchmarks\strcat 0.060 857848 1310720


TS

Benchmark Time Peak Memory Peak Memory (Real)
-------------------------------------------------------------------
./benchmarks\ackermann 2.406 674272 786432
./benchmarks\array 0.078 6583664 7340032
./benchmarks\array2 0.065 6591032 7340032
./benchmarks\array3 0.861 365352 524288
./benchmarks\fibonacci 4.835 77720 262144
./benchmarks\hash 0.234 3922136 4194304
./benchmarks\hash2 0.155 145416 262144
./benchmarks\heapsort 0.476 1640912 1835008
./benchmarks\mandel 1.531 84552 262144
./benchmarks\mandel2 1.849 80840 262144
./benchmarks\matrix 0.365 357984 524288
./benchmarks\nestedloop 0.811 80624 262144
./benchmarks\sieve 0.531 1404096 1572864
./benchmarks\simple 0.454 77736 262144
./benchmarks\simplecall 0.743 76472 262144
./benchmarks\simpleucall 1.285 77160 262144
./benchmarks\simpleudcall 1.545 77256 262144
./benchmarks\strcat 0.061 858000 1310720


with PHP6 the test failed

regards
Mario

Search Discussions

  • David Zülke at Jul 17, 2008 at 10:03 am

    Am 17.07.2008 um 11:36 schrieb Mario Brandt:

    I made a test on my console (cmd.exe)
    ENV: WinXP SP 3 all updates, PHP 5.2.6 / PHP 5.2.6 non thread safe
    (NTS)
    Intel Celeron 2.4 GHz 1 GB DDR Ram

    It showed that the non thread safe is faster than the thread safe
    version.
    And your point/question is...?



    David
  • Jochem Maas at Jul 17, 2008 at 10:25 am

    David Zülke schreef:
    Am 17.07.2008 um 11:36 schrieb Mario Brandt:
    I made a test on my console (cmd.exe)
    ENV: WinXP SP 3 all updates, PHP 5.2.6 / PHP 5.2.6 non thread safe (NTS)
    Intel Celeron 2.4 GHz 1 GB DDR Ram

    It showed that the non thread safe is faster than the thread safe
    version.
    And your point/question is...?
    hmmm. can't speak for Mario but reading this caused a few questions to
    pop up in my head.

    Im an average joe php'er trying to write secure and fast code,
    I am aware of threads and processes and the general issues but don't
    understand the gritty details of implementing reentrant [C] code (is that
    the right word??)

    I know that running php in a threaded env is a no-no due mostly to
    certain extension being [probably] not thread safe - an uncertainty factor
    not suitable for production, at least so I have been led to believe
    by comments made by core php devs. (is this [still] true?)

    now the question part ...

    a, what are the ramifications of having to run php without threading
    when we live in a world that's increasingly moving towards
    multi-core/multi- CPU systems?

    b, Is php not missing out here big time?

    d, Will threads ever become recommended in/for php?

    e, If threads become the norm, will php code have to be written
    differently to account for threads?

    f, are there things I can/should be doing to my [production]
    systems/software-stacks to leverage extra performance for my php
    code from CPUs with multiple cores (and/or machines with multiple
    CPUs)?

    g, am I worrying about nothing? :-)




    David
  • Scott MacVicar at Jul 17, 2008 at 10:31 am

    Jochem Maas wrote:
    David Zülke schreef:
    Am 17.07.2008 um 11:36 schrieb Mario Brandt:
    I made a test on my console (cmd.exe)
    ENV: WinXP SP 3 all updates, PHP 5.2.6 / PHP 5.2.6 non thread safe
    (NTS)
    Intel Celeron 2.4 GHz 1 GB DDR Ram

    It showed that the non thread safe is faster than the thread safe
    version.
    And your point/question is...?
    hmmm. can't speak for Mario but reading this caused a few questions to
    pop up in my head.

    Im an average joe php'er trying to write secure and fast code,
    I am aware of threads and processes and the general issues but don't
    understand the gritty details of implementing reentrant [C] code (is that
    the right word??)

    I know that running php in a threaded env is a no-no due mostly to
    certain extension being [probably] not thread safe - an uncertainty factor
    not suitable for production, at least so I have been led to believe
    by comments made by core php devs. (is this [still] true?)

    now the question part ...

    a, what are the ramifications of having to run php without threading
    when we live in a world that's increasingly moving towards
    multi-core/multi- CPU systems?
    If the web server is threaded you get crashes!
    b, Is php not missing out here big time?
    Nope, you can still execute multiple processes on different processors
    even if they aren't threaded.
    d, Will threads ever become recommended in/for php?
    This is to do with the way PHP is executed not to do with the code users
    create.
    e, If threads become the norm, will php code have to be written
    differently to account for threads?
    See Above.
    f, are there things I can/should be doing to my [production]
    systems/software-stacks to leverage extra performance for my php
    code from CPUs with multiple cores (and/or machines with multiple
    CPUs)?
    FastCGI is fine, each process can be executed on seperate CPUs.
    g, am I worrying about nothing? :-)
    Yes you're worring about nothing. It's to do with the environment that
    PHP is executed in. Apache and IIS on Windows are threaded by default so
    you need a threaded version of PHP or you'll get crashes.

    If you use FastCGI then the non-thread safe version is fine.


    David
    Scott
  • Stanislav Malyshev at Jul 17, 2008 at 3:41 pm
    Hi!
    a, what are the ramifications of having to run php without threading
    when we live in a world that's increasingly moving towards
    multi-core/multi- CPU systems?
    I'd say next to none, since multi-CPU systems are perfectly capable of
    running multiple processes and PHP lives in the context of the web
    server where multiple processes are just fine.
    b, Is php not missing out here big time?
    Not really, even though some cool stuff may be done, but that's probably
    outside standard threading model.
    d, Will threads ever become recommended in/for php?
    Unless some serious change happens, I don't see it likely. "Shared
    nothing" works not too bad.
    e, If threads become the norm, will php code have to be written
    differently to account for threads?
    too hypothetical for me :)
    f, are there things I can/should be doing to my [production]
    systems/software-stacks to leverage extra performance for my php
    code from CPUs with multiple cores (and/or machines with multiple
    CPUs)?
    Have Apache with bigger MaxClients? ;)
    --
    Stanislav Malyshev, Zend Software Architect
    stas@zend.com http://www.zend.com/
    (408)253-8829 MSN: stas@zend.com
  • Andi Gutmans at Jul 17, 2008 at 3:48 pm
    There are some things I mention in this blog entry re: why I think
    multi-process architecture is not a bad thing even with where CPUs are
    going:
    http://tinyurl.com/3eyfth

    This was obviously a heated discussion and I'd appreciate if you have
    flames/comments to send them to me directly and/or on the blog and not
    to this list. Just sending it though as it answers some of these
    concerns.

    Andi
    -----Original Message-----
    From: Stanislav Malyshev
    Sent: Thursday, July 17, 2008 8:42 AM
    To: Jochem Maas
    Cc: 'internals@lists.php.net'
    Subject: Re: [PHP-DEV] PHP vs PHP NTS benackmark (win32)

    Hi!
    a, what are the ramifications of having to run php without threading
    when we live in a world that's increasingly moving towards
    multi-core/multi- CPU systems?
    I'd say next to none, since multi-CPU systems are perfectly capable of
    running multiple processes and PHP lives in the context of the web
    server where multiple processes are just fine.
    b, Is php not missing out here big time?
    Not really, even though some cool stuff may be done, but that's
    probably
    outside standard threading model.
    d, Will threads ever become recommended in/for php?
    Unless some serious change happens, I don't see it likely. "Shared
    nothing" works not too bad.
    e, If threads become the norm, will php code have to be written
    differently to account for threads?
    too hypothetical for me :)
    f, are there things I can/should be doing to my [production]
    systems/software-stacks to leverage extra performance for my php
    code from CPUs with multiple cores (and/or machines with multiple
    CPUs)?
    Have Apache with bigger MaxClients? ;)
    --
    Stanislav Malyshev, Zend Software Architect
    stas@zend.com http://www.zend.com/
    (408)253-8829 MSN: stas@zend.com

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
  • Jochem Maas at Jul 17, 2008 at 5:41 pm
    Thank you everyone for you replies, apparently I know a little
    more than I thought in general and also a little more than this
    morning. :-)

    rgds,
    Jochem

    Andi Gutmans schreef:
    There are some things I mention in this blog entry re: why I think
    ...
  • Runar Olsen at Jul 17, 2008 at 10:11 am
    Hi,

    That should be correct as there is no time spent keeping internal
    variables thread safe.

    Mario Brandt skrev:
    I made a test on my console (cmd.exe)
    ENV: WinXP SP 3 all updates, PHP 5.2.6 / PHP 5.2.6 non thread safe (NTS)
    Intel Celeron 2.4 GHz 1 GB DDR Ram

    It showed that the non thread safe is faster than the thread safe version.


    NTS

    Benchmark Time Peak Memory Peak Memory (Real)
    -------------------------------------------------------------------
    ./benchmarks\ackermann 1.744 428704 524288
    ./benchmarks\array 0.067 6583320 7340032
    ./benchmarks\array2 0.059 6589168 7340032
    ./benchmarks\array3 0.841 364848 524288
    ./benchmarks\fibonacci 3.622 77976 262144
    ./benchmarks\hash 0.150 3921712 4194304
    ./benchmarks\hash2 0.130 144912 262144
    ./benchmarks\heapsort 0.410 1639960 1835008
    ./benchmarks\mandel 1.445 83352 262144
    ./benchmarks\mandel2 1.716 80312 262144
    ./benchmarks\matrix 0.410 357432 524288
    ./benchmarks\nestedloop 0.742 80368 262144
    ./benchmarks\sieve 0.532 1403920 1572864
    ./benchmarks\simple 0.425 77768 262144
    ./benchmarks\simplecall 0.553 76656 262144
    ./benchmarks\simpleucall 0.881 77344 262144
    ./benchmarks\simpleudcall 1.188 77440 262144
    ./benchmarks\strcat 0.060 857848 1310720


    TS

    Benchmark Time Peak Memory Peak Memory (Real)
    -------------------------------------------------------------------
    ./benchmarks\ackermann 2.406 674272 786432
    ./benchmarks\array 0.078 6583664 7340032
    ./benchmarks\array2 0.065 6591032 7340032
    ./benchmarks\array3 0.861 365352 524288
    ./benchmarks\fibonacci 4.835 77720 262144
    ./benchmarks\hash 0.234 3922136 4194304
    ./benchmarks\hash2 0.155 145416 262144
    ./benchmarks\heapsort 0.476 1640912 1835008
    ./benchmarks\mandel 1.531 84552 262144
    ./benchmarks\mandel2 1.849 80840 262144
    ./benchmarks\matrix 0.365 357984 524288
    ./benchmarks\nestedloop 0.811 80624 262144
    ./benchmarks\sieve 0.531 1404096 1572864
    ./benchmarks\simple 0.454 77736 262144
    ./benchmarks\simplecall 0.743 76472 262144
    ./benchmarks\simpleucall 1.285 77160 262144
    ./benchmarks\simpleudcall 1.545 77256 262144
    ./benchmarks\strcat 0.061 858000 1310720


    with PHP6 the test failed

    regards
    Mario
  • Pierre Joye at Jul 17, 2008 at 10:24 am
    hi,
    On Thu, Jul 17, 2008 at 11:36 AM, Mario Brandt wrote:
    I made a test on my console (cmd.exe)
    ENV: WinXP SP 3 all updates, PHP 5.2.6 / PHP 5.2.6 non thread safe (NTS)
    Intel Celeron 2.4 GHz 1 GB DDR Ram

    It showed that the non thread safe is faster than the thread safe version.
    It is expected and it is also why we provide TS and non TS builds for
    windows (fcgi usage).

    Cheers,

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedJul 17, '08 at 10:00a
activeJul 17, '08 at 5:41p
posts9
users8
websitephp.net

People

Translate

site design / logo © 2022 Grokbase