Web2py should avoid connecting to database when not needed AKA
lazy_connection. Sometimes ago, I proposed a patch that worked great with
Postgresql, but did not get into trunk.  The performance increase is
noticeable in use cases such as Michael's.  I will eventually try a PR
again when I will have time.

@Michael follow Niphlod advice and also look for conditional models in the
book.  Another technique is putting all the DAL modelling in one function
inside a model and execute that conditionally.
e.g.

db = None
def setup_dal():
  db = DAL(...)
  db.define_table(...)
  db.define_table(...)
  return db

if request.controller!='<the frequent ajax controller> and
request.action!='<the frequent ajax action>':
  db = setup_dal()




2014-02-13 20:49 GMT+01:00 Niphlod <niph...@gmail.com>:

> migrate=False still instantiate the model....it just doesn't trigger any
> migration logic.
> the better shot at minimizing times in this case seems to be
> lazy_tables=True
>
>
> On Thursday, February 13, 2014 8:38:46 PM UTC+1, Michael Ellis wrote:
>>
>>
>>>
>>> On Wednesday, February 12, 2014 5:17:02 PM UTC-5, Michele Comitini wrote:
>>>>
>>>> run the profiler on the board:
>>>>
>>>> Thanks Michelle, those are good tools. They show that my ajax function
>> accounts for only 2.6% of the time spent.  The rest is web2py overhead,
>> especially dal.define_table(), despite the fact that I have migrate set to
>> False.  My ajax function does no db access, so I'm wondering if there's a
>> way to tell web2py to skip the db stuff and just run the function and
>> render the output.
>>
>> If not, I suppose I'm going to have to find a way to go around web2py and
>> make client-side reads directly from ZeroMQ sockets that are already
>> running outside web2py.  That sounds fragile and messy, so hope there's
>> another answer.
>>
>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to