Intrigued by the recommendation to put code in modules instead of models if possible.
At present I have db.define_table .. method calls in a model file. The database structure will stay the same between releases, so it does not feel optimal at present to have such definitions run on every page request. Same for the auth and mail objects in my model file, these are created each page request at present. Would it be possible to define db, auth and mail just the once at a module level and then refer to these shared objects between page requests? If per-request copies are required, would a .copy operation on a template mail/auth/db object run faster than just defining these in the model? I am going to have a play with this. Very impressed with web2py so far, it is great how code changes I make are picked up on the fly by default. But going for the nth degree of performance (just for the hell of it) I'm interested to see if it is possible to restrict things like running db.define_tables to a startup task or manual admin operation instead of on each page request, and in general pull logic out of the models for anything that is static or changes infrequently. If anyone else has experience with puting their models on a diet and shifting code to modules, would be interested to hear. Cheers. On Jul 22, 9:03 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > This is a complex issues that spans different topics: speed, > efficiency, scalability. > > I am not aware of any major bottle neck in web2py, execpt of the > database (not the DAL , the actual database) so it is efficiently. > There are many little tricks you can use to speed applications more: > - use connection pooling > - run your app bytecode compiled (press the button) > - move as much code as you can modules instead of models. > - discard sessions unless you they have modified > - store sessions in a memory mapped file > > How fast is it (with or without optimizations) depends on the > architecture. Is there a machine that can give you 1000 request/ > seconds. I do know. It is possible. On my virtual machine I get about > 100. > > There are some things that definitively will NOT help: > - a multicore machine. because the python interpreter cannot use > multiple cores efficiently > - a key/value database. This helps with scalability (i.e. run lots of > concurrent servers) but not necessarily speeds up a single server. I > will actually argue most of the map/reduce DB out there are slower > then postresql. > > Massimo > > On Jul 21, 8:40 pm, Alex Fanjul <alex.fan...@gmail.com> wrote: > > > Hello Massimo (all) this days I'm reading about horizontal scale > > architectures, key/value and graphs db's, etc. and the awakening in > > cloud computing enviroment > > In the last reading, I saw "Redit" benchmark of about 50 to 100 > > thousands req/sec with standard linux box. > > > I know those values are due to DB architecture of key/value (and they > > are really incredible), but: > > -what thing is really limiting 1000 req/sec in web2py? > > cherrypy/apache? mysql/postgres? wscgi/fastcgi? web2pyframework? python? > > -what do you think would the upper limit (req/sec) be in the better > > production enviroment case (great linux server/s, apache/cherokee?, best > > connection) > > -As a matter of curiosity, have you ever though in implementing the > > API for any of such databases? Redit? Tokyo? couchDB? > > > regards, > > alex f > > > P.S as always i'm sorry for my poor english > > > El 21/07/2009 15:52, mdipierro escribió: > > > > - Are there any large web2py installations that I can quote as an > > > example > > > > Not that I know and handle>1000 requests/second. > > > > - How are the issues of caching (say rendered pages) handled? I have > > > done a few Drupal sites and can see theperformanceeffects of caching > > > very clearly. IIRC only Django has caching in the python world? > > > > If you use multiple installations behind a load balancer I suggest you > > > use the "pound" load balancer to keep sessions sticky. In that case > > > the different processes do not need to share any data. > > > > - Has anyone done any work with web2py in a cluster (similar to a > > > Tomcat cluster behind mod_jk)? (multiple machines running web2py, the > > > session data sync'd etc. I can put the session info in a shared FS > > > though) > > > > If you need sessions and you need sessions synced, I suggest you share > > > the sessions folder. > > > > Massimo > > > > On Jul 21, 12:20 am, Bottiger<bottig...@gmail.com> wrote: > > > >> If it is truly not computationally intensive, and does not even use a > > >> database, it should not be a problem. > > > >> I have benchmarked Web2Py on the static welcome page to 700 requests/ > > >> second with a concurrency level of 50. > > > >> To increase the level of concurrency (if you have additional CPU > > >> cores), you should increase the number of Web2Py processes. > > > >> "~ 8000 users, and atleast 1000-2000 simultaneous users." > > > >> This is not really a large installation if it doesn't use a database. > > > >> "How are the issues of caching (say rendered pages) handled? I have > > >> done a few Drupal sites and can see theperformanceeffects of caching > > >> very clearly. IIRC only Django has caching in the python world?" > > > >> Drupal, Django, and Web2Py have equivalent caching mechanisms. Any > > >> external caching mechanism you have seen with Drupal should also be > > >> usable with Web2Py or Django. > > > >> "I can put the session info in a shared FS though" > > > >> You can either do that or use a database for sessions. > > > >> On Jul 20, 8:54 pm, Anand Vaidya<anandvaidya...@gmail.com> wrote: > > > >>> Hi > > > >>> After a couple of web2py projects, I am confident of coding a fairly > > >>> big app in web2py. > > > >>> My previous projects did not need any database (we had to use > > >>> flatfiles), the new project is also similar. I intend to bypass the > > >>> models etc completely. > > > >>> The app is likely to be used in a corporate setting with ~ 8000 users, > > >>> and atleast 1000-2000 simultaneous users. > > > >>> The users authenticate to an LDAP server. > > > >>> The app is not computationally intensive > > > >>> It queries another service and displays results > > > >>> No SQL DB is required > > > >>> Most likely behind a few Apache 2.x front server > > > >>> I'd like to know: > > > >>> - Are there any large web2py installations that I can quote as an > > >>> example > > > >>> - How are the issues of caching (say rendered pages) handled? I have > > >>> done a few Drupal sites and can see theperformanceeffects of caching > > >>> very clearly. IIRC only Django has caching in the python world? > > > >>> - Has anyone done any work with web2py in a cluster (similar to a > > >>> Tomcat cluster behind mod_jk)? (multiple machines running web2py, the > > >>> session data sync'd etc. I can put the session info in a shared FS > > >>> though) > > > >>> Regards > > >>> Anand > > > -- > > Alejandro Fanjul Fdez. > > alex.fan...@gmail.comwww.mhproject.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---