[ https://issues.apache.org/jira/browse/AVRO-2051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16090896#comment-16090896 ]
Daniel Kulp commented on AVRO-2051: ----------------------------------- I'm trying to find something that will work for Avro 1.8.x as that's what we'll need. Thus, removing all of that is likely not an option. That said, I just discovered that we already have parts of guava shaded in as a dependency. Thus, I believe I can use the CacheBuilder to create the equivalent of a "ConcurrentLinkedHashMap" (there are some google links that mention this) that would work for this and not have the quadratic issue. I'll investigate more tomorrow. Another option would be to either add a dependency to something else (like caffeine) that has a ConcurrentLinkedHashMap or copy/shade an Apache licensed version (like https://github.com/ben-manes/concurrentlinkedhashmap/blob/master/src/main/java/com/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java) into the src and use it. > Thread contention accessing JsonProperties props > ------------------------------------------------ > > Key: AVRO-2051 > URL: https://issues.apache.org/jira/browse/AVRO-2051 > Project: Avro > Issue Type: Bug > Components: java > Affects Versions: 1.8.2 > Reporter: Daniel Kulp > > See > https://lists.apache.org/thread.html/dd34ab8439137a81a9de29ad4161f37b17638394cea0806765689976@%3Cuser.avro.apache.org%3E > Basically, the getJsonProp method, being synchronized, is causing thread > contention issues when trying to share schemas between threads. My > proposal (pull request forthcoming) is to treat "props" as an immutable map > and do a copy+add+swap for the addProp method. This will make the addProp > call slower (particularly for large maps of props), but would make the reads > significantly faster as no locking will be needed. -- This message was sent by Atlassian JIRA (v6.4.14#64029)