Tomcat Cluster and session sharing

Source: Internet
Author: User

Generally speaking, Java web App is mainly used as two areas:

1.api. API is generally stateless, so there is no need to consider the issue of session sharing

2. Traditional Web applications and websites, such as Crm,oa,erp,b2c,bbs. Especially bbs,b2c such an Internet application, a single Tomcat is often unable to meet high concurrency, so need to do cluster. If you do a cluster, you often need to consider the issue of session sharing, because LB (apache/nginx) and so on tend to distribute the same user's requests to different servers

Commonly used servlet containers are tomcat (the old Servlet container, as classic as Apache, currently widely used), jetty (lightweight servlet container with better performance, Google has been widely used a few years ago), etc. Today's main talk about Tomcat's cluster scenario

There are two types of scenarios:

I. Forwarding POLICY: LB sets a fixed policy that is distributed to the fixed server according to IP. Not recommended for use

Pros: Just configure the LB, the Web container does not need to be adjusted

Disadvantage: The card sex is relatively poor. The LB may not be forwarded properly because the departmental machine in the cluster may be down

Two. Session sharing: Each server sharing session, so that users always have access to normal

1.cluster Mode http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Advantages: Do not change the original session storage mode

Cons: General performance,

Tomcat Cluster and session sharing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.