I have 10 different MySQL servers with the same schema design. Now I have to query each server and merge results in java which is same as UNION ALL
in SQL.
All DB servers return the same data format, and I tried sequential call of all server but it takes more time.
How can I speed up the process?
Scenario
This probably your sequential logic:
List<YourObject> arr = new ArrayList<YourObject>();
I can think of a solution that might consume less time:
How about this logic:
you can cut the sequential into threads. each thread will connect to a different server. once you have result from a server lock the arr and add the results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.