Troubleshooting and Optimization

From ActionApps Documentation
Jump to: navigation, search

Guide on Debugging

Common Problems

Caching

ActionApps uses quite powerful cache system. All views (view.php3), slices (slice.php3) and sites (site.php3) are cached, so there is no need to generate each page on every call.

Caching works following way:

  • we take URL parameters, SSI include parameters and cookies and we join them to one long string - "keystring".
  • then we look in the database, if there is cached result for this keystring (table pagecache_str2find, pagecache).
  • if found, the result is send directly from cache. If not then the page is generated and then stored in the cache under the keystring.


Invalidating cache

1) Automatic

Each cache entry contains information, from which slice is the content generated (table pagecache_str2find.str2find). If we change add item in the slice, change the slice setting, modify view in the slice... then all cache entries for this slice are deleted (note that one cache entry could depend on more than one slice in AA caching system).

2) Expiration

Automatic invalidating works well, but the problem is with item expiration and with pending items. If item should expire, then in fact there are no change in the database - all records are the same, but the output of the view should be changed. In such situation the automatic invalidating do not work - there is no event, which could starts the automatic invalidation.

For this purpose we use expiration of the cache entries. You can set the expiration time by CACHE_TTL constant in config.php3 file. We use value 10800 seconds (3 hours) in Econnect's AA install. I'm suggesting to not set it longer than 1 day, if you are using item expiration or pending items.

The records are removed from the cache on probability principe - we call cache cleanup function when we store cache data in the database with probability 1:1000. The probability is set by PAGECACHEPURGE_PROBABILITY constant in constants.php3 file. It means, that the cache cleanup doesn't depend on AA cron - it works as is.

3) Manual

You can bypass the cache system by nocache url parameter of view.php3, slice.php3 or site.php3 file. Use nocache=1 parameter if you want to get fresh content - the cache is not used (nor cleaned). Use nocache=invalidate if you want to remove current cache entry (removes just the entry for current keystring).

Optimizing Your Queries

Performance Testing