因还没能大概摸透tsung,对openfire的紧急性能测试只能写代码使用smack来测了,期间出现了一些问题。
1、因smack连接openfire中阻塞的,原本想象的多线程同时创建连接失败了。
2、在PC上模拟,压到800多一点就连不上了,查看openfire gc信息发现full GC频繁,永久区满了,于是把openfire启动脚本中的INSTALL4J_ADD_VM_PARAMS=注释去掉,并改为INSTALL4J_ADD_VM_PARAMS=-Xms24g -Xmx24g -Xmn8g -XX:MaxPermSize=1g -XX:PermSize=1g 做个简单的配置,改了配置后gc少了,但到800多还是出问题,后来想了想,是linux默认打开文件数的问题(跟踪打开文件数也确定了问题),ulimit -a看了下还是默认的1024,使用ulimit -n 800000改后就好了。
3、在pc上模拟,java内存配置得也算不小了,但是压到1000多就出现了内存溢出,于是决定到另一台强力服务器(32g ram)上运行。
4、打成jar在服务器上运行发现加classpath还是无法找到依赖包,解决见:http://lydawen.iteye.com/blog/1073321
在服务器上运行时,出现异常:
javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:806)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:267)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 13 more
经查发现在pc机上运行是使用eclipse来跑的,它自动把一些安全相关的jar放到classpath,于是把这一堆jar也复制到依赖包目录就好了。这些安全相关的包是:java_home\jre\lib\ext 下的包。
使用服务器也只连到9000多,测试机还是内存溢出,估计对jvm参数再做调整也不会有太大改观,且需要再优化测试程序,还是赶紧熟悉tsung为妙。