Re: Reusing instances
2010/3/11 Mladen Turk mt...@apache.org: Second is to have application pools where one could say: Serve WebAppX inside Default Application Pool consisting of 1 ... N processes or use Custom Application pool with some process limitation factors (memory, cpu usage, etc) Note, that ServletContext.getContext(String) allows interaction between different web applications on the same server. That is when crossContext=true for the application. I wonder, how much will be the overhead from having several JVMs, each with its heap. I think that /work folder sharing is out of question. Most of concern here is with Jasper, but there can be also other files, and files written by applications. The /webapps folder sharing depends on whether autodeploy feature is enabled. Expanding deployed wars and deleting folders when undeploying must be done in a single thread. Otherwise there can be security issues. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/12/2010 05:54 PM, Konstantin Kolinko wrote: I think that /work folder sharing is out of question. Most of concern here is with Jasper, but there can be also other files, and files written by applications. That shouldn't be a problem if guarded with some global mutex. Other option is to have separate work dirs with child id suffix. The /webapps folder sharing depends on whether autodeploy feature is enabled. Expanding deployed wars and deleting folders when undeploying must be done in a single thread. Otherwise there can be security issues. Again with global mutex it should work on first served basis. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/11/2010 08:50 AM, jean-frederic clere wrote: On 03/11/2010 08:30 AM, Mladen Turk wrote: On 03/11/2010 07:52 AM, Costin Manolache wrote: On Wed, Mar 10, 2010 at 10:28 PM, Mladen Turkmt...@apache.org wrote: On 03/10/2010 11:10 PM, Costin Manolache wrote: You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? First goal is to get rid of connectors and use Tomcat directly inside httpd or IIS or new Commons Runtime (replacing Tomcat Native and Daemon) I'm working on. It used to work - about 10 years ago :-) Actually didn't. It worked for IIS and Httpd on windows only since at that time they had a single child process. Now IIS is the same as httpd with worker mpm. That was on of the reasons we kill JK2. JNI inproc connector simply didn't work. One of the big problem is that the prefork and worker models may use several process for the same session and you can't fix a session to a JVM process... Sure. See the initial post. Session sharing is one of the things that has to be done. However this can be easily managed using shared memory or even using memcached At the end you needed a flat cluster with one node for each process and that doesn't scale. In essence it is a cluster, and that's why the subject title is 'reusing instances' since it lives in the same directory. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
And what is the problem you are trying to solve ? The old in-process' goal was speed - replacing marshalling with JNI. I don't think it gained much. I think app isolation/chrooting and clean versioning/reload are great goals - but the model is one app per process. I fail to see use cases for having multiple webapps in different processes on same machine, still sharing directories. Is it to allow 4G heap ? 64bit VMs solve this. Scale ? Better done with more machines. Maybe too many cores ? Costin On Thu, Mar 11, 2010 at 12:09 AM, Mladen Turk mt...@apache.org wrote: On 03/11/2010 08:50 AM, jean-frederic clere wrote: On 03/11/2010 08:30 AM, Mladen Turk wrote: On 03/11/2010 07:52 AM, Costin Manolache wrote: On Wed, Mar 10, 2010 at 10:28 PM, Mladen Turkmt...@apache.org wrote: On 03/10/2010 11:10 PM, Costin Manolache wrote: You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? First goal is to get rid of connectors and use Tomcat directly inside httpd or IIS or new Commons Runtime (replacing Tomcat Native and Daemon) I'm working on. It used to work - about 10 years ago :-) Actually didn't. It worked for IIS and Httpd on windows only since at that time they had a single child process. Now IIS is the same as httpd with worker mpm. That was on of the reasons we kill JK2. JNI inproc connector simply didn't work. One of the big problem is that the prefork and worker models may use several process for the same session and you can't fix a session to a JVM process... Sure. See the initial post. Session sharing is one of the things that has to be done. However this can be easily managed using shared memory or even using memcached At the end you needed a flat cluster with one node for each process and that doesn't scale. In essence it is a cluster, and that's why the subject title is 'reusing instances' since it lives in the same directory. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/11/2010 05:17 PM, Costin Manolache wrote: And what is the problem you are trying to solve ? Those are the same one for which modern web servers have multiple worker processes. One JVM crash doesn't kill the server, recycle the worker process on some condition (memory leak, number of requests, cpu outage, etc. ) The old in-process' goal was speed - replacing marshalling with JNI. I don't think it gained much. More important one is to use the web server connectors directly. It's not about speed, but about eliminating connector as a point of failure. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/11/2010 05:27 PM, Mladen Turk wrote: More important one is to use the web server connectors directly. It's not about speed, but about eliminating connector as a point of failure. hm You still have to move the data for httpd (in C) to Tomcat (in JAVA) so you still have a connector, no? - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/11/2010 05:49 PM, jean-frederic clere wrote: On 03/11/2010 05:27 PM, Mladen Turk wrote: More important one is to use the web server connectors directly. It's not about speed, but about eliminating connector as a point of failure. hm You still have to move the data for httpd (in C) to Tomcat (in JAVA) so you still have a connector, no? Sort of. However there is no network involved and there are no protocol issues that arise from marshalling via proxy. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/10/2010 02:58 PM, Mark Thomas wrote: Work directory, temp directory come to mind. Easier to use a CATALINA_HOME/CATALINA_BASE style approach. The idea IS to use the same directory and same files. I'm trying to locate things that presume Tomcat is running as self contained singleton application and see whether it can be made to be aware of multiple processes that constitute a single servlet engine instance. Work and temp could probably have their own process-id like prefix if not possible to reuse the files or if sync would be too complex. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? Sounds very good ! Costin On Wed, Mar 10, 2010 at 6:17 AM, Mladen Turk mt...@apache.org wrote: On 03/10/2010 02:58 PM, Mark Thomas wrote: Work directory, temp directory come to mind. Easier to use a CATALINA_HOME/CATALINA_BASE style approach. The idea IS to use the same directory and same files. I'm trying to locate things that presume Tomcat is running as self contained singleton application and see whether it can be made to be aware of multiple processes that constitute a single servlet engine instance. Work and temp could probably have their own process-id like prefix if not possible to reuse the files or if sync would be too complex. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/10/2010 11:10 PM, Costin Manolache wrote: You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? First goal is to get rid of connectors and use Tomcat directly inside httpd or IIS or new Commons Runtime (replacing Tomcat Native and Daemon) I'm working on. Second is to have application pools where one could say: Serve WebAppX inside Default Application Pool consisting of 1 ... N processes or use Custom Application pool with some process limitation factors (memory, cpu usage, etc) Third goal is to allow graceful restarts which would allow to reconfigure the entire VM or redeploy the application without down time. Those kind of things is done nowadays by using some sort of clustering where each node actually behaves like one of Httpd's child processes. First thing I'm going to do is the thorough analysis of what actually happens under the hood during different engine life stages and see what resources might require the synchronization or cross-process sharing and how to do that. I know it might sound very complex, but it's actually doing what Tomcat is suppose to do (be a servlet engine), so perhaps Tomcat Light would fit in that story. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On Wed, Mar 10, 2010 at 10:28 PM, Mladen Turk mt...@apache.org wrote: On 03/10/2010 11:10 PM, Costin Manolache wrote: You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? First goal is to get rid of connectors and use Tomcat directly inside httpd or IIS or new Commons Runtime (replacing Tomcat Native and Daemon) I'm working on. It used to work - about 10 years ago :-) Second is to have application pools where one could say: Serve WebAppX inside Default Application Pool consisting of 1 ... N processes or use Custom Application pool with some process limitation factors (memory, cpu usage, etc) This sounds a bit complex - but the big question is why ? If you do multi-process, you can just go simple and say that one process runs a single app - thus resolving most security issues ( no longer need a sandbox ), you can set use limits, etc. Upgrading the app will no longer leak resources, you can have the old version running for a while, in parallel with the new one ( with some tricks in the lb - for example use session to direct to the right version ). Having multi-process and combining multiple apps in a single process seems pointless. The other nice thing would be to fire up the process on demand, and kill them if not used - and maybe start new processes if needed. Third goal is to allow graceful restarts which would allow to reconfigure the entire VM or redeploy the application without down time. Yes, but 1 app ( and one version ) per process would make it easier. Those kind of things is done nowadays by using some sort of clustering where each node actually behaves like one of Httpd's child processes. First thing I'm going to do is the thorough analysis of what actually happens under the hood during different engine life stages and see what resources might require the synchronization or cross-process sharing and how to do that. IMHO if you use such a model, it may be better to change the directory structure - and have all the files ever created by an webapp ( including logs, work dir, etc ) under a single tree. Than you can chroot to it, versioning may also be easier. I know it might sound very complex, but it's actually doing what Tomcat is suppose to do (be a servlet engine), so perhaps Tomcat Light would fit in that story. I don't think it's that hard - starting tomcat7 'standalone', with minimal config and a different dir structure is easy. The trick will be the frontend - load balancer plus logic to start the right processes. Costin Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/11/2010 07:52 AM, Costin Manolache wrote: On Wed, Mar 10, 2010 at 10:28 PM, Mladen Turkmt...@apache.org wrote: On 03/10/2010 11:10 PM, Costin Manolache wrote: You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? First goal is to get rid of connectors and use Tomcat directly inside httpd or IIS or new Commons Runtime (replacing Tomcat Native and Daemon) I'm working on. It used to work - about 10 years ago :-) Actually didn't. It worked for IIS and Httpd on windows only since at that time they had a single child process. Now IIS is the same as httpd with worker mpm. That was on of the reasons we kill JK2. JNI inproc connector simply didn't work. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Reusing instances
On 03/11/2010 08:30 AM, Mladen Turk wrote: On 03/11/2010 07:52 AM, Costin Manolache wrote: On Wed, Mar 10, 2010 at 10:28 PM, Mladen Turkmt...@apache.org wrote: On 03/10/2010 11:10 PM, Costin Manolache wrote: You want to have each webapp served by a different process ? Or even different versions of a webapp in a different process ? First goal is to get rid of connectors and use Tomcat directly inside httpd or IIS or new Commons Runtime (replacing Tomcat Native and Daemon) I'm working on. It used to work - about 10 years ago :-) Actually didn't. It worked for IIS and Httpd on windows only since at that time they had a single child process. Now IIS is the same as httpd with worker mpm. That was on of the reasons we kill JK2. JNI inproc connector simply didn't work. One of the big problem is that the prefork and worker models may use several process for the same session and you can't fix a session to a JVM process... At the end you needed a flat cluster with one node for each process and that doesn't scale. Cheers Jean-Frederic - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org