APC caching

Hi,

I have installed APC and enabled it on my server.

I have also modified the index.php to use yiilite.php.

Are there easy tests I can do to see if there is an actual difference?

Also after doing the 2 steps above, do I need to do anything else?

Is the APC used automatically with the yiiframework?

Or do I need to add anything to my main.php config and other stuff?

Thanks.

You can enable profiler and check execution time:




'log'=>array(

    'class'=>'CLogRouter',

    'routes'=>array(

        …

        array(

            'class'=>'CProfileLogRoute',

            'levels'=>'profile',

            'enabled'=>true,

        ),

    ),

),



No need for extra config. Once enabled, APC is used for all PHP code.

You may also want to tune some APC settings in your php.ini or use the bundled apc.php script to monitor the cache. See here:

http://de3.php.net/manual/en/apc.configuration.php

And if I want to see the results say before and after, can I simply do apc.enabled=0 and 1 with the profiler and check? That should be fine right?

Thanks for the hints guys!

This is weird.

I have done a few tests.

I have enabled and disabled apc and refresh a certain page that I use.

When APC is disabled and I am using yii.php, I get:

		Profiling Summary Report


		(Time: 0.05541s,


		Memory: 5,705KB)

When APC is enabled and I am using yii.php, I get:

		Profiling Summary Report


		(Time: 0.08314s,


		Memory: 5,705KB)

When APC is disabled and I am using yiilite.php, I get:

		Profiling Summary Report


		(Time: 0.02546s,


		Memory: 5,400KB)

When APC is enabled and I am using yiilite.php, I get:

		Profiling Summary Report


		(Time: 0.03061s,


		Memory: 5,400KB)

The settings in my php.ini are as followed:

apc.enabled=1

apc.shm_segments=1

apc.optimization=0

apc.shm_size=32

apc.ttl=7200

apc.user_ttl=7200

apc.num_files_hint=1024

apc.mmap_file_mask=/tmp/apc.XXXXXX

apc.enable_cli=1

apc.cache_by_default=1

apc.stat=0

Also I have put the apc.php file on my server and ran it.

Is it normal that when I run yii and look at the apc.php I only see 1 file cached and its the apc.php?

Im sorry im new at this.

Anyone got any ideas? Am I missing anything?

Are you saying that with apc.php you don’t see any other files in “System Cache Entries”? Then something must be wrong with your setup. Maybe try some PHP scripts without Yii first, just to make sure.

Yes that’s what I mean.

If APC is enabled then all php scripts should appear in the system cache entries?

I will do some more tests.

BTW i am not the one that did the setup, I asked my hosting company to install it for me.

It seem’s to appear when I check with phpinfo and I also copy pasted the settings from the performance page to test.

Ok, it seems to work, I found out what the issue was, I was running suphp.

So I switched back to fastcgi and I can see the entries now. phew.

Will keep on testing, thanks!