See hot Deployment and hot load

Source: Internet
Author: User
Tags cloud computing platforms reflection
one, hot deployment and hot loadWhen the app is running, upgrade the software without restarting it in two ways, hot deployment and hot load. For Java applications, a hot deployment is the redeployment of the project while the server is running, and the hot load reloads the class at runtime to upgrade the app. Difference: Hot load: The server will listen to the class file changes, including Web-inf/class,wen-inf/lib,web-inf/web.xml and other files, if changes occur, the local load, do not empty session, do not release memory. The development is used much, but consider the case of memory overflow. Hot deployment: The entire project is newly deployed, including your new hit . War file. Clears the session and frees up memory. The project is packed with more time.
Second, the realization principleThe implementation principle of unloading relies on Java's class loading mechanism, which can be summed up as a background thread when the container is started, timed timestamp change of the detection class file, and reload the class if the timestamp of the class is changed. Contrast reflection mechanism, reflection is to obtain the class information at run time, change the program behavior by the dynamic call, and unloading change the program behavior by reloading the class information at run time. The principle of hot deployment is similar, but it is a direct reload of the entire application, which frees up memory, the specific heat load is more clean and thorough, but also more time-consuming. third, in the Java application 1. Production environmentThermal deployment as a more flexible mechanism, in the actual production of the use of or have, but relatively few, unloading is basically no application. Analysis of the following, security hot load this direct modification of the JVM byte code is difficult to monitor, unlike SQL and other execution can log logs, direct bytecode modification almost can not record the changes in code logic, the impact of the existing code behavior is difficult to control, for the more security-oriented applications, the greater the risk of hot load, It's like replacing an engine with a plane in flight. Second, the most suitable scenario technology is linked to demand, and the need for hot deployment of the scenario is very few. Frequent deployments and start-up applications where time-consuming applications cannot stop service in production, there are no applications that need to be deployed frequently, even agile, and fast is also a weekly iteration, and through business partitioning and modular programming, the cost of deployment is completely negligible, and for existing applications, startup time is longer, It's not too long to be tolerated, and if it's really that long, it's more about how to split the module and deploy it in a distributed way. For applications that cannot stop the service, such as distributed applications such as today's cloud computing platforms, which can be used in batches to meet demand, a similar thermal deployment scenario should be the solution that is put in the final consideration.
2. Development environmentIn production, there will be no frequent deployment and start-up of long-time applications, but due to the rise of cloud computing, thermal deployment still has its applications. And the hot load is a little bit of fire, too dangerous. However, in the development and debug, the frequent launch of applications are everywhere, the hot load mechanism can greatly improve the development efficiency. These two mechanisms, in development, there is another type of call-developer mode. For large projects: it is often time to start/stop waiting for a few minutes. The more wasted time is, for a class of methods in the debugging process, if modified multiple times, need to repeatedly start and stop the server, wasting more time. Taking the current CRM project as an example, its start time is 5m, with a one-day debug restart 10 times, one months of work 20 days to calculate, the annual restart time of 25 people, if you can fully use the hot load, save the restart for nearly 1 months each year.
SummaryIn the actual production of hot deployment in the cloud computing a lot, but unloading not, and in the development, hot load can significantly improve productivity, strongly recommend the use of hot load mode, not only Tomcat, most other servlet containers also support this way, you can search for the relevant skills.

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.