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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to