Github user jloisel commented on the issue:

    https://github.com/apache/jmeter/pull/221
  
    I don't have benchmark. But, according to "Java Concurrency in Practice" in 
section "11.5 Example: Comparing Map performance", ConcurrentHashmap performs a 
lot better (up t o 40x faster) than Synchronized map when multiple threads are 
contented on a single resources.
    
    Here is an extract from the book:
    
    > The major scalability impediment for the synchronized Map implementations
    is that there is a single lock for the entire map, so only one thread can 
access the
    map at a time. On the other hand, ConcurrentHashMap does no locking for most
    successful read operations, and uses lock striping for write operations and 
those
    few read operations that do require locking. As a result, multiple threads 
can
    access the Map concurrently without blocking.
    
    Synchronized map uses a single lock both for reads and write, contending 
even read-only threads between each other. On the other side, ConcurrentHashMap 
uses lock stripping and is contention free between reader threads. 
    
    Guava's LoadingCache makes the code easy to understand, easy to maintain 
and is fast. You can probably be able to write your own cache without guava, 
but it's hard to implement something both easy to use and efficient in a 
multithreaded environment.
    
    Guava is the 3rd most popular Java library behind JUnit and SLF4J, i'm 
actually quite surprised it's not part of JMeter until now:
    [The Top 100 Java Libraries in 
2016](http://blog.takipi.com/the-top-100-java-libraries-in-2016-after-analyzing-47251-dependencies/)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to