sstevan
sstevan

Reputation: 487

APC & eAccelerator configuration

Looks like I've done pretty stupid thing :) I'm trying to optimize performance so I've installed eAccelerator to cache and speed up PHP script executing. After that I've installed APC to store and retrive HTML pages from RAM memory (if I'm right about this). After benchmarking new PHP scripts with both eAccelerator and APC enabled at the same time I saw that reading HTML file from disk and displaying it was faster than displaying it from APC cache. Here's benchamrk results and PHP scripts. I need advice how to configure eAccelerator or APC to get better results.

ab -kc 500 -n 100000 http://0.0.0.0/html_disk.php
Requests per second:    14197.42 [#/sec] (mean)
Time per request:       35.218 [ms] (mean)
Time per request:       0.070 [ms] (mean, across all concurrent requests)
Transfer rate:          237307.67 [Kbytes/sec] received

ab -kc 500 -n 100000 http://0.0.0.0/html_apc.php
Requests per second:    11795.11 [#/sec] (mean)
Time per request:       42.390 [ms] (mean)
Time per request:       0.085 [ms] (mean, across all concurrent requests) 
Transfer rate:          197199.56 [Kbytes/sec] received

And scripts are simple as: html_disk.php

$file = file_get_contents('page.html');
echo $file;

html_apc.php

if ($page = apc_fetch('page')) {
  echo 'APC!';
  echo $page;
} else {
  echo 'FILE!';
  $file = file_get_contents('page.html');
  echo $file;
  apc_add('page', $file, 120);
}

After first script loading HTML page should be loaded from shared memory right?

Upvotes: 0

Views: 99

Answers (0)

Related Questions