-
Notifications
You must be signed in to change notification settings - Fork 207
Closed
Description
I'm testing GeoIP2 vs GeoIP and getting a very strange result, it seems the new api is way slower.
maxMind1 - Legacy API
maxMind2 - new API, FileMode.MEMORY_MAPPED
maxMind2v2 - new API, FileMode.MEMORY
Caches are on;
Here are my benchmark results:
Benchmark Mode Cnt Score Error Units
MindMaxBenchmark.maxMind1 thrpt 50 176225.276 ± 1603.768 ops/s
MindMaxBenchmark.maxMind2 thrpt 50 825.766 ± 12.428 ops/s
MindMaxBenchmark.maxMind2v2 thrpt 50 767.863 ± 35.938 ops/s
MindMaxBenchmark.maxMind1 avgt 50 ≈ 10⁻⁵ s/op
MindMaxBenchmark.maxMind2 avgt 50 0.001 ± 0.001 s/op
MindMaxBenchmark.maxMind2v2 avgt 50 0.001 ± 0.001 s/op
MindMaxBenchmark.maxMind1 sample 131466 ≈ 10⁻⁵ s/op
MindMaxBenchmark.maxMind2 sample 38187 0.001 ± 0.001 s/op
MindMaxBenchmark.maxMind2v2 sample 34064 0.001 ± 0.001 s/op
MindMaxBenchmark.maxMind1 ss 50 ≈ 10⁻⁴ s/op
MindMaxBenchmark.maxMind2 ss 50 0.028 ± 0.005 s/op
MindMaxBenchmark.maxMind2v2 ss 50 0.026 ± 0.004 s/op
Services are initialized at the test start like that:
final DatabaseReader mindMaxDB = new DatabaseReader.Builder(...)
.withCache(new CHMCache())
.fileMode(Reader.FileMode.MEMORY)
.build();
and the test code is like (some null checks are ommited):
public LocationData resolve(InetAddress inetAddress) {
CityResponse cityResponse = mindMaxDB.city(inetAddress);
Location location = cityResponse.getLocation();
return new LocationData(
inetAddress, cityResponse.getCountry().getIsoCode(), cityResponse.getCity().getName()
);
}
The Legacy API:
Service created like that
LookupService lookupService = new LookupService(file, LookupService.GEOIP_MEMORY_CACHE);
and test code is
com.maxmind.geoip.Location location = lookupService.getLocation(inetAddress);
return new LocationData(
inetAddress, location.countryCode,
location.city);
I'd like to know if I'm missing something?
zhxgigi
Metadata
Metadata
Assignees
Labels
No labels