> 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)
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?