Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C0D27106F7 for ; Sun, 9 Mar 2014 15:30:32 +0000 (UTC) Received: (qmail 96889 invoked by uid 500); 9 Mar 2014 15:30:29 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 96562 invoked by uid 500); 9 Mar 2014 15:30:28 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 96548 invoked by uid 99); 9 Mar 2014 15:30:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Mar 2014 15:30:27 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ahmed.dalatony@gmail.com designates 209.85.160.173 as permitted sender) Received: from [209.85.160.173] (HELO mail-yk0-f173.google.com) (209.85.160.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Mar 2014 15:30:20 +0000 Received: by mail-yk0-f173.google.com with SMTP id 10so16447591ykt.4 for ; Sun, 09 Mar 2014 08:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=KzwPtGIwFjvybzFH/xgNSoQnwLAloj/eRv+bhDhaRu8=; b=tnsmXTypz8GXtVfkwO1YMy1Ik5UE1Zy/QbmhdOft9iil3YBAfITDMk5pxp/NVKHUEn /ZpV2RBAlSExZUH80M8ORgsoV25FEUlywxXJwAK4tXxqgjom2n5WM8bOmeL7G2VjHd7s xPMPa8yRuXrlaSMrhIyMvKHY/rgOQqAJ9lbNDGQnyNT1cZj/2wpyaSQAX49xBsBsZt8n 0ED3IgHASe41X+Nd5PtNbXCaxN5rkB+IYkEF9M3HTQ8jWUMDDAOhDWPrD6afmguDFDw5 N4gYJhyZ8+7SEOGK82+PsACx28AN4KKhN6whwth4Zt9xWU+8c8qaheS+ozHgSN5nSYl0 tl/Q== MIME-Version: 1.0 X-Received: by 10.236.157.167 with SMTP id o27mr181551yhk.127.1394378998982; Sun, 09 Mar 2014 08:29:58 -0700 (PDT) Received: by 10.170.195.16 with HTTP; Sun, 9 Mar 2014 08:29:58 -0700 (PDT) In-Reply-To: References: <4F6940CF-48C2-4E64-A0FF-DC34697DF9CC@gopivotal.com> Date: Sun, 9 Mar 2014 17:29:58 +0200 Message-ID: Subject: Re: simple way to access application in multi instance envirnoment From: Ahmed Dalatony To: Tomcat Users List Content-Type: multipart/alternative; boundary=20cf303f676ceab20004f42e2868 X-Virus-Checked: Checked by ClamAV on apache.org --20cf303f676ceab20004f42e2868 Content-Type: text/plain; charset=ISO-8859-1 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 7777, 8888, 9999, 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. 7777, 8888, 9999, 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 --20cf303f676ceab20004f42e2868--