Coherence 应用优化
1.1. 选择合适的缓存模式
参数配置数据,基本是只读的:在JVM中会占用300M内存,建议采用duplicated方式,提高性能。应用数据采用distributed方式。
1.2. thread-count
如果服务器的CPU多或者CPU的核数就调大点,具体可根据性能测试的优化结果选择。
1.3. partition-count
默认值为257.主要针对distributed-scheme,可根据要缓存的数据量的大小进行调整,具体可根据性能测试的优化结果选择,参考值如下。必须是一个质数,可从http://www.utm.edu/research/primes/lists/small/1000.txt 查询质数
service storage | partition-count |
100M | 257 |
1G | 509 |
10G | 2039 |
50G | 4093 |
100G | 8191 |
2.1. AIX操作系统参数
2.1.1. Socket Buffer Sizes
默认的socketbuffer sizes一般都比较小,Coherence会报下面的Warning:
UnicastUdpSocket failedto set receive buffer size to 1428 packets (2096304
bytes); actual size is 89packets (131071 bytes). Consult your OS documentation
regarding increasing themaximum socket buffer size. Proceeding with the actual
value may cause sub-optimalperformance.
用root用户执行下面的命令进行调整:
no -o rfc1323=1
no -o sb_max=4194304
如果是其他操作系统:
On Linux execute (as root):
sysctl-w net.core.rmem_max=2096304
sysctl -w net.core.wmem_max=2096304
On Solaris execute (as root):
ndd -set /dev/udpudp_max_buf 2096304
2.2. IBM JVM特殊配置
2.2.1. OutOfMemoryError
如果某个节点处于OutOfMemoryError状态,会给集群带来不好的影响,所以当某个节点处于这种状态,应该让它退出而不是师徒恢复。所以需要在IBM JVM的启动参数中配置:
UNIX:
-Xdump:tool:events=throw,filter=java/lang/OutOfMemoryError,exec="kill-9 %pid"
3. 生产环境检查
具体请参考Oracle® Coherence Administrator's Guide的第7章:7Production Checklist