我很興奮點燃並且對客戶端和服務器節點的責任有疑問。據我從文檔客戶端節點是非常小的機器,所以這不是他們的目的執行一些沉重的緩存操作。例如,我需要從某個持久性存儲中加載數據,執行一些沉重的緩存相關計算並將結果數據放入緩存。它看起來像這樣:瞭解客戶端和服務器
一
//This is on a client node
public class Loader{
private DataSource dataSource;
@IgniteInstanceResource
private Ignite ignite;
public void load(){
String key;
String values;
//retreive key and value from the dataSource
IgniteDataStreamer<String, String> streamer = ignite.dataStreamer("cache");
String result;
//process value
streamer.addData(key, result); //<---------1
}
}
的問題是關於//1
。處理加載的數據並將其放入緩存是客戶端節點的責任嗎?實際上我打算執行以下操作:爲每個加載的String key
和String value
創建任務,並在服務器節點上執行所有評估和緩存相關的操作。如下所示:
二,
public class LoaderJob extends ComputeJobAdapter{
private String key;
private String value;
@Override
public Object execute(){
//perform all computation and putting into cache here
//and return Tuple2(key, result);
}
}
public class LoaderTask extends extends ComputeTaskSplitAdapter<Void, Void {
//...
public Void reduce(List<ComputeJobResult> results) throws IgniteException {
results.stream().forEach(result -> {
Tuple2<String, String> jobResult = result.getData();
ignite.dataStreamer("cache").addData(jobResult._1, jobResult._2);
});
return null;
}
}
在什麼客戶端做的是隻裝載從持久性存儲數據,然後在服務器上發佈任務的第二種情況。
什麼是做這樣的事情的常見方式?
將會有大約25TB的數據。所以,好點...我害怕系列化的代價。 –