Is there some optimal value for ConcurrencyLevel beyond which ConcurrentHashMap’s performance starts degrading?
If yes, what’s that value, and what’s the reason for performance degradation? (this question orginates from trying to find out any practical limitations that a ConcurrentHashMap may have).
The Javadoc offers pretty detailed guidance:
To summarize: the optimal value depends on the number of expected concurrent updates. A value within an order of magnitude of that should work well. Values outside that range can be expected to lead to performance degradation.