lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "drazen.nis" <d.niko...@youngculture.com>
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
http://lightbody.net/blog/2005/07/hashmapget_can_cause_an_infini.html and
http://old.nabble.com/DO-NOT-REPLY--Bug-50078--New%3A-Concurrent-access-to-WeakHashMap-in-ConcurrentCache-causes-infinite-loop,-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: http://lucene.472066.n3.nabble.com/SPATIAL-Spatial-search-runs-forever-tp3258018p3261103.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message