为了提升应用的性能我们可能需要做很多分析和优化。但具体从哪里优化,优化的效果是多少就难以判定了。
javamelody用嵌入式的监控方式,实时监控性能指标。如:页面相应时间,spring bean方法调用时间,sql语句执行时间等很多指标。我在这就不一一列举了。
1
2
3
4
5
|
<
dependency
>
<
groupId
>net.bull.javamelody</
groupId
>
<
artifactId
>javamelody-core</
artifactId
>
<
version
>1.40.0</
version
>
</
dependency
>
|
同样的效果
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<
context-param
>
<
param-name
>contextConfigLocation</
param-name
>
<
param-value
>
classpath:org/noahx/test/application-context.xml
classpath:net/bull/javamelody/monitoring-spring.xml
</
param-value
>
</
context-param
>
<
filter
>
<
filter-name
>monitoring</
filter-name
>
<
filter-class
>net.bull.javamelody.MonitoringFilter</
filter-class
>
</
filter
>
<
filter-mapping
>
<
filter-name
>monitoring</
filter-name
>
<
url-pattern
>/*</
url-pattern
>
</
filter-mapping
>
<
listener
>
<
listener-class
>net.bull.javamelody.SessionListener</
listener-class
>
</
listener
>
|
1
2
3
4
5
6
7
8
9
10
11
|
<
bean
id
=
"facadeMonitoringAdvisor"
class
=
"net.bull.javamelody.MonitoringSpringAdvisor"
>
<
property
name
=
"pointcut"
>
<
bean
class
=
"org.springframework.aop.support.JdkRegexpMethodPointcut"
>
<
property
name
=
"patterns"
>
<
array
>
<
value
>org\.noahx\.test\..*</
value
>
</
array
>
</
property
>
</
bean
>
</
property
>
</
bean
>
|
org\.noahx\.test\..*为正则表达式,javamelody会自动匹配bean中的类名,来决定都监控哪些bean的哪些方法