-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is Matcher threadsafe? #7
Comments
|
Thanks for such a thorough answer. The parallelism in my case is indeed needed to load separate traces in parallel and then match them, with a code something like so in the implementation of while (loader.next()){
List<List<MatcherSample>> samples = loader.loadCurrentBatch();
for (List<MatcherSample> trace : samples) {
MatcherKState candidate_state = mapTrace(trace);
saveRoadSpeeds(candidate_state.samples(), candidate_state.sequence());
}
} thanks for the reference to the Cheers! |
In that case (batch processing), I would just start as many threads as you have cores available and run that code. If you're having a Spark cluster available, you could check out this to run it on the cluster: scalable map matching. |
Hey,
I am running some processing in separate threads to speed things up, I'm wondering if Map and/or Matcher objects are threadsafe. I am sharing a Matcher object between threads but I am not quite sure if it is all right. If it's not safe I could pass in a map and instantiate separate matchers, but then again, I'd have to be sure Map is threadsafe.
Thanks
The text was updated successfully, but these errors were encountered: