Application over multiple mounts ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Application over multiple mounts ?

ARN NN
Hi Cherrypy people,

(Note - this is the first time I've used cherrypy or any similar framework to build an app so please forgive naive questions)

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).
I would like to avoid that.

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

2) Does each mounted app run in a separate python interpreter process ?

3) Will mounting as separate apps prevent the lockups during DB ops ?

Thanks
_arnn_

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Application over multiple mounts ?

Tim Roberts
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, [hidden email]
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.