d8tltanc commented on a change in pull request #9485: URL: https://github.com/apache/kafka/pull/9485#discussion_r543168812
########## File path: core/src/main/scala/kafka/security/authorizer/AclAuthorizer.scala ########## @@ -130,6 +130,10 @@ class AclAuthorizer extends Authorizer with Logging { @volatile private var aclCache = new scala.collection.immutable.TreeMap[ResourcePattern, VersionedAcls]()(new ResourceOrdering) + + private val resourceCache = new scala.collection.mutable.HashMap[ResourceIndex, + scala.collection.mutable.HashSet[String]]() Review comment: I tested a bit, using 1 bg thread adding elements in order and removing those added in order while the main thread query the HashSet using "foreach". The elements in the query result are not in order, which means the concurrent R/W will destroy the "foreach" completely. Let me test the performance of the immutable map a bit. I prefer this approach since it won't lock the read operation, which is much more frequent. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org