Using "file" engine make the performance poor

mburak - April 10, 2008 - 21:22
Project:Cache Router
Version:5.x-1.0-beta4
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:by design
Description

I installed a brand new drupal 5.7 and added the Cache Router module.
I did the same performance tests as there are in the module page. Performance with "db" engine is not bad for me:

Requests per second: 324.03 [#/sec] (mean)
Time per request: 15.431 [ms] (mean)

But when i do the same performance test with "file" engine, the performance is very bad:

Requests per second: 12.88 [#/sec] (mean)
Time per request: 388.210 [ms] (mean)

This is what id added to settings.php:

$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'file',
    'server' => array(),
    'shared' => TRUE,
    'prefix' => '',
  ),
);

Am i missing something?

Regards,

Matias.

#1

mburak - April 23, 2008 - 10:10

Also, i found these errors in my log file.

==> /etc/httpd/logs/error_log <==
[Mon Apr 14 12:02:01 2008] [error] [client 127.0.0.1] PHP Notice: Undefined index: in /mnt/20GB/local/dpc-solution/drupal/sites/all/modules/cacherouter/engines/file.php on line 14
[Mon Apr 14 12:02:01 2008] [error] [client 127.0.0.1] PHP Notice: Undefined index: cache in /mnt/20GB/local/dpc-solution/drupal/sites/all/modules/cacherouter/Cache.php on line 12

Thanks,

Matias.

#2

BTMash - April 21, 2008 - 18:34

While performance on my local computer seems decent, I continually got these notices as well - I see that there is no checking done on whether or not the cacherouter bin prefix is set or not - so I added some checks for the prefixes to the effect of:

if (isset($conf['cacherouter'][$bin]['prefix'])) {
  ...
}

And the warnings are no longer there. While I have only used apc and file caching, the differences were in:

  • cacherouter/engines/file.php
  • cacherouter/Cache.php
  • cacherouter/cacherouter.inc

#3

slantview - April 22, 2008 - 19:13

I'm sorry, I've been out of the loop for a week due to some personal issues. I will take a look at this asap.

#4

slantview - April 24, 2008 - 18:44

Hi, did you apply the cache serialization patches? Did you check write permissions for the "path" to the cache files?

-s

#5

BTMash - April 24, 2008 - 19:08

Ack...I should have created a warnings thread for the 6.x branch - The warnings and notices that I received were from the 6.x branch - that is where I needed to place the isset() checks.

#6

mburak - April 28, 2008 - 19:43

Yes, i applied the patches but it's still not working. I have the right permissions to write in /tmp/filecache and i see that it's writing things there.

#7

andypost - May 23, 2008 - 19:21

I changed Cache.php

<?php
 
function __construct($bin) {
    global
$conf;

   
$this->name = $bin;
   
//Check for bin in config
   
if (isset($conf['cacherouter'][$bin])) {
     
$this->prefix = $conf['cacherouter'][$bin]['prefix'];
    }
    else {
       
$this->prefix = $conf['cacherouter']['default']['prefix'];
    }
  }
?>

#8

eli - July 21, 2008 - 16:14

Based on the problems I was having, it appears to be because the 'page_cache_fastpath' variable is not set. Although it doesn't seem to be documented anywhere, you need to have a variable namde page_cache_fastpath set to '1' or else the file caching (and possible other engines) don't work at all

#9

eli - July 21, 2008 - 18:45

That is to say, you want to add this to your settings.php:

$conf['page_cache_fastpath'] = 1;

#10

slantview - October 31, 2008 - 01:00
Status:active» by design

#11

BTMash - November 6, 2008 - 16:35

Can the documentation for the project be updated in this case?

 
 

Drupal is a registered trademark of Dries Buytaert.