As you can see, the db setting are the same, but I enabled the file based cache component, and i preload it. The schema needs to be saved somewhere, and this seems to be the simplest solution.
Yii’s CApcCache class uses APC for other functionality. (see CCache, for example) It has been used for schema caching in several examples. (one of which is in the book, Yii 1.1 Application Development Cookbook).
@Sebastian - you should measure performance with and without caching turned on. I’m not 100% certain, but I don’t believe that this type of caching stops the show table statements, etc., they’re simply satisfied from the cache rather than coming from the database. If performance is faster with caching on, you’ll know that it is working.
Edit: You should also increase ‘schemaCachingDuration’ => 60 to something a lot greater than 60 seconds. That could be your issue. Try 3600. From what I just read, the metadata is supposed to be stored when you’re using CActiveRecord. That sounds like it wouldn’t need to issue the show table statements.
So you say with APC show table statements still are fired, but are served somehow from cache. With CFileCache show table statements are not fired? Very interesting, maybe someone else with APC can confirm this?
@Sebastian, I just configured a project I’m working on locally to use ApcCache with schema caching. It appears to be working. I don’t have time to do benchmarks, but I did run a few pages that query the same set of tables. The initial pages included SHOW TABLE, SHOW COLUMNS statements. These disappeared in later pages that used the same tables. (see my EDIT earlier on whether SHOW TABLES are expected).
My configuration is basically the same as yours except for the value:
@Sebastian - One other idea. If you’re re-running the exact same URL, make sure that your browser is not caching the results and displaying the same profile info at the bottom. I noticed this when I re-ran one of my dynamic pages.
My only other thought is that your server is out of available memory for the apc.shm_size (256M) in your settings. This causes the cache to flush every time you try to load something. Try reducing it to 32M. You can also take a look on your box to see what the free memory looks like.