转自:http://oracleseeker.com/2009/04/27/using_multiple_jvm_in_oc4j_application/
最近由于项目的需要,使用了OC4J中的多JVM的特性来解决应用系统的处理能力问题。
对于在Oracle Application Server中使用多JVM的特性,Oracle一些专家在他们的博客中也有谈到,对于使用多JVM还是多OC4J实例的问题,Angelo Santagata在他的博客中阐述了自己的观点:
Multiple JVMs:
The processes share the same configuration for the entire container (not just for the JVM parameters).
Same
applications, same container configuration etc. This is a great way of
scaling symmetrically to better utilize the CPUs and still only having
to manage one container.
Multiple OC4Js:
You can individually control
all of the container configurations, have different applications
deployed etc. You can use this strategy in
combination with multiple
JVMs to scale while at the same time having a heterogeneous environment
wrt. nr. of applications deployed, container configurations etc.
设置多个JVM,对于同一个应用和相同的配置,这样可以最大程度的利用CPU的处理能力;而如果有多个应用,他们分别独立控制自己的配置,因此可以使用多个OC4J的策略再加上多JVM的特性可以充分扩展异构环境的系统。
在Oracle Application Server的管理控制台中,可以查看各应用所启用的JVM数量(以前没有怎么玩过Weblogic,不知道是否也有这样的设置)
可以通过应用的服务器选项来修改每个应用对应的JVM实例个数
那怎么样来决定JVM的个数呢?上图中设置了soa的JVM实例数为2,实际的应用中,Angelo Santagata的建议是根据如下的规则来计算:
所以对于我项目上面有16CPU的系统来说,2+(round(15*1.2)) = 20 , 所以按照Angelo Santagata的建议可以在这服务器上面启动20个JVM实例。
设置了多个JVM实例之后,可以通过jdk的各种JVM工具来监控和分析JVM的情况,如:jps, jstat, jmap, jstatd, jconsole,还有jdk1.6之后集成的开源工具visualVM。
后续将介绍使用jdk的jstat, jmap和visualVM工具来监控JVM的状态,并通过它们来解决Out of Memory(OOM)问题。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9466564/viewspace-680958/ ,如需转载,请注明出处,否则将追究法律责任。