|
|
# Benchmarking
|
|
|
|
|
|
Cache benchmarking can be used to test the performance of the available cache backends using various payload sizes. It is wise to test the performance of available backends for your particular setup to ensure that you are getting eh best performance possible.
|
|
|
|
|
|
Below is a simple example of using the benchmarking class, followed by the output that it produces.
|
|
|
|
|
|
```php
|
|
|
<?php
|
|
|
class IndexController extends \Hazaar\Controller\Basic {
|
|
|
|
|
|
protected function init() {
|
|
|
|
|
|
}
|
|
|
|
|
|
public function index() {
|
|
|
|
|
|
dump(\Hazaar\Cache\Benchmark::getAvailableBackends());
|
... | ... | @@ -31,4 +31,36 @@ class IndexController extends \Hazaar\Controller\Basic { |
|
|
|
|
|
}
|
|
|
?>
|
|
|
```
|
|
|
|
|
|
```
|
|
|
array (size=4)
|
|
|
'apc' =>
|
|
|
array (size=1)
|
|
|
8388608 =>
|
|
|
array (size=3)
|
|
|
'w' => float 3.3979
|
|
|
'r' => float 3.0479
|
|
|
'valid' => boolean true
|
|
|
'file' =>
|
|
|
array (size=1)
|
|
|
8388608 =>
|
|
|
array (size=3)
|
|
|
'w' => float 37.6942
|
|
|
'r' => float 0.8769
|
|
|
'valid' => boolean true
|
|
|
'redis' =>
|
|
|
array (size=1)
|
|
|
8388608 =>
|
|
|
array (size=3)
|
|
|
'w' => float 1047.7462
|
|
|
'r' => float 2.749
|
|
|
'valid' => boolean true
|
|
|
'session' =>
|
|
|
array (size=1)
|
|
|
8388608 =>
|
|
|
array (size=3)
|
|
|
'w' => float 0.5569
|
|
|
'r' => float 0.7861
|
|
|
'valid' => boolean true
|
|
|
``` |
|
|
\ No newline at end of file |