i have a hashmap in my application. The map is in a singleton and access to update or read it is protected using synchronized methods.
My problem occurs when testing with large numbers(20000+) of concurrent threads. When threads are writing to the map using put() im getting OutOfMemory exception.
Read operations are fine (i can simulate 1000000+ threads) without any issue.
Any recommendations on how i can make my hashmap more performant for writes? This may also be a limitation with my approach of storing so much data in memory?