[web2py] Re: mysql db connections
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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] mysql db connections
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? If so, then does it create the above db connection for every request? For eg, if there are 10 requests, does it create 50 separate db connections ( 10 requests * 5 pool_size)? 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.
[web2py] Re: mysql db connections
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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: width
thanks for the reply. I already tried that and it seems maxtextlengths applies to only when displaying all the data. But when I try to add new data (in the new page that opens after clicking the Add button), the dropdown column width for the fields are still small. How to increase the width of the dropdown? can you please suggest? On Monday, January 14, 2013 7:58:53 AM UTC-8, Ramos wrote: i know that in form.smartgrid you can set the with of columns with a paramenter in form.smartgrid( maxtextlengths={10,20,etc} maxtextlength sets the maximum length of text to be displayed for each field value, in the grid view. This value can be overwritten for each field using maxtextlengths, a dictionary of ’tablename.fieldname’:length maxtextlengths={}, maxtextlength=20, 2013/1/14 Saba mr.sab...@gmail.com javascript: Any suggestions please? -- --
[web2py] Re: width
Any suggestions please? --
[web2py] width
db.define_table('emp', Field('name') -- some of the data in this column has really long values. ) db.define_table('emp_details', Field('name'),requires=[IS_IN_DB(db,'employee.name')]), Field('details') ) I'm using SQLFORM.grid to manage the data in the above tables. The SQLFORM.grid for the emp_details creates a dropdown list for the name column. Some of the data in this column are really lengthy and I can't actually see the whole value. How can I increase the width of the dropdown so I can see the whole value. can you please suggest? --
[web2py] Auto populate form
hello, I have a table like this: db.define_table('host', Field('host_name', requires=IS_NOT_EMPTY()), Field('host_ip', requires=IS_NOT_EMPTY()) ) i'm using SQLFORM.grid to display/edit the data in the table. When a user inputs a host_name field, I would like to automatically populate the host_ip field by doing an nslookup of the host_name. Is there a way to do this. Any suggestions please? thanks, Saba --
[web2py] Re: Auto populate form
thank you all... i'll try your suggestions (need to do study javascript/ajax..) --
[web2py] Using Request_tenant , but shows all records in the table
I've added the field request_tenant using : if auth.user: defaultval = auth.user.id else: defaultval = 0 db._common_fields.append(Field('request_tenant',default=defaultval)) While create a new record , the default value is inserted into the table, But when i view the records from the index.html file , i see all the records and not just the records for that particular user ! --