Monday 15 August 2011

data structures - Disadvantage of increasing number of partition in Java ConcurrentHashMap? -


Java concurrent hshap maintains the partition internally, locking each partition separately can occur. The scenario can be, where many keys are divided into one division and can be divided, they can not be helpful. Increase the number of divisions and improve concurrency.

Why does Java give the default value as 16 instead of very high value for the partition value? What is the display with a large number of split in the map?

Why Java provides much value as default value 16 for partition value Instead?

This very CPU (the number of threads is not that important) is very rare using the same CHM at the same time. If you really need this, then there is usually a better way to write your application that avoids it.

For example, say you have 1000 formulas but only 8 CPUs This means that only 8 threads will run on most and will reach CHM, something useful to handle your program is example.

In actual events, it is rare for a collection, which uses more than 10% time. The reason for this is that usually some are involved in IO, or it is understood to use their copies of the collections to reorganize the threads and collect them at the end eg. Map-less

What's the display with a large number of splits in the map?

You waste a little bit of memory which does not matter, but most of you waste some L1 caches, which is limited to 32 KB and a relatively precious resource.

No comments:

Post a Comment