Any suggestions pls?
On Sunday, May 26, 2013 1:07:53 PM UTC-7, Saba wrote:
> Thanks for the reply. I really appreciate. I'm developing an app using
> web2py to pull up records from mysql db and present it to the user using
> custom views. It looks like sometimes it takes < 1sec to display the
> records to the user (i'm the only user now) but other times it takes around
> 4-5secs to display the same records (less than 50 rows). From my
> observation, the latency seems to occur when the user, after pulling up
> records, remains idle for few mins and then pulls up the same records
> again. I'm using a pool_size of 5. Any suggestions on how to reduce the
> latency? Again I really appreciate the responses.
>
>
> On Sunday, May 26, 2013 6:37:19 AM UTC-7, Massimo Di Pierro wrote:
>
>>
>>
>> On Sunday, 26 May 2013 01:34:40 UTC-5, Saba wrote:
>>>
>>>
>>> Hi,
>>>
>>> I have a question please regarding db connections and connection pooling
>>> in web2py.
>>>
>>> In models/db.py, I have a connect string like this:
>>>
>>> db=DAL('mysql...',pool_size=5)
>>>
>>> does model files get executed for every request?
>>>
>>
>> yes
>>
>>
>>> If so, then does it create the above db connection for every request?
>>>
>>
>> No. when the request is completed the connection is put in a pool and the
>> next request pulls it from the pool. If you have more concurrent requests
>> than the pool size then a new connection is created. Pool size starts at
>> zero and grows up to the pool size you have declared (5) than stay fixed.
>>
>>
>>>
>>> For eg, if there are 10 requests, does it create 50 separate db
>>> connections ( 10 requests * 5 pool_size)?
>>>
>>
>> No. If you have 10 requests but not concurrent, it creates only 1
>> connection in total. If you have 10 concurrent requests, it creates 10
>> connections (one each) but when complete will close 5 and recycle 5 for
>> future use.
>>
>>
>>>
>>> Please let me know. Appreciate your response.
>>>
>>> thanks,
>>> Saba
>>>
>>>
>>>
>>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.