Reputation: 6342
I am using IgniteCache.loadCache
to load data from Oracle into Ignite Cache with RDMS and Ignite Integration(https://apacheignite-mix.readme.io/v1.7/docs/automatic-persistence)
My main class will start client mode Ignite and will write the data to the Ignite cluster of 3 nodes.
The following is the sql array that will query the same table with different condition
String[] sqlArray = new String[]{
"select * from PERSON where id >=0 and id < 10000",
"select * from PERSON where id >=10000 and id < 20000",
..
"select * from PERSON where id >=10000000 and id < 10010000",
}
There are two options to run these sqls:
The first option is using the thread pool myself:
for (int i = 0; i< sqlArray.length; i++) {
//submit the load through thread pool
ThreadPool.submit(new Runnable() {
cache.loadCache(null, Integer.class.getName(), sqlArray[i])
}
}
The second option is:
cache.loadCache(null, sqlArray)
I would ask from the performance's view, which one will be faster or they will not have significant difference in performance?
Upvotes: 0
Views: 172
Reputation: 46
The second way looks right because the loadCache
is used thread pool for launch LoadCacheCustomQueryWorker
too and you save several ignite compute calls on each query.
NB: Please pay your attention to the arguments. The valid argument list in your case is:
Object[] args = new Object[] {
Integer.class.getName(),
"select * from PERSON where id >=0 and id < 10000",
Integer.class.getName(),
"select * from PERSON where id >=10000 and id < 20000",
Integer.class.getName(),
"select * from PERSON where id >=10000000 and id < 10010000"
}
So, the arguments count must be even. The first argument is key type, the second is SQL query.
Upvotes: 1