In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "what is Tomcat". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Tomcat monitoring and management tools
Tomcat Monitor module is a Tomcat monitoring and diagnosis module, which provides some basic tools to monitor and diagnose Tomcat connection pooling, threads, memory, class loading and JVM related. The emergence of Tomcat Monitor not only solves the embarrassing problem that the majority of developers are unable to locate online problems quickly, but also helps developers to troubleshoot problems and view the running status of programs through simple and unified command-line tools, without the need to use a variety of tools, including jmap, jstat and BTrace.
The Tomcat Monitor module is integrated into the Tomcat server and can monitor and diagnose threads, connection pooling, memory and class loading in detail and in real time.
Monitor and manage connection pool
Figure 6-1-View the basic status of Tomcat connections
Figure 6-1-View the basic status of Tomcat connections
Detect those slow connections in the current Tomcat server
Figure 6-2-detect slow connections
Figure 6-2-detect slow connections
Thread deadlock detection
Figure 6-3-Thread deadlock detection
Figure 6-3-Thread deadlock detection
As you can see, the threads pool-1-thread-1 and pool-1-thread-2 are deadlocked. The following two lines clearly describe the cause of the deadlock:
Figure 6-4-cause of deadlock
Thread-2 blocks on the object java.lang.String@114a3c6 locked by thread-1
Thread-1 blocks on the object java.lang.String@c4cee locked by thread-2
Two threads wait for each other, resulting in a deadlock.
The output also shows the thread stack where the deadlock occurred so that developers can further investigate the cause of the deadlock.
Diagnose threads with high CPU usage
Displays a list of threads whose cpu% has been too high for a recent period of time, as well as the cpu%. of the most recent statistics
When you encounter annoying ClassNotFoundException or NoClassDefFoundError exceptions, you can locate the loading of the class
Figure 6-6-detect class loading
Figure 6-6-detect class loading
For the monitoring and diagnosis of application servers, the follow-up development plan is to integrate other excellent Java monitoring and diagnosis tools such as HouseMD on the basis of the current Tomcat Monitor, so that different tools can be used by developers in a unified way. At the same time, it will also communicate with the mature monitoring and alarm system within the company as a data provider to help more in-depth monitoring of the operation of the application.
6.2.Isolate container Pandora
Pandora, whose Chinese name is Pandora, is a new generation of isolation containers built by Ali middleware team and based on HSF isolation technology. In order to solve the two-party package dependence conflict, we are committed to unified management of the general two-party package, including convenient upgrade management, monitoring and management, establishing a unified second-party package expansion programming mode, and so on. Pandora-Framework, which is modified on the basis of Pandora container, is a modular running framework similar to OSGi. Its output makes OSGi, a mysterious technology hidden in application servers and IDE tools, into our foreground application system for the first time in a production environment. Since the launch of the shared business transaction process system in September 2013, it will be gradually applied to the entire Ali transaction process system, building a modular operating environment of the trading system.
Function introduction
Isolate and solve the problem of three-party package dependency conflicts. In view of the dependency conflicts of three-party packages, such as log4j,httpclient, we often encounter different second-party packages that rely on different versions of three-party packages in the development process. Faced with this situation, we all use the Maven tool to forcibly assign these three-party packages to a version. However, for those three-party packages that are not compatible, there is a great risk.
A complete set of large-scale and rapid upgrade mechanism for second-party packages is provided to provide a convenient way for large-scale upgrade of second-party packages. Users only need to put their own packages and dependent packages into the isolation container in accordance with the specifications of the isolation container. can achieve the effect of upgrade. There is no need for the business to do anything. Pandora container has been connected with Freedom (new release system). Pandora release process has been added to the original application release process. When releasing, you can easily choose which version of Pandora container you need to use and which version to use.
There is a difference between the runtime switch and the Stableswitch (Stableswitch is developed by the middleware team and is embedded in the application. When the server is under high pressure, it will use the switch function to turn off some less important function points. Stableswitch switch is a business logic switch, and the object-oriented switch is the application, that is, the switch in the application. The Pandora container is oriented to the switch of the second-party package. The runtime can deploy the second-party packages used in all applications, which is a lightweight solution. In addition, compared with the switch implemented by subscribing to diamond data, this granularity is finer and can be adjusted for each single machine.
The monitoring and management Pandora container provides a convenient command line mode, and the two-party package provider only needs to simply implement the interface of Pandora to implement its own command line commands. For example, you can implement a function to view the runtime data of all applications that use the two-party package at run time, so as to facilitate tracking and troubleshooting problems.
6.3. Preparation and optimization of application server double 11
Here we focus on the modular transformation of the Pandora container for the trading system before Singles Day holiday. When it comes to modularization, I believe many readers will think of OSGi in the first place. Yes, OSGi (JSR 291) is an acronym for Open Services Gateway initiative, which defines a basic specification and architectural model for the modular development of the system. So far, some well-known IDE products (Eclipse is the first and most mature OSGi practitioner) and application server vendors (IBM, BEA, Oracle) have adopted OSGi to create "microkernels and plug-ins" software architecture, so that these IDE and containers can be better modularized and dynamically assembled at run time.
Obviously, modularization and dynamic are the two most prominent features of OSGi. Modularity, especially its isolation mechanism, has basically been recognized by everyone, but for the dynamic feature, it is recognized as the most controversial aspect of OSGi.
From a practical point of view, at present, we do not have a strong demand for hot deployment, dynamic replacement, etc., and developers can usually accept application restart.
From a complexity perspective, to achieve smooth hot substitution, especially for those runtime stateful bundle, to achieve dynamic is quite complex.
From the perspective of feasibility, to achieve dynamic, it is necessary to change the development and operation and maintenance habits of developers and operation and maintenance personnel, and face great challenges in promotion.
Discarding OSGi to realize Modularization of Application system
Therefore, the Panodrar container abandoned the OSGi framework, only introduced the idea of OSGi isolation mechanism, re-implemented the isolation of ClassLoader, and formed a new lightweight isolation container. This is shown in figure 6-7.
Figure 6-7-Pandora architecture
Figure 6-7-Pandora architecture
The following focuses on the transformation of Pandora for business modularization from two aspects of Bundle and class loading.
Bundle-the smallest business unit
Firstly, the concept of Bundle is introduced, which enables the internal logic of the business system to be organized according to bundle as a unit. At the same time, a Maven plug-in is provided for the generation of bundle, so that a standard Maven Web project can be migrated seamlessly according to sub-projects.
Class loading-the core of isolation
Class loading mechanism is the core of modular isolation. According to the need of business system modularization, we need to design a kind of not only to make bundle have strict privacy, but also to make bundle, main application and bundle have flexible interoperability, so we redesign the class loading mechanism. General class loading can be divided into the following three steps:
Step 1: try to load from import.
When Pandora loads a class of bundle, it first determines whether the current class needs to get some shared classes from other bundle.
Step 2: try to load the class from bundle's own classpath.
The privacy requirements of Bundle have been specified, and each bundle should have the ability to be isolated from the external business system environment, so the loading of some three-party packages under bundle's own directory will take precedence over the business system environment.
Step 3: try to load from an external tripartite container.
If bundle declares that the class needs to be loaded from the biz classloader of the external three-party container, it will try to load it from the biz classloader.
That's all for "what Tomcat is". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.