-- stevep98 <[EMAIL PROTECTED]> wrote
(on Friday, 07 November 2008, 06:27 PM -0800):
> Thanks for your replies, and you're right that I come from a java background.
> 
> The profiler shows than another source of overhead for me seems to be
> Zend_Load. Loading all those helper classes takes about 30% of my total
> request time. I'm guessing the overhead is from actually doing the parsing
> of those PHP files.
> 
> I can't help thinking that PHP can make enormous strides in performance by
> implementing some kind of persistence between sessions.

I've been doing some performance profiling and benchmarking for the
1.7.0 release, and started writing a performance appendix to the manual.
The first chapter in it is on class loading, as, like you, I identified
it as a major bottleneck.

There are a number of ways to make things faster. As Matthew Ratzloff
noted, you can comment out all the require_once calls and use
autoloading, which saves some significant overhead. Additionally, I've
added some functionality for 1.7.0 that will help with plugin loading --
an include file cache for Zend_Loader_PluginLoader. This piece alone,
without autoloading or stripping require_once calls, can give up to a
30% boost in performance without even utilizing an opcode cache.

That's another piece anyone serious about performance should be doing,
by the way. Unlike Java, PHP is not a compiled language. However, the
PHP interpreter does compile the language into opcodes, and these can be
cached. APC and Zend Platform are excellent choices for opcode caching.

> I will certainly be looking more at Zend_Cache, and probably use a
> memcached backend in the end. But I'm disappointed that Zend_Cache is
> not built into DB_Table. Certainly, you don't want it on by default,
> but having it as an option would be good. Especially if cache
> invalidation is hooked into the Row save() method.

Caching strategies differ between applications. We opted to leave it to
the developer to determine when and where to cache. Additionally, you
may have other items you want to trigger at save() time -- reindexing a
record for you Lucene index, triggering notification emails, etc. A
proposal to add a plugin architecture to Zend_Db_Table has been
developed in the incubator, but the developers have been unable to
complete unit testing and documentation of it; after 1.7.0, I plan to
push it to completion, as it would make this sort of thing easier. We
could then offer standard plugins for caching, indexing, etc. that would
be opt-in.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to