Could you please provide links to your code instead of pasting it in email, it is really hard to follow.
Sergi 2015-08-31 17:28 GMT+03:00 javadevmtl <[email protected]>: > Running 1.3.0 on 2 nodes. > > I have the below code which works absolutely great. I can get 11,000 full > business requests with 2ms latency (including network). > > Wondering if I should replace compute.affinityCall() with cache.invoke()? > Inside the EntryProcessor if the key does not exist yet. Can we do a > cache.put()? > Does cache.invoke also collocate with the key? > > > final Context ctx = > vertx.getOrCreateContext(); > > compute.<HashMap<String, > HashSet<String>>>affinityCall(CACHE_NAME, > key, () -> { > HashMap<String, > HashSet<String>> params = > cache.localPeek(acctNumber, CachePeekMode.OFFHEAP); > > if(params == null) { > params = new > HashMap<String, HashSet<String>>(); > > params.put("field1", > newHashSet(field1)); > params.put("field2", > newHashSet(field2)); > params.put("field3", > newHashSet(field3)); > params.put("field4", > newHashSet(field4)); > params.put("field5", > newHashSet(field5)); > params.put("field6", > newHashSet(field6)); > params.put("field7", > newHashSet(field7)); > params.put("field8", > newHashSet(field8)); > params.put("field9", > newHashSet(field9)); > } else { > > params.get("field1").add(field1); > > params.get("field2").add(field2); > > params.get("field3").add(field3); > > params.get("field4").add(field4); > > params.get("field5").add(field5); > > params.get("field6").add(field6); > > params.get("field7").add(field7); > > params.get("field8").add(field8); > > params.get("field9").add(field9); > } > > > cache.put(key, params); > > return params; > }); > > compute.<HashMap<String, > HashSet<String>>>future().listen(af -> { > > final HashMap<String, > HashSet<String>> newParams = af.get(); > > String counts = acctNumber + "=" > + newParams.get("name").size() + > "," > + > newParams.get("acctNumber").size() + "," > + > newParams.get("acctNumber2").size() + "," > + > newParams.get("address").size() + "," > + > newParams.get("phone").size() + "," > + > newParams.get("email").size() + "," > + > newParams.get("ip").size() + "," > + > newParams.get("deviceId").size() + "," > + > newParams.get("shipToAddress").size() > ; > final JsonObject response = new > JsonObject().put("result", counts); > > ctx.runOnContext(ch -> { > rh.reply(response); > }); > }); > > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/Replace-compute-affinityCall-with-cache-invoke-tp1210.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. >
