我们目前正在使用Hazelcast(v3.3.2)执行一些负载测试。一旦并行连接数大于500,就会抛出异常,并且群集的主节点会自动关闭。我找不到有关异常的更多信息,所以我想知道在配置文件中是否存在必须增加的最大并行连接数。
以下是例外:
com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not ready yet!
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:428)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:358)
at com.hazelcast.spi.impl.BasicOperationService$BasicDispatcherImpl.dispatch(BasicOperationService.java:546)
at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.process(BasicOperationScheduler.java:439)
at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.doRun(BasicOperationScheduler.java:433)
at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.run(BasicOperationScheduler.java:408)
at ------ End remote and begin local stack-trace ------.(Unknown Source)
at com.hazelcast.client.spi.impl.ClientCallFuture.resolveResponse(ClientCallFuture.java:194)
at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:136)
at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:113)
at com.hazelcast.client.spi.ClientProxy.invoke(ClientProxy.java:110)
at com.hazelcast.client.proxy.ClientMapProxy.put(ClientMapProxy.java:323)
at com.hazelcast.client.proxy.ClientMapProxy.put(ClientMapProxy.java:189)
at com.hp.cms.rtc.benchmarksuite.dbconnectors.HazelcastConnectorImpl.saveDevice(HazelcastConnectorImpl.java:154)
at com.hp.cms.rtc.benchmarksuite.dbconnectors.HazelcastConnectorImpl.insertNewCustomer(HazelcastConnectorImpl.java:317)
at com.hp.cms.rtc.benchmarksuite.usecases.InsertNewCustomerUseCaseImpl.execute(InsertNewCustomerUseCaseImpl.java:41)
at com.hp.cms.rtc.benchmarksuite.generators.load.UseCaseJob.execute(UseCaseJob.java:29)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
更新:
以下是我们的连接器的源代码摘录,它创建了与Hazelcast的连接。
private HazelcastInstance hazelcastClient;
private IMap<Integer, Contact> contacts;
private IMap<Integer, Subscriber> subscribers;
private IMap<Integer, Account> accounts;
private IMap<Integer, Device> devices;
...
@Override
public void connect() {
System.setProperty("hazelcast.logging.type", "none");
ClientConfig clientConfig = new ClientConfig();
ClientNetworkConfig networkConf = new ClientNetworkConfig();
networkConf.addAddress(url); // default: 127.0.0.1:5701
clientConfig.setNetworkConfig(networkConf);
hazelcastClient = HazelcastClient.newHazelcastClient(clientConfig);
contacts = hazelcastClient.getMap("contacts");
subscribers = hazelcastClient.getMap("subscribers");
accounts = hazelcastClient.getMap("accounts");
devices = hazelcastClient.getMap("devices");
...
idGenContacts = hazelcastClient.getIdGenerator("idGenContacts");
idGenContacts.init(0);
idGenSubscribers = hazelcastClient.getIdGenerator("idGenSubscribers");
idGenSubscribers.init(0);
idGenAccounts = hazelcastClient.getIdGenerator("idGenAccounts");
idGenAccounts.init(0);
idGenDevices = hazelcastClient.getIdGenerator("idGenDevices");
idGenDevices.init(0);
...
}
更新2: 我已将节点数增加到3并禁用与管理中心的连接。这使得在异常再次发生之前可以达到类似560并行连接的东西。这次除了上面的一个之外还显示了另一个:
com.hazelcast.spi.exception.TargetDisconnectedException: Target[Address[xx.xxx.xxx.xxx]:5701] disconnected.
at com.hazelcast.client.connection.nio.ClientConnection$CleanResourcesTask$1.createNew(ClientConnection.java:319)
at com.hazelcast.client.connection.nio.ClientConnection$CleanResourcesTask$1.createNew(ClientConnection.java:316)
at com.hazelcast.client.connection.nio.ClientConnection.cleanResources(ClientConnection.java:349)
at com.hazelcast.client.connection.nio.ClientConnection.access$200(ClientConnection.java:60)
at com.hazelcast.client.connection.nio.ClientConnection$CleanResourcesTask.run(ClientConnection.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
at ------ End remote and begin local stack-trace ------.(Unknown Source)
at com.hazelcast.client.spi.impl.ClientCallFuture.resolveResponse(ClientCallFuture.java:201)
at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:142)
at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:118)
at com.hazelcast.client.spi.ClientProxy.invoke(ClientProxy.java:127)
at com.hazelcast.client.proxy.ClientAtomicLongProxy.invoke(ClientAtomicLongProxy.java:126)
at com.hazelcast.client.proxy.ClientAtomicLongProxy.getAndAdd(ClientAtomicLongProxy.java:98)
at com.hazelcast.client.proxy.ClientAtomicLongProxy.getAndIncrement(ClientAtomicLongProxy.java:116)
at com.hazelcast.client.proxy.ClientIdGeneratorProxy.newId(ClientIdGeneratorProxy.java:70)
at com.hp.cms.rtc.benchmarksuite.dbconnectors.HazelcastConnectorImpl.insertNewCustomer(HazelcastConnectorImpl.java:325)
at com.hp.cms.rtc.benchmarksuite.usecases.InsertNewCustomerUseCaseImpl.execute(InsertNewCustomerUseCaseImpl.java:41)
at com.hp.cms.rtc.benchmarksuite.generators.load.UseCaseJob.execute(UseCaseJob.java:29)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)