Jump to content

Obsolete:Hydra

From Wikitech
This page contains historical information. It may be outdated or unreliable.
A hydra
2006/04/17: This machine has been returned to Sun while they work out what makes PHP so slow.

A Sun Fire T2000, 6-core 1.0GHz UltraSPARC T1, 8GB RAM. It's on evaluation; not ours yet. IP 10.0.0.201. Runs Solaris 10.

ALOM: connect to port 'hydra' on the SCS. Type #. to enter the ALOM console, 'console' from there to enter the system console. From Solaris type ESC-B to enter the openboot prompt. Type 'go' to get back to Solaris.

Useful ALOM commands at the sc> prompt:

poweron
poweroff
powercycle

It has two drives with all FSs mirrored. If the primary drive fails then 'boot backup_root' from the prom (it should do this automatically).

Don't use GCC to compile things here (it's slow on SPARC). Use cc (or CC for C++) in /opt/SUNWspro/bin.

Kate's benchmark

threads req/s (Hydra) time/req (Hydra) req/s (srv54) time/req (srv54)
1 2.34 455 ms 9.38 100ms
2 4.84 208 ms 17.84 54 ms
4 8.87 130 ms 25.05 37ms
6 13.7 71 ms 29.05 33 ms
8 16.5 59 ms 27.45 40 ms
12 20.32 47 ms 29.27 33 ms
16 19.98 48 ms 29.79 33 ms
24 19.29 53 ms 29.16 33 ms

Tim's benchmark

String concatenation

Task was this:

<?php
$n = 1000;
$c = 1000;
for ($i=0; $i<$n; $i++) {
        $s = '';
        for ($j=0; $j<$c; $j++) {
                $s .= ' ';
        }
}
?>

Executed 48 times, rounded down to the nearest multiple of the number of threads. Time shown below is the wall time divided by the number of runs.

Rescaled y-axis:

Data cache misses

Is it possible the task above had a small working size, and thus not many stalls for the strand-based execution model to take advantage of? I measured data cache miss rate directly.


Method

Three benchmarks were used: the above string concatenation test, the following string search test:

<?php
$size = 10000000;
$iterations = 100;
$s = str_repeat( ' ', $size );

for ( $i = 0; $i < $iterations; $i++) {
        strpos( $s, 'hello' );
}
?>

and this random access test:

<?php

$size = 1000000;
$iterations = 1000000;
$s = str_repeat( ' ', $size );

for ( $i = 0; $i < $iterations; $i++) {
        $p = mt_rand(0, $size - 1 );
        $x = $s[$p];
}

?>

I ran each benchmark continuously in 48 threads. I took one sample of the data cache miss rate per second. I calculated the average and standard error of these samples.

Results

Data cache miss rate was:

  • string concatenation: (8.3 ± 0.1)%
  • string search: (3.11 ± 0.01)%
  • random access: (9.019 ± 0.002)%

Conclusion

Tight PHP loops give a high data cache miss rate. The low miss rate for strpos() suggests that there is a lookahead mechanism.