Discussion:
PHP perfomance on SPARC vs I386
Martijn de Munnik
2010-12-09 12:53:15 UTC
Permalink
Hi,

We are migrating our webhosting platform from Solaris on I386 to OpenSolaris on SPARC. It seems our website work a lot faster on the I386 platform than on the SPARC platform. PHP seems to be the bottleneck and we believe it has something to do with the performance of PHP arrays. Our test script takes about 1.5s on I386 and about 4.5s on SPARC. The i386 is a Sun Fire V20z server, the SPARC is a Sun T5120 server. The test script is:

<?php
function getmicrotime($time)
{
list($usec,$sec)=explode(" ",$time);
return ((float)$usec+(float)$sec);
}

$start=microtime();
$a=array();
for($i=0; $i<1000000;$i++) {
$a[] = $i;
}
$end=microtime();

$tijd=getmicrotime($end)-getmicrotime($start);
echo 'Duur van het uitvoeren: '.number_format($tijd*1000,5,',','.').' ms'.PHP_EOL;

$start=microtime();
foreach ($a as $i)
{
}
$end=microtime();

$tijd=getmicrotime($end)-getmicrotime($start);
echo 'Duur van het uitvoeren: '.number_format($tijd*1000,5,',','.').' ms'.PHP_EOL;
?>

I both used the PHP 5.2 from pkg.opensolaris.org and compiled my own version of PHP 5.3. Almost identical results.

Any ideas?
--
This message posted from opensolaris.org
Peter Tribble
2010-12-09 13:17:58 UTC
Permalink
Post by Martijn de Munnik
Hi,
We are migrating our webhosting platform from Solaris on I386 to OpenSolaris on SPARC. It seems our website work a lot faster on the I386 platform than on the SPARC platform. PHP seems to be the bottleneck and we believe it has something to do with the performance of PHP arrays. Our test script takes about 1.5s on I386 and about 4.5s on SPARC. The i386 is a Sun Fire V20z server, the SPARC is a Sun T5120 server.
...
Post by Martijn de Munnik
Any ideas?
That's pretty much what you would expect. Essentially any x64 cpu will
be way faster than a T5120. If you're interested in straight speed, then
the x64 is a much better choice. If you have a workload where you expect
to be doing massive amounts of work in parallel, then the T5120 can give
better throughput (although current Intel and AMD cpus can beat a T5120
in throughput as well, as the T5120 is a pretty old box now).
--
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/
Jaime Cardoso
2010-12-09 13:21:35 UTC
Permalink
Empirically, your numbers should be right (meaning, they are what I
would expect but, don't have time to look at your script right now)

Can you put about 500 of those scripts running in paralell and see how
both architectures hold up?
Then, add SSL to your web server and check again.
--
JaimeC
Post by Martijn de Munnik
Hi,
<?php
function getmicrotime($time)
{
list($usec,$sec)=explode(" ",$time);
return ((float)$usec+(float)$sec);
}
$start=microtime();
$a=array();
for($i=0; $i<1000000;$i++) {
$a[] = $i;
}
$end=microtime();
$tijd=getmicrotime($end)-getmicrotime($start);
echo 'Duur van het uitvoeren: '.number_format($tijd*1000,5,',','.').' ms'.PHP_EOL;
$start=microtime();
foreach ($a as $i)
{
}
$end=microtime();
$tijd=getmicrotime($end)-getmicrotime($start);
echo 'Duur van het uitvoeren: '.number_format($tijd*1000,5,',','.').' ms'.PHP_EOL;
?>
I both used the PHP 5.2 from pkg.opensolaris.org and compiled my own version of PHP 5.3. Almost identical results.
Any ideas?
Martijn de Munnik
2010-12-30 15:56:30 UTC
Permalink
I know that I can run a lot of PHP processes in parallel. But that is only interesting for me as server admin. When a scripts takes 5 seconds to run a customer doesn't care that we can run 100 of them in parallel. I know PHP is single threaded but I didn't expect poorer performance of a T5120 compared to a X2100M2.

I'm now trying to optimize the compilation of PHP but I don't expect huge amounts of improvements. There seems to be a bug in APC on Sparc http://pecl.php.net/bugs/bug.php?id=17088 so I can't use APC to improve the performance. I haven't tried xcache jet.

Any other ideas?
--
This message posted from opensolaris.org
Bob Friesenhahn
2010-12-30 21:09:30 UTC
Permalink
Post by Martijn de Munnik
I know that I can run a lot of PHP processes in parallel. But that
is only interesting for me as server admin. When a scripts takes 5
seconds to run a customer doesn't care that we can run 100 of them
in parallel. I know PHP is single threaded but I didn't expect
poorer performance of a T5120 compared to a X2100M2.
Now you know. :-)

SPARC T-series is best for running highly-threaded apps like Java
servelets or specially coded multi-threaded applications. It is poor
for large monolithic lumbering legacy software, which is ill prepared
for the future. I was astonished to learn how well the image
processing package I maintain (highly threaded) runs on SPARC T2.
Due to the threading, the SPARC T2 was able to offer similar total
performance to AMD Opteron systems sold at the same point in time.
Post by Martijn de Munnik
I'm now trying to optimize the compilation of PHP but I don't expect
huge amounts of improvements. There seems to be a bug in APC on
Sparc http://pecl.php.net/bugs/bug.php?id=17088 so I can't use APC
to improve the performance. I haven't tried xcache jet.
Note that this bug report included a compiler option which allows the
software to still work without crashing. The code will execute less
efficiently but this might not matter if the unaligned access does
not occur very often.

Bob
--
Bob Friesenhahn
bfriesen-***@public.gmane.org, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Loading...