Reputation: 53206
I have a few scenarios which I will eventually need to consider in a few months time. Just throwing the question out there so that I can mull on the discussion in the mean time.
I am using Zend Framework for my application stack. I'm using APC for server caching (rather than memcache since as I don't believe memcache offers any benefit for me even though my application is distributed.)
My application has been built to work without JavaScript, and then for JavaScript support I break the page down and render the JavaScript friendly version.
If you analyse a simple page, maybe 80% of it is core functionality, which can be cached for every user. Then 20% of it is customized for that user. For example, I might want to display
These two "widgets" would be specific for each user. I was considering using ESI for these components, but then I figured that the most consuming aspect of any/my Zend Framework application is the bootstrapping and dispatch process. So if my application takes 80ms currently without caching. Like 90% of the relative time is spent in the bootstrap and on Plugin hooks, if I were to use ESI to load these two "widgets", then I would effectively be adding load to each page? Since I would be initiating another 80ms request for each cached page.
In which case, would you advise just loading the customized widgets/snippets via JavaScript, which can be pulled once the initial page has been loaded. The clear benefit of this is that there is only ever one request which is cached, and then anything customized is pulled in a single request after the initial page (which is cached) has been served.
If I'm looking for maximum performance, this seems like the better solution?
Upvotes: 2
Views: 1078
Reputation: 134
you could build a second simple app that reads from a cache based on an ajax call and only bootstrap if the info hasn't been cached. the response could then be added to cache so further calls won't load your zend project. this is a normal procedure but would also require cache invalidation to be programmed. your already using apc which would suit for this. obviously it wouldn't work for the last 5 viewed or similar content.
Upvotes: 1
Reputation: 709
Varnish with ESI won't help you reducing page loading time, knowing that 80ms is already good (a human user won't make any difference between 1 and 500ms...)
It will help you avoid server stress on heavy loads, and this will work as well with ESI as with AJAX.
If your priority is to display the main page as fast as possible, AJAX is the best way, since ESI will wait for sub-request to respond before sending the whole page.
If you still want your app to be non-JS compatible, you can filter filter user agents to use JS if possible and ESI if not but this kind of trick is easyly dirty...
Upvotes: 0