Re: Application over multiple mounts ?
Tim Roberts <[email protected]> Mon, 11 Jun 2018 08:36:47 -0700
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Organization | Providenza & Boekelheide, Inc. |
| Message-ID | <[email protected]> |
ARN NN wrote: > > I used Cherrypy to build a web-app for a specific use at work. The > cherrypy app is the front-end, MySql is the back-end. > > There are two broad functionalities for this app : > - Front-end operations that allows the end-user to interact with the > DB over HTTP. > - Periodic back-end operations that make changes to the DB, > independent of front end operations. > > Currently both functionalities existing within the same app. However, > I find that the back-end db ops cause the front end to pause (be > unresponsive for a few seconds). This is likely due to the infamous "Python globals interpreter lock". If you have multiple threads, only one thread is allowed to be running in the interpreter at any one time. Multi-threading in Python is great when the threads are mostly I/O bound, but if threads are competing for the CPU, it becomes a problem. > My questions are - > > 1) can these be mounted separately within the cherrypy app server ? > Like this : > cherrypy.tree.mount(FrontEnd(), '/myapp', myapp_conf) > cherrypy.tree.mount(ScheduledOps(), '/myapp_scheduled', myapp_conf) > cherrypy.engine.start() > cherrypy.engine.block() That doesn't help. As long as they are one process, they all share a single global lock. > 2) Does each mounted app run in a separate python interpreter process ? If by "mounted app" you mean individual calls to "cherrypy.tree.mount", then no. If all of that is in one Python script, then it's one process, and one global lock. > 3) Will mounting as separate apps prevent the lockups during DB ops ? Again, if you mean individual calls to "cherrypy.tree.mount", then no. You would have to have multiple processes. Can you spin off the database updates to a separate process? -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at https://groups.google.com/group/cherrypy-users. For more options, visit https://groups.google.com/d/optout.