Re: simple way to access application in multi instance envirnoment
On Mon, Mar 10, 2014 at 9:03 AM, Daniel Mikusa wrote: > On Mar 9, 2014, at 11:05 AM, Neven Cvetkovic > wrote: > > Thus, if you run multiple instances of Tomcat - alone, virtual hosting > will > > not help you , since only one process can bind to a single IP address to > > one port (e.g. port 80). So, either put everything to the same Tomcat > > ("yuck"), > > Just wanted to point out that there is nothing wrong with this approach. > There are cases where it is a good idea. One example would be when > running lots of small sites. There is overhead for running an each JVM and > Tomcat instance. If you have a large number of small sites, it might makes > sense to combine them into one or a few Tomcat instances to reduce that > overhead. > > Dan > > +1. Dan, that's a great use case for single instance Tomcat. However, keep in mind - in the ideal world, where we have infinite amount of resources (staff, hardware, electricity, memory, etc...) - you would want each application on its own Tomcat instance, and we generally make apps coexist on the same Tomcat instance for optimization purposes (reducing hardware to manage, reducing staff to support various instances, preserving electricity, etc...) Another example that I've seen is to have a single instance, with a single application - but hosted for various domains, with some dynamic white-labeling application, e.g. webmail client, mailing list software, etc...
RE: simple way to access application in multi instance envirnoment
> -Original Message- > From: Ahmed Dalatony [mailto:ahmed.dalat...@gmail.com] > Sent: Sunday, March 09, 2014 2:16 PM > To: Tomcat Users List > Subject: Re: simple way to access application in multi instance > envirnoment > > On Sun, Mar 9, 2014 at 7:48 PM, Neven Cvetkovic > wrote: > > > On Sun, Mar 9, 2014 at 11:29 AM, Ahmed Dalatony > > > >wrote: > > > > > On Sun, Mar 9, 2014 at 5:05 PM, Neven Cvetkovic > > > wrote: > > > > > > > Ahmed, > > > > > > > > On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony < > > > ahmed.dalat...@gmail.com > > > > >wrote: > > > > > > > > > hello, > > > > > > > > > can you help me little more with example or simpler doc > > > > > i'm new to tomcat config > > > > > and i don't understand virtual host > > > > > > > > > > thank you > > > > > > > > What environment do you use? e.g. Windows, Linux, etc. > > If Linux, what flavour of Linux? e.g. RHEL (CentOS, Fedora), Ubuntu, > etc. > > What webserver would you like to use? e.g. Apache HTTPD, IIS, nginx, > etc. > > > > They all have different ways to configure your setup. > > > > - The easier one to setup is to use mod_proxy, check examples here: > > https://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html > > > > - More common is to use AJP protocol and mod_jk in Apache, check > > examples > > here: > > http://tomcat.apache.org/connectors-doc/generic_howto/quick.html > > http://tomcat.apache.org/connectors-doc/reference/apache.html > > > > Hope that helps. > > n. > > > > hello, > I'm using win server 2008 running a combination of tomcat 6, tomcat 7, > oc4j 10g on different ports the resources you supplied are very handy > but they explain accessing http://www.myhost.com:/App1 from > http://www.myhost.com/App1 > is it applicable to be accessed from URL like this > http://App1.myhost.com > > thanks, If you really want the last URL style, http://app.mydomain.com/, then you can do it with any of the alternatives Neven mentioned, except Alt_0. For Alt_1 and Alt_2, once you set up the tags, you set up each App as the ROOT context. Hint: It's best to view this as setting up a single host to do one app as ROOT, and then just apply it to multiple . For Alt_2, you can assign multiple IPs to a single network interface in Windows, in case you have a limited number of physical ports. With your explanation of your current setup, I'd say you'd want either Alt_2 or Alt_3. For Alt_2, it's just reconfiguring your server.xml files to specify the address= parameter on the tag, and set the port to 80, with each Tomcat getting a unique IP. Alt_3 can be accomplished without modifying your current Tomcats, or not modifying them by much, and offers a little more flexibility, but you have a learning curve ahead of you on configuring the Apache HTTPd server appropriately. However, it would give you the option of adding additional Tomcats for an app with the httpd server acting as a load balancer if you find you need additional capacity for that one app. Of course, don't forget the DNS mapping of the new hostnames to IP addresses. I do this all the time in my environment, and actually have servers setup in a combined Alt_1 & Alt_2 environment. That is, multiple Tomcat instances, some dedicated to a specific host, some using virtual hosting, all on the same server. Jeff - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: simple way to access application in multi instance envirnoment
On Mar 9, 2014, at 11:05 AM, Neven Cvetkovic wrote: > Ahmed, > > On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony > wrote: > >> hello, >> > can you help me little more with example or simpler doc >> i'm new to tomcat config >> and i don't understand virtual host >> >> thank you >> > > Ultimately, if you don't want to show the port number to the end user, the > serving process needs to bind to port 80. > > You mentioned few Tomcat processes, bound to ports , , , each > serving few applications. > > So, here are few alternatives to achieve what you want: > > ALTERNATIVE_0 > - Don't do anything. Each Tomcat instance runs on it's own port number. > - Doesn't achieve what you want :) > > ALTERNATIVE_1 > - Host all applications on a single Tomcat instance. Bind Tomcat to port 80 > (if linux environment remember port 80 is privileged port, so you have to > configure your Tomcat accordingly.) Register all domains to the same IP > address. > - You can use Tomcat virtual hosting to register different domains to > specific applications. > - Downside of this approach is that all applications are sharing the same > JVM (Tomcat) instance. Spike in one application can bring all other > applications down. > > ALTERNATIVE_2 > - Have multiple network interfaces (IP addresses) available. Bind each > Tomcat instance to one of the IP addresses. Register each domain to its own > IP address. > - This approach is better than ALTERNATIVE_1 when it comes to isolation of > the processes in their own execution environments. > - This approach utilizes many IP addresses, that are usually scarce and not > easily justified for numerous applications. > > ALTERNATIVE_3 > - Most common approach I've seen around. > - Similar to approach you are currently taking (ALTERNATIVE_0), with a help > of external web server that will act as a (reverse) proxy. Typically, I > would use Apache Httpd server, but you can use other web servers, e.g. IIS > on Windows platform, or nginx. > - In this case Apache (or other webserver) would bind to port 80, and based > on the requested URL (or host) would point to a specific application > (hosted on specific Tomcat on certain port, e.g. , , , etc...) > - If you would like to achieve that different hosts point to different > applications, register all domains with the same IP address in DNS, and > configure virtual hosting on the web server. +1 Good explanation > Thus, if you run multiple instances of Tomcat - alone, virtual hosting will > not help you , since only one process can bind to a single IP address to > one port (e.g. port 80). So, either put everything to the same Tomcat > ("yuck”), Just wanted to point out that there is nothing wrong with this approach. There are cases where it is a good idea. One example would be when running lots of small sites. There is overhead for running an each JVM and Tomcat instance. If you have a large number of small sites, it might makes sense to combine them into one or a few Tomcat instances to reduce that overhead. Dan > or bind each tomcat to port 80 on separate IP addresses, or have > an external web server routing requests to your multiple Tomcat instances. > My preference is the later approach. > > Here are some questions you want to answer before choosing the alternative: > - What is the environment that you run on (windows, linux, etc.)? > - What are you requirements? > - How many applications do you have? How many instances do you plan to run, > on the same machine, on the entire platform? > - What are the application usage patterns? (how many users do you plan to > serve, spikes, etc..) > - What are the service level agreements you have with your customers? > - etc... > > > Configuring webserver to route requests to Tomcat instances is pretty > straight forward, and you have a choice of HTTP or AJP protocols and > depends on the choice of your webserver (Apache HTTPD, IIS, nginx, etc.) > > Hope that helps. > > Cheers! > Neven - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: simple way to access application in multi instance envirnoment
On 3/9/2014 10:05 AM, Neven Cvetkovic wrote: Ahmed, On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony wrote: hello, can you help me little more with example or simpler doc i'm new to tomcat config and i don't understand virtual host thank you Ultimately, if you don't want to show the port number to the end user, the serving process needs to bind to port 80. You mentioned few Tomcat processes, bound to ports , , , each serving few applications. So, here are few alternatives to achieve what you want: ALTERNATIVE_0 - Don't do anything. Each Tomcat instance runs on it's own port number. - Doesn't achieve what you want :) ALTERNATIVE_1 - Host all applications on a single Tomcat instance. Bind Tomcat to port 80 (if linux environment remember port 80 is privileged port, so you have to configure your Tomcat accordingly.) Register all domains to the same IP address. - You can use Tomcat virtual hosting to register different domains to specific applications. - Downside of this approach is that all applications are sharing the same JVM (Tomcat) instance. Spike in one application can bring all other applications down. ALTERNATIVE_2 - Have multiple network interfaces (IP addresses) available. Bind each Tomcat instance to one of the IP addresses. Register each domain to its own IP address. - This approach is better than ALTERNATIVE_1 when it comes to isolation of the processes in their own execution environments. - This approach utilizes many IP addresses, that are usually scarce and not easily justified for numerous applications. ALTERNATIVE_3 - Most common approach I've seen around. - Similar to approach you are currently taking (ALTERNATIVE_0), with a help of external web server that will act as a (reverse) proxy. Typically, I would use Apache Httpd server, but you can use other web servers, e.g. IIS on Windows platform, or nginx. - In this case Apache (or other webserver) would bind to port 80, and based on the requested URL (or host) would point to a specific application (hosted on specific Tomcat on certain port, e.g. , , , etc...) - If you would like to achieve that different hosts point to different applications, register all domains with the same IP address in DNS, and configure virtual hosting on the webserver. Thus, if you run multiple instances of Tomcat - alone, virtual hosting will not help you , since only one process can bind to a single IP address to one port (e.g. port 80). So, either put everything to the same Tomcat ("yuck"), or bind each tomcat to port 80 on separate IP addresses, or have an external web server routing requests to your multiple Tomcat instances. My preference is the later approach. Here are some questions you want to answer before choosing the alternative: - What is the environment that you run on (windows, linux, etc.)? - What are you requirements? - How many applications do you have? How many instances do you plan to run, on the same machine, on the entire platform? - What are the application usage patterns? (how many users do you plan to serve, spikes, etc..) - What are the service level agreements you have with your customers? - etc... Configuring webserver to route requests to Tomcat instances is pretty straight forward, and you have a choice of HTTP or AJP protocols and depends on the choice of your webserver (Apache HTTPD, IIS, nginx, etc.) Hope that helps. Cheers! Neven Nice explanation. -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: simple way to access application in multi instance envirnoment
Ahmed, On Sun, Mar 9, 2014 at 3:15 PM, Ahmed Dalatony wrote: > I'm using win server 2008 running a combination of tomcat 6, tomcat 7, oc4j > 10g on different ports > the resources you supplied are very handy > but they explain accessing http://www.myhost.com:/App1 from > http://www.myhost.com/App1 > is it applicable to be accessed from URL like this http://App1.myhost.com Nice! That's exactly a usecase when we want to use a webserver to aggregate the applications under the same domain. So, start first with that setup, e.g. http://www.myhost.com/App1 --> tomcat6_instance1_app1 http://www.myhost.com/App2 --> tomcat6_instance1_app2 http://www.myhost.com/App3 --> tomcat6_instance2_app3 http://www.myhost.com/App4 --> tomcat7_instance1_app4 http://www.myhost.com/App5 --> oc4j_instance1_app5 ... I am mostly familiar with Apache Httpd server (or just simply "Apache" web server), so I would recommend that solution. However, you could achieve similar setup with IIS as well. Here's Apache configuration example: http://httpd.apache.org/docs/2.2/vhosts/examples.html You can download this version of Apache: http://httpd.apache.org/download.cgi --> Binaries --> win32 e.g. (one of the mirrors gets selected by the download.cgi) http://apache.mirrors.spacedump.net//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi Or alternatively, that OC4J might have an instance of OHS already running (which is a version of Apache Httpd server). I don't know which OC4J 10g version you use, probably 10.1.2.0.2 - which had OHS based on Apache 1.3.x. - you might want to upgrade that to the latest Apache or IIS. Cheers! n.
Re: simple way to access application in multi instance envirnoment
On Sun, Mar 9, 2014 at 7:48 PM, Neven Cvetkovic wrote: > On Sun, Mar 9, 2014 at 11:29 AM, Ahmed Dalatony >wrote: > > > On Sun, Mar 9, 2014 at 5:05 PM, Neven Cvetkovic > > wrote: > > > > > Ahmed, > > > > > > On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony < > > ahmed.dalat...@gmail.com > > > >wrote: > > > > > > > hello, > > > > > > > can you help me little more with example or simpler doc > > > > i'm new to tomcat config > > > > and i don't understand virtual host > > > > > > > > thank you > > > > > What environment do you use? e.g. Windows, Linux, etc. > If Linux, what flavour of Linux? e.g. RHEL (CentOS, Fedora), Ubuntu, etc. > What webserver would you like to use? e.g. Apache HTTPD, IIS, nginx, etc. > > They all have different ways to configure your setup. > > - The easier one to setup is to use mod_proxy, check examples here: > https://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html > > - More common is to use AJP protocol and mod_jk in Apache, check examples > here: > http://tomcat.apache.org/connectors-doc/generic_howto/quick.html > http://tomcat.apache.org/connectors-doc/reference/apache.html > > Hope that helps. > n. > hello, I'm using win server 2008 running a combination of tomcat 6, tomcat 7, oc4j 10g on different ports the resources you supplied are very handy but they explain accessing http://www.myhost.com:/App1 from http://www.myhost.com/App1 is it applicable to be accessed from URL like this http://App1.myhost.com thanks,
Re: simple way to access application in multi instance envirnoment
On Sun, Mar 9, 2014 at 11:29 AM, Ahmed Dalatony wrote: > On Sun, Mar 9, 2014 at 5:05 PM, Neven Cvetkovic > wrote: > > > Ahmed, > > > > On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony < > ahmed.dalat...@gmail.com > > >wrote: > > > > > hello, > > > > > can you help me little more with example or simpler doc > > > i'm new to tomcat config > > > and i don't understand virtual host > > > > > > thank you > > What environment do you use? e.g. Windows, Linux, etc. If Linux, what flavour of Linux? e.g. RHEL (CentOS, Fedora), Ubuntu, etc. What webserver would you like to use? e.g. Apache HTTPD, IIS, nginx, etc. They all have different ways to configure your setup. - The easier one to setup is to use mod_proxy, check examples here: https://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html - More common is to use AJP protocol and mod_jk in Apache, check examples here: http://tomcat.apache.org/connectors-doc/generic_howto/quick.html http://tomcat.apache.org/connectors-doc/reference/apache.html Hope that helps. n.
Re: simple way to access application in multi instance envirnoment
On Sun, Mar 9, 2014 at 5:05 PM, Neven Cvetkovic wrote: > Ahmed, > > On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony >wrote: > > > hello, > > > can you help me little more with example or simpler doc > > i'm new to tomcat config > > and i don't understand virtual host > > > > thank you > > > > Ultimately, if you don't want to show the port number to the end user, the > serving process needs to bind to port 80. > > You mentioned few Tomcat processes, bound to ports , , , each > serving few applications. > > So, here are few alternatives to achieve what you want: > > ALTERNATIVE_0 > - Don't do anything. Each Tomcat instance runs on it's own port number. > - Doesn't achieve what you want :) > > ALTERNATIVE_1 > - Host all applications on a single Tomcat instance. Bind Tomcat to port 80 > (if linux environment remember port 80 is privileged port, so you have to > configure your Tomcat accordingly.) Register all domains to the same IP > address. > - You can use Tomcat virtual hosting to register different domains to > specific applications. > - Downside of this approach is that all applications are sharing the same > JVM (Tomcat) instance. Spike in one application can bring all other > applications down. > > ALTERNATIVE_2 > - Have multiple network interfaces (IP addresses) available. Bind each > Tomcat instance to one of the IP addresses. Register each domain to its own > IP address. > - This approach is better than ALTERNATIVE_1 when it comes to isolation of > the processes in their own execution environments. > - This approach utilizes many IP addresses, that are usually scarce and not > easily justified for numerous applications. > > ALTERNATIVE_3 > - Most common approach I've seen around. > - Similar to approach you are currently taking (ALTERNATIVE_0), with a help > of external web server that will act as a (reverse) proxy. Typically, I > would use Apache Httpd server, but you can use other web servers, e.g. IIS > on Windows platform, or nginx. > - In this case Apache (or other webserver) would bind to port 80, and based > on the requested URL (or host) would point to a specific application > (hosted on specific Tomcat on certain port, e.g. , , , etc...) > - If you would like to achieve that different hosts point to different > applications, register all domains with the same IP address in DNS, and > configure virtual hosting on the webserver. > > > Thus, if you run multiple instances of Tomcat - alone, virtual hosting will > not help you , since only one process can bind to a single IP address to > one port (e.g. port 80). So, either put everything to the same Tomcat > ("yuck"), or bind each tomcat to port 80 on separate IP addresses, or have > an external web server routing requests to your multiple Tomcat instances. > My preference is the later approach. > > Here are some questions you want to answer before choosing the alternative: > - What is the environment that you run on (windows, linux, etc.)? > - What are you requirements? > - How many applications do you have? How many instances do you plan to run, > on the same machine, on the entire platform? > - What are the application usage patterns? (how many users do you plan to > serve, spikes, etc..) > - What are the service level agreements you have with your customers? > - etc... > > > Configuring webserver to route requests to Tomcat instances is pretty > straight forward, and you have a choice of HTTP or AJP protocols and > depends on the choice of your webserver (Apache HTTPD, IIS, nginx, etc.) > > Hope that helps. > > Cheers! > Neven > thanks Dan & Neven i think 3rd alternative is my way to go i'll start searching about it and see what i get
Re: simple way to access application in multi instance envirnoment
Ahmed, On Sun, Mar 9, 2014 at 10:14 AM, Ahmed Dalatony wrote: > hello, > can you help me little more with example or simpler doc > i'm new to tomcat config > and i don't understand virtual host > > thank you > Ultimately, if you don't want to show the port number to the end user, the serving process needs to bind to port 80. You mentioned few Tomcat processes, bound to ports , , , each serving few applications. So, here are few alternatives to achieve what you want: ALTERNATIVE_0 - Don't do anything. Each Tomcat instance runs on it's own port number. - Doesn't achieve what you want :) ALTERNATIVE_1 - Host all applications on a single Tomcat instance. Bind Tomcat to port 80 (if linux environment remember port 80 is privileged port, so you have to configure your Tomcat accordingly.) Register all domains to the same IP address. - You can use Tomcat virtual hosting to register different domains to specific applications. - Downside of this approach is that all applications are sharing the same JVM (Tomcat) instance. Spike in one application can bring all other applications down. ALTERNATIVE_2 - Have multiple network interfaces (IP addresses) available. Bind each Tomcat instance to one of the IP addresses. Register each domain to its own IP address. - This approach is better than ALTERNATIVE_1 when it comes to isolation of the processes in their own execution environments. - This approach utilizes many IP addresses, that are usually scarce and not easily justified for numerous applications. ALTERNATIVE_3 - Most common approach I've seen around. - Similar to approach you are currently taking (ALTERNATIVE_0), with a help of external web server that will act as a (reverse) proxy. Typically, I would use Apache Httpd server, but you can use other web servers, e.g. IIS on Windows platform, or nginx. - In this case Apache (or other webserver) would bind to port 80, and based on the requested URL (or host) would point to a specific application (hosted on specific Tomcat on certain port, e.g. , , , etc...) - If you would like to achieve that different hosts point to different applications, register all domains with the same IP address in DNS, and configure virtual hosting on the webserver. Thus, if you run multiple instances of Tomcat - alone, virtual hosting will not help you , since only one process can bind to a single IP address to one port (e.g. port 80). So, either put everything to the same Tomcat ("yuck"), or bind each tomcat to port 80 on separate IP addresses, or have an external web server routing requests to your multiple Tomcat instances. My preference is the later approach. Here are some questions you want to answer before choosing the alternative: - What is the environment that you run on (windows, linux, etc.)? - What are you requirements? - How many applications do you have? How many instances do you plan to run, on the same machine, on the entire platform? - What are the application usage patterns? (how many users do you plan to serve, spikes, etc..) - What are the service level agreements you have with your customers? - etc... Configuring webserver to route requests to Tomcat instances is pretty straight forward, and you have a choice of HTTP or AJP protocols and depends on the choice of your webserver (Apache HTTPD, IIS, nginx, etc.) Hope that helps. Cheers! Neven
Re: simple way to access application in multi instance envirnoment
On Sun, Mar 9, 2014 at 2:13 PM, Daniel Mikusa wrote: > On Mar 9, 2014, at 8:08 AM, Ahmed Dalatony > wrote: > > > hello, > > i'm running a server with multiple instance of tomcat > > each instance has some apps deployed & accessed with host:port > > like > > myhost.com:/app1 > > myhost.com:/app2 > > myhost.com:/app3 > > > > is there any way to hide the port from users & making app URL simpler > with > > keeping multi instance ??? > > like this or any thing near > > app1.myhost.com > > app2.myhost.com > > app3.myhost.com > > Maybe virtual hosting? > > http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html > > Dan > > > > > > > thanks in advance > > > hello, can you help me little more with example or simpler doc i'm new to tomcat config and i don't understand virtual host thank you
Re: simple way to access application in multi instance envirnoment
On Mar 9, 2014, at 8:08 AM, Ahmed Dalatony wrote: > hello, > i'm running a server with multiple instance of tomcat > each instance has some apps deployed & accessed with host:port > like > myhost.com:/app1 > myhost.com:/app2 > myhost.com:/app3 > > is there any way to hide the port from users & making app URL simpler with > keeping multi instance ??? > like this or any thing near > app1.myhost.com > app2.myhost.com > app3.myhost.com Maybe virtual hosting? http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html Dan > > > thanks in advance - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
simple way to access application in multi instance envirnoment
hello, i'm running a server with multiple instance of tomcat each instance has some apps deployed & accessed with host:port like myhost.com:/app1 myhost.com:/app2 myhost.com:/app3 is there any way to hide the port from users & making app URL simpler with keeping multi instance ??? like this or any thing near app1.myhost.com app2.myhost.com app3.myhost.com thanks in advance