The first numbers to look at are times those are what affect our
lives.  The number of calls bother just the cpu ;-)

1. time to complete the action
2. cumulative time i.e. where most of the time affecting 1. is spent
3. percall time i.e. to find if there is a function that is really slow

1. is around 0.1s per call
2. most of the time is spent in db.py while it is executed
3. around 40% of the time seems to be spent in 45 define_table calls
inside the db.py; around 20% is spent in connecting to postgresql

So you need to find a way to work on define table either reducing the
number of calls, for instance splitting table definitions so that you
define only those needed in the controller actually called.
To cut define_table execution time you could try to put migrate=False,
fake_migrate=False, when you call the DAL since in production the
model does not change (usually) at runtime.
Be sure that you have connection pooling active.  If you use uwsgi in
a process only configuration (no threads) you still need to put
pool_size=1 in DAL call to activate pooling.
If you use threads... well don't.


Other considerations.

- The transaction is held for 0.1s which can be long on high
concurrent environment.  This could affect postgresql in terms of
resources and lock management.
- The time spent in the execute method of the psycopg adapter is very
low, so the query is fast.
- The number of web2py processes must be no more than twice the number
of cores on the machine and no less than that same number
- Check that you use "upstream" with keepalive in nginx server configuration.

mic


2012/5/13 Bruce Wade <bruce.w...@gmail.com>:
> Ok so I started it with the profile to be honest need some guidance on how
> to read this report. But like the one call there is 582,237 function calls
> that looks pretty insane.
>
> Or just loading my home page 85,545 function calls..
>
> The /ad_handler which is called by ajax and only returns None has 54,149
> function calls. See attached. If any one would like to explain how to read
> this.
>
>
> On Sat, May 12, 2012 at 2:41 PM, Bruce Wade <bruce.w...@gmail.com> wrote:
>>
>> lol, yeah I guess that is my problem with being a C++ coder. But I also
>> seen that 90 tables were loaded with every request ;)
>>
>>
>> On Sat, May 12, 2012 at 1:50 PM, Michele Comitini
>> <michele.comit...@gmail.com> wrote:
>>>
>>> I keep saying it but nobody listens :-)
>>>
>>> USE THE PROFILER
>>>
>>> You wasting *your* time trying to guess where the application is
>>> wasting *its* time.
>>>
>>> mic
>>>
>>> 2012/5/12 Anthony <abasta...@gmail.com>:
>>> > On Saturday, May 12, 2012 12:06:28 PM UTC-4, Bruce Wade wrote:
>>> >>
>>> >> Yeah I am going through all my controllers right now to see if I can
>>> >> use
>>> >> the folder solution. Which way would be faster? Folders or modules?
>>> >
>>> >
>>> > Well, a model file still has to be read each time it is needed, whereas
>>> > a
>>> > module remains in memory after the first time it is imported, so
>>> > perhaps the
>>> > module approach would still be a bit faster, but you might run an ab
>>> > test to
>>> > confirm (and to see if the difference is non-trivial).
>>> >
>>> > Anthony
>>
>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>

Reply via email to