How to add objects to a distributed queue in hazelcast performantly?

↘锁芯ラ 提交于 2019-12-02 05:04:59

there are couple of ways you can optimize the Queue. The queue can store your entries in a binary or in object form. On top you can define the number of backups, the more backups the slower would it be. The default number of replicated backups is 1. This mean that for every pu you will have one replication besides the put. Probably the thing that increases the performance the most when using binary form of entry storage is the serialization. Java serialization is very slow. Use DataSerializeable or IdentifiedDataserializeable instead.

You need aso to check your network latency for some slow networks you would have 1-2MS latency only for network comunication for 1000 inserts this would be 1000 - 2000 ms which is 1-2 second only network waiting.

For batch iperations you can do the inserts in paralel as long as the order of the inserts is not important.

And Queue can have asynchroneus backups which would again incease a bit the performance.

UPDATE: During normal running of the application you will rarely have a single theaded scenario. So instead of inserting these 1000 values one by one do the following:
List arrayList = new ArrayList();

for(int i=0;i<1000;++i) {
   arrayList.add("myString " + i);
}

arrayList.paralelstream().forEach(t->configs.put(t));

Now you are inserting in paralel .

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!