Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-1017 - HotRod client test suite hangs eating 100% CPU #224

Closed
wants to merge 1 commit into from

Conversation

danberindei
Copy link
Member

Updated to only use SynchronizedMap, it's not a perf hotspot.

Please also merge t_ispn1017_4.2.x in the 4.2.x branch.

@@ -31,7 +32,7 @@ import static org.infinispan.factories.KnownComponentNames.MODULE_COMMAND_INITIA
public class ComponentRegistry extends AbstractComponentRegistry {

// cached component scopes
private static final Map<Class, Scopes> componentScopeLookup = new HashMap<Class, Scopes>();
private static final Map<Class, Scopes> componentScopeLookup = Collections.synchronizedMap(new HashMap<Class, Scopes>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use ConcurrentHashMap for better concurrency ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always had a bias against ConcurrentHashMap, it seemed too heavyweight
with its support for concurrent writers. Of course, it turns up my solution
was forcing the serialization of annotation parsing as well, so it wasn't
better at all.

My version would have made some sense if there were a lot of reads after the
map was built. But my assumptions were wrong, I ran the profiler and there
are practically no calls to isGlobal after startup - which means my
optimization is actually a deoptimization.

I didn't see duplicate annotation parsing to a perf hotspot either, so I'll
give up synchronization for the annotation parsing and I'll give
ConcurrentHashMap a try.

On Apr 1, 2011 1:21 PM, "mmarkus" <
reply@reply.github.com>
wrote:

@@ -31,7 +32,7 @@ import static
org.infinispan.factories.KnownComponentNames.MODULE_COMMAND_INITIA
public class ComponentRegistry extends AbstractComponentRegistry {

// cached component scopes
  • private static final Map<Class, Scopes> componentScopeLookup = new
    HashMap<Class, Scopes>();
  • private static final Map<Class, Scopes> componentScopeLookup =
    Collections.synchronizedMap(new HashMap<Class, Scopes>());

Why not use ConcurrentHashMap for better concurrency ?

Reply to this email directly or view it on GitHub:
https://github.com/infinispan/infinispan/pull/224/files#r14555

@Sanne
Copy link
Member

Sanne commented Apr 4, 2011

hi, I'm having the same issues, just starting Infinispan. I think this is quite urgent & critical.

Changing this to a CHM fixed it.

https://issues.jboss.org/browse/ISPN-1017?focusedCommentId=12593496&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12593496

Concurrent put() calls in the component scopes HashMap were causing get() to enter an infinite loop.
I changed the map to a ConcurrentHashMap to ensure atomic updates.
We can still waste work and parse the annotations of a class twice, but it's not that expensive.
@mmarkus
Copy link
Contributor

mmarkus commented Apr 4, 2011

thanks!

@mmarkus mmarkus closed this Apr 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants