2009年4月26日星期日

Re: [fw-mvc] Performance boost for ajax request?

-- Van H Tran <tvhoang1980@yahoo.com> wrote
(on Sunday, 26 April 2009, 05:22 AM -0700):
> And, sadly, it seems to be the only way right now. Creating a separate
> work-flow without touching Zend's MVC & Action Controller.
>
> Maybe there should be Zend's standard recommendations on how to re-use Zend's
> components, which are likely to be Zend_Db and some "assisting" modules like
> Config, Session, Translate...
> Zend_Dispatcher or Zend_Controller should be avoided. Zend_View can be handy
> sometimes when you need to return some HTML, not just JSON...

Zend_Application was created in part to solve this problem. As an
example, for the revised version of the Quick Start, we're utilizing
Zend_App to bootstrap a script used to create and populate the guestbook
database:

$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$bootstrap = $application->getBootstrap();
$bootstrap->bootstrap('db');
$dbAdapter = $bootstrap->getResource('db');

As you can see, this allows you to re-use work you've already done, and
selectively bootstrap and retrieve resources needed for a particular
task.

> Oh well, I'd better stop. I guess I'm doomed trying to create this thing :D
>
>
>
>
> Writing an Action Controller means that you want to take advantages of Zend
> MVC architecture which gives you a well-defined workflow but with some
> overheads. Anything that hits dispatcher is expensive.
>
> So I think it should be better to stay away from it for several light
> weight and performance-sensitive tasks. Tweak your .htaccess to add some
> free standing scripts which should not prevent you from using some
> selective components in Zend Framework. The problem is that you have
> another workflow to manage.
>
> On Fri, Apr 24, 2009 at 11:20 AM, Van H Tran <tvhoang1980@yahoo.com> wrote:
>
> Hello everybody,
> Sometimes there are requests that are simple ajax request (for example,
> get a district list of a city), that does not need to go through all
> the bootstrap and heavy stuff from Zend. Only a few Zend components
> such as : Zend_Session, Zend_Db then are needed.
>
> What is the best way to write the Action Controller for those requests?
> I haven't found Zend's support for that? Or am i missing something?
>
> Thanks
>
>
>
>
> --
> --------------
> http://groups.google.com/group/phpvietnam
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: