Web Application Test and monitoring execution time -- running imon

Source: Internet
Author: User
Tags visualvm

Web Application Test and monitoring execution time -- running imon

In terms of system performance tuning, we have previously introduced the use of jmeter-plugins and VisualVM to monitor the overall performance of the system. Sometimes, to identify the bottleneck, you need to understand the time consumed by some specific method calls. VisualVm can do this, but if profiler is used, it will consume too much resources. I personally think that using imon is a good choice. It not only monitors the access time of the data layer, business layer, and Web layer, but also provides the Web page viewing statistics and system alarm notification functions, which are very good.
Describe how to use JavaSimon in Spring-based Web systems.

1. Web. xml enable Web layer statistics, view Web pages, and notify alerts
<Web-app version = "2.5" xmlns = "http://java.sun.com/xml/ns/javaee" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <filter> <! -- Simon statistics filter --> <filter-name> simon-filter </filter-name> <filter-class> org. Taobao imon. javaee. SimonServletFilter </filter-class> <! -- Optional --> <init-param> <param-name> prefix </param-name> <param-value> com. cloud. web </param-value> </init-param> <! -- Optional basic plain-text console --> <init-param> <param-name> console-path </param-name> <param-value>/simon-filter </param -value> </init-param> <! -- Optional, threshold value to be reported --> <init-param> <param-name> report-threshold-ms </param-name> <param-value> 1000 </param-value> </init-param> <! -- Optional, alarm-display to standard output, you can customize the report --> <init-param> <param-name> request-reporter-class </param-name> <param-value> org. specified imon. javaee. reqreporter. standardRequestReporter </param-value> </init-param> <! -- Optional, stopwatchSource instance --> <init-param> <param-name> stopwatch-source-props </param-name> <param-value> includeHttpMethodName = ALWAYS </param-value> </init-param> </filter> <! -- Web Console displays Web statistics, access/simon-console to view --> <filter-name> simon-console-filter </filter-name> <filter-class> org. specified imon. console. simonConsoleFilter </filter-class> <init-param> <param-name> url-prefix </param-name> <param-value>/simon-console </param-value> </init-param> </filter> <! -- In most cases, the web console does not need to be monitored, note the filter order --> <filter-mapping> <filter-name> simon-console-filter </filter-name> <url-pattern>/* </url-pattern> </filter-mapping> <filter-name> simon-filter </filter-name> <url-pattern>/* </url-pattern> </filter -mapping> </web-app>
2. Spring configuration file

Note that only the bean defined in the Spring configuration file is valid (controller in spring-mvc is invalid)

 <bean id="monitoringInterceptor" class="org.javasimon.spring.MonitoringInterceptor"/> <aop:config> <!-- name of the class or interface --> <aop:pointcut id="monitoringPointcut" expression="execution(* com.cloud.service.ServiceImpl.*(..))"/> <aop:advisor advice-ref="monitoringInterceptor" pointcut-ref="monitoringPointcut"/> </aop:config>
3. JDBC Layer

Simply use simon's jdbc driver to replace the official driver, or package datasource.

You can view the access time of different layers in the Web application to locate the System Bottleneck.

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.