"Open Class" "Ali Online Technology Summit" Wei Peng: Practice of multi-application deployment technology based on Java container __java

Source: Internet
Author: User
Tags tomcat

For public classes, this may not be the case at the moment, but it can often help me in the future when I want to solve the solution. The following is Ali's collation of the Open class

Absrtact: In the first Alibaba online summit, Alibaba middleware technology expert Wei Peng for everyone to bring the "Java container based multi-application deployment technology practice" to share, the main content of the first is Ali Java container development process, and then share the current Java container infrastructure, Finally, we discuss some of the higher-order features that can be accomplished after such a change.

This article first introduces the development of Ali Java container, the entire Java container from the beginning to the current stage, and then to share the current Java container infrastructure, and finally discuss with you after such a change, it can complete some of the higher-order characteristics, such as combined deployments and multiple versions of deployments, and so on, are clearly helpful for our efficiency improvements.

The following are the contents of the collation:

The development process of Ali Java container


Alibaba at the beginning, just like ordinary Web site, through the front-end HTTP traffic in the completion of the database query, call, and then feedback back to the data. When the site becomes very big, can not be the same as in the past, only through a single system can complete a number of business functions, we need to split the system, service is the only way, the Java container was born in the service framework of the writing process, with the stage of continuous evolution, has access to many other middleware, The entire process upgrade is very convenient, directly replace the deployed directory to complete the upgrade. Ali Department is developing rapidly, we will also face some challenges, such as the Web site's increasingly long links, calls complex, how the application of the container deployment way to improve our performance, this is a container to consider the problem.

Container schema


The standard schema for the Java container is shown in the figure, based on the application container tomcat, we abstract a set of Java containers that can be understood as a fixed subsystem in Tomcat, in which we cut out two pieces of content, one container, one plug-in, service framework, message component, Configuration components, such as the standard way to access, are closed in their classloader, will not conflict with the application, so that the development of each middleware will not be subject to the choice of other middleware versions. At the same time, the container will provide these plug-in standard deployment mode, lifecycle and event system, so that the start of the middleware can be controlled by us, these middleware can know the application of some of the process of the upper and lower line, so that the entire middleware and application relationships become more natural. Any plug-in can easily access the entire container system and bring these capabilities to the application.

Merge deployment


The horizontal axis represents the scale, the longitudinal shaft represents the deployment complexity, the deployment complexity is actually man-made, the user may divide the company's internal application into multiple, each need to complete the different work, this kind of logical application quantity rise must cause the deployment complexity to become very high. When the application becomes complex, the company's business promotion, will introduce the concept of services, we need to split the different business, the number of machines will be more and the number of applications will increase. Users continue to visit the page, but may pass through many systems, this needs the remote call, the remote call connects two systems to satisfy the user's request, this kind of structure determines, its scale will continuously climb upward, will become more complex, the user request will grow with the website scale unceasingly, Cause the user's request from the actual data source more and more distant, remote call at any point is unreliable, the user in this process to assume the probability of failure will be more and more high, the rate of access will be more and more slow.

So, how to change this situation. Can we use Java containers to deploy different applications together at deployment time?

Determine the optimization path

Our core link is OK, no matter how big your site, the real user to access the system of a certain function is very hot, in the core link is also known hot spots, the most critical is that our flow is fixed, from the entry point of view, optimize the core link in the hot line.

Strong-related multiple application deployments on core links


On the left is the traditional way, the foreground application, service application A and service Application B are all connected by remote tune. The way to deploy multiple deployments is to put these applications that are isolated in the development belt in the same JVM when deployed, together, the remote invocation of the entire system is called into cost, and the process is that the service framework transforms the invocation mode according to the information provided by the Java container. The application of different strong associations is deployed in the same Java container, which makes the whole process smoother.

Remote Call to Local call


The container provides the application information for the current deployment of the service framework, call "look-up table", when making the call, first look at the invocation of the service in the local whether there is another application provided, if there is no network call, the corresponding parameters are transferred directly to complete the local call; Local calls require a "deep copy".

"Deep Copy"

We need to convert the parameters of an application to the data that the other ClassLoader can digest, and to digest the data back to the data that the cost loader can understand, a process called a deep copy.


The performance comparison of deep copy shows that deep copy has an average of only 15% Hessian and no statistical network overhead. In the face of increasing data structure, the advantages of deep copy will become more obvious.

Effect of a merge deployment


More and more access to data from wireless, you can see that qps up more than 50%, the greater the increase in data is more obvious. Performance attenuation is not obvious after a merge deployment, and the trend is very flexible.


In fact, RT dropped 50%, the burr basically disappeared, the link more stable.

What does a merge deployment bring

The merge deployment technology lowers the cost of making the same machines offer a larger number of cars and does not require additional machines. Cost reduction also means that the performance of the promotion, RT dropped significantly.

Multi-version Deployment


The nature of the release is to restart, then, can not restart on the release. The use of multiple versions of deployment can prevent users from restarting. Once all two versions of the application have been deployed into the container, external services to provide the link is constant, the external provision of HTTP traffic, tomcat traffic is unchanged, remote service framework, message processing is also unchanged, when the outside to give the command of the flow, the corresponding old version of the processing logic to the new version of the transition, To complete the release of the corresponding version, the whole process is very smooth and flexible.

Event System

If the high dimensional components do not release the corresponding application and extension, the corresponding application resources are not able to release, the same application of multiple versions are running on a machine, at this time we through the event system to solve this problem.


Releasing resources by responding to events, which are: applying deployment events, applying a fallback deployment event, a traffic shutdown event, and a traffic-opening event.

The container provides not only the ability to deploy multiple applications, at the same time the event to do a certain unified abstraction, the event can go directly to all middleware, all the middleware will respond to the container release events, we will tell all middleware, an application online or offline, traffic began to enter or cut out the application, these events sent, So that the middleware can calmly respond to all changes.

Multi-tenant JVM

Java containers can do type isolation, but do not do resource isolation, we need to complete the corresponding resource isolation, CPU, memory, I/O bandwidth needs to be isolated. How to do it.


The cricket JVM, which supports the alijdk of multi-tenant deployments, contains a multi-tenant API that creates a separate container in which resources are isolated and, in this isolated area, even if there is a memory leak, it does not affect another region, The CPU consumption that operates in this area does not affect the corresponding execution logic of another region, which is the technology needed to complete resource isolation in multiple versions of deployment.


Rely on tenant to do resource isolation. The context corresponds to the webapp tenant to destroy tenant

What has been the release of multiple deployments is very fast: the implementation of the full volume of the release, free to cut the flow. Second level rollback: The old version is temporarily off the line, the speed roll back.


Summary and Prospect Multi-application deployment is a change in the way we apply deployment and think about dimensions. The deployment of a strong link-related application through a consolidated deployment has led to improved performance. Multi-version deployment and release speed. Support for modular applications. High-density deployment. Reference: https://yq.aliyun.com/articles/57826 speech PDF: "Open Class" "Ali Online Technology Summit" Wei Peng: Multi-application deployment technology based on Java container. PDF "HTTP://PAN.BAIDU.COM/S/1GEUXWXT"

Related Article

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.