We are using Avro Schema properties and while running concurrent tests,
we noticed a lot of contentions on
In the attached screen shot, we have 4 concurrent threads all sharing
the same avro schema and reading from it simultaneously.
On this screen shot each red period is a contention between threads.
Most of these contentions are on getJsonProp.
This is due to getJsonProp being a synchronized method.
We have tried avro 1.7.7, 1.8.1 and 1.8.2. All have this problem
(getJsonProp is deprecated in 1.8 but the replacement method is also
We can work around this by not sharing the avro schemas between threads
(using ThreadLocal for instance) but this is ugly.
It seems that avro schemas are mostly immutable, which is great for
multithread read access, but it turns out Properties within these
schemas are mutable and, since they are stored in a LinkedHashMap,
synchronization is necessary.
Anyone having a similar issue?