本文介绍了如何使用和设置ConcurrentHashMap的适当并发级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用大约1000个元素在concurrenthashmap。默认并发级别为16。任何人都可以帮助我一些算法或因素,从中我可以识别适合我的场景的并发级别或以什么方式并发级别影响多线程的处理。

I am working with around 1000 elements in concurrenthashmap . Default concurrency level is 16 . can anyone help me with some algorithm or factors from which i can identify the concurrency level suitable for my scenario or in what way a concurrency level affects the processing of multiple threads .

   ConcurrentHashMap<String, String> map=new ConcurrentHashMap<String, String>(500,1,20);             

20是我的并发级别(虚拟值)。需要有效设置

20 is my concurrency level (dummy value) .Need to set this efficiently

推荐答案

根据文档:

所以你需要回答1个问题:

So you need to answer 1 question:

修改表?

这篇关于如何使用和设置ConcurrentHashMap的适当并发级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 01:50