Skip to main content

Posts

Showing posts with the label multiple_instances

Docker : Tomcat Clustering with Load Balancer (Tomcat and Nginx)

In this post i will show Tomcat Clustering in Docker Container. In  my previous post i discussed how to achieve tomcat clustering with Nginx Front end . Its almost same scenario, but this time we will achieve via docker container. Docker Docker  is an  open-source  project that automates the deployment of  applications  inside  software containers , by providing an additional layer of abstraction and automation of  operating-system-level virtualization  on  Linux . [4]  Docker uses resource isolation features of the Linux kernel  such as  cgroups  and kernel  namespaces  to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting and maintaining  virtual machine   --Wikipedia

Tomcat Clustering Series Part 5 : NginX as Load Balancer

Hi this is my fifth part of the  Tomcat Clustering Series . In this post we are going to discuss how to replace Apache httpd load balancer to Nginx as a load balancer.  [Check the video below for better understanding] Hi i finished Tomcat Clustering Series . In these series we have 2 big setups needed for Tomcat Clustering Setup and configure the Load Balancer Configure the Session Replication in Tomcat. In first setup, we configure the Load Balancer using Apache httpd web server. Its open source and widely used. Second setup is session replication in Tomcat through modify/add <cluster> tag in server.xml file. These tomcat instance may run on single machine or different machine. In our Tomcat Clustering Series , the big part is configure the Load balancer (Apache httpd web server). Because there are lots of steps are involved Install the Apache httpd web server from either source or repo Compile and install the mod_jk connector Create the workers.pr

Tomcat Clustering Series Part 4 : Session Replication using Backup Manager

Hi this is my fourth part of the  Tomcat Clustering Series . In this post we are going to discuss the how to setup session replication using Backup Manager in tomcat clustering environment. Session replication makes High availability and full fail-over capability to our clustering environment. [Check the video below for better understanding] Its continuation of the last post (session replication using Delta Manager) . In delta manager each tomcat instance need to replicate the session information to all other tomcat instances. Its take more time and replication if our cluster size is increased. so there is alternative manager is there. Its Backup Manager. Backup Manager is replicate the copy of session data to exactly one other tomcat instances. This big difference between both managers. here which tomcat creates that is primary copy of the session. and another tomcat whose hold the replicate session is backup copy . If any one of the tomcat is down. back up tomcat serve the ses

Tomcat Clustering Series Part 3 : Session Replication

Hi this is my third part of the  Tomcat Clustering Series . In this post we are going to discuss the how to setup session replication in tomcat clustering environment. Session replication makes High availability and full fail-over capability to our clustering environment. [Check the video below for better understanding] In my previous post we discussed about setup simple load balancer and how to make session affinity concepts. How to setup Session Replication in tomcat    before going to session replication we need to understand 2 important concepts Multicast Session Manager in Tomcat Multicast       Multicast is To transmit a single message to a select group of recipients. here multicast used by tomcat cluster to identify the instances those part of cluster.  There is 2 types of cluster Static Tomcat Cluster Dynamic Tomcat Cluster In static cluster there is no need multicast, because each tomcat we statically defined/configured the other instances. Bu

Tomcat Clustering Series Part 2 : Session Affinity Load Balancer

Hi this second part of the  Tomcat Clustering Series . In my first part we discuss about how to setup simple load balancer. and we seen how load balancer distribute the request to tomcat instance in round robin fashion. [Check the video below for better understanding] In this post we discuss about what is the problem is occur in simple load balancer when we introduce sessions in our web application. and we will see how to resolve this issue. Its continuation of my first part of this series. so kindly go read my first part then continue here. How Session works in Servlet/Tomcat?        Before going into problem, let see the session management in Tomcat . If any if the page/servlet create the session then Tomcat create the Session Object and attached into group of session (HashMap kind structure) and that session can identify using session-id, its just random number generated through any one of the hash algorithm. then respond to client with cookie header field. That cookie

Tomcat Clustering Series Part 1 : Simple Load Balancer

I am going to start new series of posts about Tomcat clustering . In this first post we will see what is problem in normal deployment in only single machine, what is clustering and why is necessary and how to setup the simple load balancer with Apache httpd web server + Tomcat server cluster. [Check the video for better understanding] Why need Clustering? (Tomcat Clustering)            In normal production servers are running in single machine. If that's machine may be failed due to crashed or hardware defects or OutOfMemory exception then  our site can't access by anybody. so how to solve this problem? . to add more tomcat machine to collectively (group/cluster) run as a production server. (oppose of single machine). Each tomcat has deployed the same web application. so any tomcat can process the client request. If one tomcat is failed, then other tomcat in the cluster to proceeds the request. Here one big problem is arrive. each tomcat instances are running in de

Running Multiple Tomcat Instances on Single Machine

In this post we will see how to run multiple tomcat instances on single machine and under single user account. We first see the  tomcat directory structure. . here each folder uses following purpose. bin -  It contains all binary and script files for running tomcat. lib - contains all shared libraries used for tomcat conf - contains configuration information like which port tomcat can bind , etc... logs - it contain all logging details temp - this folder tomcat used for temporary files purpose webapps - this folder is very important. here we put all application war files. work - If application contain any jsp then jsp is translated and converted into servlet its stores here. In when run the tomcat its uses 5 environment variables. They are  CATALINA_HOME, CATALINA_BASE, CATALINA_TMPDIR, JRE_HOME/JAVA_HOME, CLASSPATH in above list CATALINA_HOME and JAVA_HOME is mandatory environment variables. all others are optional and its c