Search code examples
.netmultithreadinggeoipmaxmind

Is MaxMind.GeoIP2.DatabaseReader Thread Safe?


I intend to use MaxMind.GeoIP2 in a high traffic environment, that means a lot of threads will be sharing the MaxMind.GeoIP2.DatabaseReader. The documentation is not clear, and I would like to know if it is thread safe?

This is the documentation I use http://maxmind.github.io/GeoIP2-dotnet/doc/v0.4.0/index.html ( and I believe it's the latest available version)


Solution

  • It is thread safe. The documentation says that the API fully supports use in multi-threaded applications. You should share the reader object among many threads. Please see the link -- https://github.com/maxmind/MaxMind-DB-Reader-java/blob/master/README.md

    Also, if you check the source code, there is a test for multi-threading. Hope that helps !