How web2py works - performance

101 views
Skip to first unread message

Francisco Costa

unread,
Jul 11, 2011, 9:38:03 AM7/11/11
to web2py-users
Hi, is there any visual chart or text that explain what happens when a
page request is made?
For my knowledge this is the order:

- Models
- Controller
- View

But what exactly is executed?

I know if I open a certain page it only executes that controller and
view, but it seams that Models are all executed..

Is it right to assume that smaller and faster models will enhance
web2py performance?

Massimo Di Pierro

unread,
Jul 11, 2011, 10:08:58 AM7/11/11
to web2py-users
Models in the top modes/ are all executed. Models in subfolder are
executed conditionally. For example models in a folder with the name
of a controller are executed when the controller with the same name is
executed.

Ross Peoples

unread,
Jul 11, 2011, 10:11:36 AM7/11/11
to web...@googlegroups.com
The less your models do, the better in general. When a page comes in, web2py does it's thing, then executes ALL models, then executes the appropriate controller->function, then the function executes the view.

However, with newer versions of web2py, there are conditional models, so in your models folder, you can have another folder with the name of your controller, so that models in that folder will only be executed when executing a controller. Controller functions should work the same way, with a folder for the function under the folder for the controller.

Anthony

unread,
Jul 11, 2011, 10:15:31 AM7/11/11
to web...@googlegroups.com
Check out http://web2py.com/book/default/chapter/04#Dispatching. You are right that smaller/faster models should improve speed a bit, though as Massimo has pointed out, as of 1.96.1, we have conditional models that are executed only for specific controllers and/or functions.
 
Anthony
 

apple

unread,
Jul 11, 2011, 12:54:36 PM7/11/11
to web2py-users
The detailed visual chart is here:

http://web2py.com/book/default/chapter/01#Model-View-Controller

On Jul 11, 3:15 pm, Anthony <abasta...@gmail.com> wrote:
> On Monday, July 11, 2011 9:38:03 AM UTC-4, Francisco Costa wrote:
>
> > Hi, is there any visual chart or text that explain what happens when a
> > page request is made?
> > For my knowledge this is the order:
>
> > - Models
> > - Controller
> > - View
>
> > But what exactly is executed?
>
> > I know if I open a certain page it only executes that controller and
> > view, but it seams that Models are all executed..
>
> > Is it right to assume that smaller and faster models will enhance
> > web2py performance?
>
> Check outhttp://web2py.com/book/default/chapter/04#Dispatching. You are
Reply all
Reply to author
Forward
0 new messages