(on Tuesday, 28 October 2008, 02:09 PM +0000):
> This is not going to be easy due to the nature of the MVC implementation.
>
> For starters, you can never be sure that the <head> is completely ready until
> all possible view scripts have been executed (as they may add CSS/JS etc...).
> By this time the entire response is ready so you might aswell send the full
> payload. Also, the YSlow rules suggest putting all JS including external
> scripts at the bottom you should only be putting <link type="text/css"> in the
> head and <script> belong just before </body> which reduces the effect this will
> have to CSS assets only. The best performance optimisation you can do is ensure
> that external assets are cached, 302'd and gzipped.
>
> Did you see much of a performance improvement by flushing previously? I would
> suggest benchmarking using flush against the standard MVC method (by simularing
> the additional processing time using wait()) just to check it's actually worth
> the fairly big compromise you would need to make.
Something else to test: determine how long it takes to generate the page
using the MVC. You can do this using microtime() surrounding the call to
dispatch(). In most cases, I'm going to guess it's going to be < 1s.
The next thing to test then is the actual size of the payload. If the
HTML is relatively well-structured and not displaying hundreds of
database results, most likely you will have nothing to gain by flushing
early.
As Daniel suggests, most likely the best things you can do with regards
to CSS and JS are to include them at the most optimal locations in your
document, and ensure that you have appropriate HTTP-level caching of
them (and optional compression).
For the ZF side, if you're noticing that the page loads are slow due to
actual processing, start caching. Zend_Cache is definitely a viable
option, but don't skip less obvious solutions such as memcached, APC, or
Zend Platform's dynamic content cache.
> Sandeep Manne wrote:
>
> Hi
>
> While trying to improve the performance of our customer's website we came
> to know about early flushing the buffers as soon as the headers is
> processed so that the css and js files will download before the body is
> processed. I want to know whether there is any method in Zend Framework to
> do this early flushing the buffer.
>
> Reference:
> http://developer.yahoo.com/performance/rules.html
>
> --
> Regards
> Sandeep Manne
> S/W Engineer
> Sourcebits
>
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论