lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "drazen.nis" <>
Subject Re: [SPATIAL] Spatial search runs forever
Date Wed, 17 Aug 2011 09:35:29 GMT
At the end I've found what the problem is. The problem is in using non thread
safe Map implementations in DistanceFilter. So if you execute the searches,
using the same instance of DistanceFilter, using one thread, everything
works as expected. But executing it with multiple threads in parallel, the
HashMap and WeakHashMap fields usage (DistanceFilter.destances and
DistanceFilter.distanceLookupCache) could go into indefinite loops (e.g. see and,-100--CPU-usage-p29940263.html)

So, after changing those Maps' implementations to HashMap ->
ConcurrentHashMap and new WeakHashMap() -> Collections.synchronizedMap(new
WeakHashMap()); the problem disappeared. I did not notice some performance
penalties, actually the opposite to that, since I can now run spatial search
using multiple threads. But I did not run some reliable tests to prove that,
this is just my subjective feeling executing the searches.

Nevertheless this issue with concurrent usage, I still think spatial contrib
and idea behind it are great and helped me a lot.
Maybe some JIRA issue for this use case should be created.

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message