Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-22 Thread 胡永亮/Bob
Hi, Val

Thank you very much, I think this is very helpful for me.

I will change my compute code, and have a try.



Bob
 
From: vkulichenko
Date: 2016-09-23 07:00
To: user@ignite.apache.org
Subject: Re: Re: Increase Ignite instances can't increase the speed of compute
Hi Bob,
 
Most likely these are distributed cache operations and since they are all
synchronous, you wait for each of them one by one. You can try to batch your
updates to improve performance or use data streamer [1]. It would be even
better if you used affinity collocation [2] and made sure that all the
updates are local and network is not used during the computation.
 
[1] https://apacheignite.readme.io/docs/data-streamers
[2] https://apacheignite.readme.io/docs/affinity-collocation
 
-Val
 
 
 
--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Increase-Ignite-instances-can-t-increase-the-speed-of-compute-tp7670p7891.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


---
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s)
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please
immediately notify the sender by return e-mail, and delete the original message 
and all copies from
your system. Thank you.
---


Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-22 Thread vkulichenko
Hi Bob,

Most likely these are distributed cache operations and since they are all
synchronous, you wait for each of them one by one. You can try to batch your
updates to improve performance or use data streamer [1]. It would be even
better if you used affinity collocation [2] and made sure that all the
updates are local and network is not used during the computation.

[1] https://apacheignite.readme.io/docs/data-streamers
[2] https://apacheignite.readme.io/docs/affinity-collocation

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Increase-Ignite-instances-can-t-increase-the-speed-of-compute-tp7670p7891.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-21 Thread 胡永亮/Bob
eep Binary | false 
   |
| Store Read Through| off   
   |
| Store Write Through   | off   
   |
| Write-Behind Enabled  | off   
   |
| Write-Behind Flush Size   | 10240 
   |
| Write-Behind Frequency| 5000  
   |
| Write-Behind Flush Threads Count  | 1 
   |
| Write-Behind Batch Size   | 512   
   |
| Concurrent Asynchronous Operations Number | 50
   |
| Memory Mode   | ONHEAP_TIERED 
   |
| Off-Heap Size |  
   |
| Loader Factory Class Name |  
   |
| Writer Factory Class Name |  
   |
| Expiry Policy Factory Class Name  | 
javax.cache.configuration.FactoryBuilder$SingletonFactory|
| Query Execution Time Threshold| 3000  
   |
| Query Schema Name |   
   |
| Query Escaped Names   | off   
   |
| Query Onheap Cache Size   | 10240 
   |
| Query SQL functions   |  
   |
| Query Indexed Types   |  
   |
+--+

My code which write result data to ignite cache is the following, this code 
cost too much time than computing code.
//Batch to write to Ignite
Iterator>>> it = 
local_writeCache.entrySet().iterator();
int writeNum = 0;
while(it.hasNext()){
Entry>> entry = it.next();
String carKey = entry.getKey();
final Map> value = entry.getValue();
writeNum += value.size();

long startTime = System.currentTimeMillis();
if(!mapMatchingData.containsKey(carKey)){
mapMatchingData.put(carKey, value);
}else{
mapMatchingData.invoke(carKey, new EntryProcessor>, Void>() {
  @Override 
  public Void process(MutableEntry>> entry, Object... args) {
  Map> map = entry.getValue();
  map.putAll(value);
  entry.setValue(map);
  return null;
  }
  });
}   

I analyzed the log, I found not every writing task of compute job cost so 
much time, someone cost only 1s to write result to ignite cache: 
MapMatchingData.
So, I think writing result cost very much time, due to the lock of 
MapMatchingData for concurrent writing.

But, I want to know how to change this status, to shorten the cost time of 
writing ignite cache.

Thanks.



Bob
 
From: Vladislav Pyatkov
Date: 2016-09-14 20:18
To: user@ignite.apache.org
Subject: Re: Re: Increase Ignite instances can't increase the speed of compute
Hello,

I have not saw shortcomings in your code, but me was not clear which size of 
data moved between nodes or are data collect?

Can you create working example?
So I was able to reproduce the problem.

On Tue, Sep 13, 2016 at 12:06 PM, 胡永亮/Bob  wrote:

Only 118 jobs for this test.



Bob
 
From: Taras Ledkov
Date: 2016-09-13 14:52
To: user@ignite.apache.org
Subject: Re: Re: Increase Ignite instances can't increase the speed of compute
Hi,

How many MatchingJobs do you submit?


On Tue, Sep 13, 2016 at 12:29 PM, 胡永亮/Bob  wrote:
Hello,  Vladislav

The following is some code. 

...
IgniteCompute compute = ignite.compute();//.withAsync();

compute.run(new MatchingJob(m_mapReadyDataPara));
}

private static class MatchingJob implements IgniteRunnable{

private Map> m_mapReadyData;
private IgniteCache>> mapMatchingData; 
//This is a cache in Ignite cluster.
...

public void run() {
...
Iterator>> entryKeyIterator1 = 
m_mapReadyDat

Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-14 Thread Vladislav Pyatkov
Hello,

I have not saw shortcomings in your code, but me was not clear which size
of data moved between nodes or are data collect?

Can you create working example?
So I was able to reproduce the problem.

On Tue, Sep 13, 2016 at 12:06 PM, 胡永亮/Bob  wrote:

>
> Only 118 jobs for this test.
>
> --
> Bob
>
>
> *From:* Taras Ledkov 
> *Date:* 2016-09-13 14:52
> *To:* user@ignite.apache.org
> *Subject:* Re: Re: Increase Ignite instances can't increase the speed of
> compute
> Hi,
>
> How many MatchingJobs do you submit?
>
>
> On Tue, Sep 13, 2016 at 12:29 PM, 胡永亮/Bob  wrote:
>
>> Hello,  Vladislav 
>>
>> The following is some code.
>>
>> ...
>> IgniteCompute compute = ignite.compute();//.withAsync();
>>
>> compute.run(new MatchingJob(m_mapReadyDataPara));
>> }
>>
>> private static class MatchingJob implements IgniteRunnable{
>>
>> private Map> m_mapReadyData;
>> private IgniteCache>> mapMatchingData;
>> *//This is a cache in Ignite cluster.*
>> ...
>>
>> public void run() {
>> ...
>> Iterator>> entryKeyIterator1
>> = m_mapReadyData.entrySet().iterator();*//**m_mapReadyData is the
>> input data, its size is 5000 for every job now.*
>> Map>> local_writeCache =
>> new HashMap>>();
>> ...
>> *//Then the job read detail data from m_mapReadyData, and compute.*
>> while (entryKeyIterator1.hasNext()) {
>> Entry> eKey1 = entryK
>> eyIterator1.next();
>> String carKey = eKey1.getKey();
>> Map value1 = eKey1.getValue();
>>
>> *//local node cache*
>> Map> existMapbaselink =
>>  local_mapMatchingData.get(carKey);
>> if(existMapbaselink == null){
>> existMapbaselink = mapMatchingData.get(carKey); * //Read
>> data to compute with it from Ignite cache. This data's size is 154M for *
>> PARTITIONED *mode.*
>> if(existMapbaselink != null)
>> local_mapMatchingData.putIfAbsent(ca
>> rKey, existMapbaselink);
>> }
>>
>>* //some compute logic code*
>>
>> mapbaselink = local_writeCache.get(carKey);
>> if(mapbaselink == null){
>> mapbaselink = new TreeMap>();
>> }
>> mapbaselink.put(stdtime, ListBaseLink);
>> local_writeCache.put(carKey, mapbaselink);
>> }
>>
>> *//batch to write data into Ignite.*
>> Iterator>
>> >> it = local_writeCache.entrySet().iterator();
>> while(it.hasNext()){
>> Entry>> ent
>> ry = it.next();
>> String carKey = entry.getKey();
>> final Map> value = entry.getValue();
>>
>> if(!mapMatchingData.containsKey(carKey)){
>> mapMatchingData.put(carKey, value);
>> }else{
>> mapMatchingData.invoke(carKey, new
>> EntryProcessor>, Void>() {
>>   @Override
>>   public Void process(MutableEntry> g, Map>> entry, Object... args) {
>>   Map> map = en
>> try.getValue();
>>   map.putAll(value);
>>   entry.setValue(map);
>>   return null;
>>   }
>>   });
>> }
>>
>> }
>>
>>
>> --
>> bob
>>
>>
>> *From:* Vladislav Pyatkov 
>> *Date:* 2016-09-12 18:37
>> *To:* user@ignite.apache.org
>> *Subject:* Re: Increase Ignite instances can't increase the speed of
>> compute
>> Hello,
>>
>> I don't understand, what do you try to measure, without code.
>> Size of calculation task, size of data moved into network have importance.
>>
>> Could you please provide code example?
>>
>> On Mon, Sep 12, 2016 at 12:33 PM, 胡永亮/Bob  wrote:
>>
>>> Hi, everyone:
>>>
>>> I am using Ignite for computing and cache.
>>>
>>> I use the same input data and the same compute logic.
>>> When my ignite cluster's node is 2 in 2 machines, the total cost
>>> time is 38s.
>>>
>>> But

Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-13 Thread 胡永亮/Bob

Only 118 jobs for this test.



Bob
 
From: Taras Ledkov
Date: 2016-09-13 14:52
To: user@ignite.apache.org
Subject: Re: Re: Increase Ignite instances can't increase the speed of compute
Hi,

How many MatchingJobs do you submit?


On Tue, Sep 13, 2016 at 12:29 PM, 胡永亮/Bob  wrote:
Hello,  Vladislav

The following is some code. 

...
IgniteCompute compute = ignite.compute();//.withAsync();

compute.run(new MatchingJob(m_mapReadyDataPara));
}

private static class MatchingJob implements IgniteRunnable{

private Map> m_mapReadyData;
private IgniteCache>> mapMatchingData; 
//This is a cache in Ignite cluster.
...

public void run() {
...
Iterator>> entryKeyIterator1 = 
m_mapReadyData.entrySet().iterator();//m_mapReadyData is the input data, 
its size is 5000 for every job now.
Map>> local_writeCache = new 
HashMap>>();
...
//Then the job read detail data from m_mapReadyData, and compute.
while (entryKeyIterator1.hasNext()) {
Entry> eKey1 = entryKeyIterator1.next();
String carKey = eKey1.getKey();
Map value1 = eKey1.getValue();

//local node cache
Map> existMapbaselink = 
local_mapMatchingData.get(carKey);
if(existMapbaselink == null){
existMapbaselink = mapMatchingData.get(carKey);  //Read 
data to compute with it from Ignite cache. This data's size is 154M for 
PARTITIONED mode.
if(existMapbaselink != null)
local_mapMatchingData.putIfAbsent(carKey, 
existMapbaselink);
}

//some compute logic code

mapbaselink = local_writeCache.get(carKey);
if(mapbaselink == null){
mapbaselink = new TreeMap>();
}
mapbaselink.put(stdtime, ListBaseLink);
local_writeCache.put(carKey, mapbaselink);
}

//batch to write data into Ignite.
Iterator>>> it = 
local_writeCache.entrySet().iterator();
while(it.hasNext()){
Entry>> entry = it.next();
String carKey = entry.getKey();
final Map> value = entry.getValue();

if(!mapMatchingData.containsKey(carKey)){
mapMatchingData.put(carKey, value);
}else{
mapMatchingData.invoke(carKey, new EntryProcessor>, Void>() {
  @Override 
  public Void process(MutableEntry>> entry, Object... args) {
  Map> map = entry.getValue();
  map.putAll(value);
  entry.setValue(map);
  return null;
  }
  });
}

}




bob
 
From: Vladislav Pyatkov
Date: 2016-09-12 18:37
To: user@ignite.apache.org
Subject: Re: Increase Ignite instances can't increase the speed of compute
Hello,

I don't understand, what do you try to measure, without code.
Size of calculation task, size of data moved into network have importance.

Could you please provide code example?

On Mon, Sep 12, 2016 at 12:33 PM, 胡永亮/Bob  wrote:
Hi, everyone:

I am using Ignite for computing and cache.

I use the same input data and the same compute logic.
When my ignite cluster's node is 2 in 2 machines, the total cost time is 
38s.

But, when I increase the Ignite cluster nodes to 3 in 3 machines, the cost 
time is 32s/51s/41s
4 instances in 4 machines, the cost time is 32s/40s.

 The compute speed can't change faster, what may the reason be?

Thanks.

Bob

---
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please 
immediately notify the sender by return e-mail, and delete the original message 
and all copies from 
your system. Thank you. 
---



-- 
Vladislav Pyatkov

---
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of 
N

Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-12 Thread Taras Ledkov
Hi,

How many MatchingJobs do you submit?


On Tue, Sep 13, 2016 at 12:29 PM, 胡永亮/Bob  wrote:

> Hello,  Vladislav 
>
> The following is some code.
>
> ...
> IgniteCompute compute = ignite.compute();//.withAsync();
>
> compute.run(new MatchingJob(m_mapReadyDataPara));
> }
>
> private static class MatchingJob implements IgniteRunnable{
>
> private Map> m_mapReadyData;
> private IgniteCache>> mapMatchingData;
> *//This is a cache in Ignite cluster.*
> ...
>
> public void run() {
> ...
> Iterator>> entryKeyIterator1 = m_
> mapReadyData.entrySet().iterator();*//**m_mapReadyData is the input
> data, its size is 5000 for every job now.*
> Map>> local_writeCache =
>  new HashMap>>();
> ...
> *//Then the job read detail data from m_mapReadyData, and compute.*
> while (entryKeyIterator1.hasNext()) {
> Entry> eKey1 =
> entryKeyIterator1.next();
> String carKey = eKey1.getKey();
> Map value1 = eKey1.getValue();
>
> *//local node cache*
> Map> existMapbaselink = local_
> mapMatchingData.get(carKey);
> if(existMapbaselink == null){
> existMapbaselink = mapMatchingData.get(carKey); * //Read
> data to compute with it from Ignite cache. This data's size is 154M for *
> PARTITIONED *mode.*
> if(existMapbaselink != null)
> local_mapMatchingData.putIfAbsent(
> carKey, existMapbaselink);
> }
>
>* //some compute logic code*
>
> mapbaselink = local_writeCache.get(carKey);
> if(mapbaselink == null){
> mapbaselink = new TreeMap>();
> }
> mapbaselink.put(stdtime, ListBaseLink);
> local_writeCache.put(carKey, mapbaselink);
> }
>
> *//batch to write data into Ignite.*
> Iterator>>> it = local_
> writeCache.entrySet().iterator();
> while(it.hasNext()){
> Entry>>
> entry = it.next();
> String carKey = entry.getKey();
> final Map> value = entry.getValue();
>
> if(!mapMatchingData.containsKey(carKey)){
> mapMatchingData.put(carKey, value);
> }else{
> mapMatchingData.invoke(carKey,
>  new EntryProcessor>, Void>() {
>   @Override
>   public Void process(MutableEntry<
> String, Map>> entry, Object... args) {
>   Map> map =
> entry.getValue();
>   map.putAll(value);
>   entry.setValue(map);
>   return null;
>   }
>   });
> }
>
> }
>
>
> --
> bob
>
>
> *From:* Vladislav Pyatkov 
> *Date:* 2016-09-12 18:37
> *To:* user@ignite.apache.org
> *Subject:* Re: Increase Ignite instances can't increase the speed of
> compute
> Hello,
>
> I don't understand, what do you try to measure, without code.
> Size of calculation task, size of data moved into network have importance.
>
> Could you please provide code example?
>
> On Mon, Sep 12, 2016 at 12:33 PM, 胡永亮/Bob  wrote:
>
>> Hi, everyone:
>>
>> I am using Ignite for computing and cache.
>>
>> I use the same input data and the same compute logic.
>> When my ignite cluster's node is 2 in 2 machines, the total cost time
>> is 38s.
>>
>> But, when I increase the Ignite cluster nodes to 3 in 3 machines, the
>> cost time is 32s/51s/41s
>> 4 instances in 4 machines, the cost time is 32s/40s.
>>
>>  The compute speed can't change faster, what may the reason be?
>>
>> Thanks.
>>
>> Bob
>>
>> 
>> ---
>> Confidentiality Notice: The information contained in this e-mail and any
>> accompanying attachment(s)
>> is intended only for the use of the intended recipient and may be
>> confidential and/or privileged of
>> Neusoft Corporation, its subsidiaries and/or its affiliates. If any
>> reader of this communication is
>> not the intended recipient, unauthorized use, forwarding, printing,
>> storing, disclosure or copying
>> is strictly prohibited, and may be unlawful.If you have received this
>> communication in error,please
>> immediately notify the sender by return e-mail, and delete the original
>> message and all copies from
>> your system. Thank you.
>> 
>> ---
>>
>
>
>
> --
> Vladislav Pyatkov
>
>
> 
> ---
> Confidentiality Notice: The information contained in this e-mail and any
> accompanying attachment(s)
> is intended only for the use of the intended recipient and may be
> con

Re: Re: Increase Ignite instances can't increase the speed of compute

2016-09-12 Thread 胡永亮/Bob
Hello,  Vladislav

The following is some code. 

...
IgniteCompute compute = ignite.compute();//.withAsync();

compute.run(new MatchingJob(m_mapReadyDataPara));
}

private static class MatchingJob implements IgniteRunnable{

private Map> m_mapReadyData;
private IgniteCache>> mapMatchingData; 
//This is a cache in Ignite cluster.
...

public void run() {
...
Iterator>> entryKeyIterator1 = 
m_mapReadyData.entrySet().iterator();//m_mapReadyData is the input data, 
its size is 5000 for every job now.
Map>> local_writeCache = new 
HashMap>>();
...
//Then the job read detail data from m_mapReadyData, and compute.
while (entryKeyIterator1.hasNext()) {
Entry> eKey1 = entryKeyIterator1.next();
String carKey = eKey1.getKey();
Map value1 = eKey1.getValue();

//local node cache
Map> existMapbaselink = 
local_mapMatchingData.get(carKey);
if(existMapbaselink == null){
existMapbaselink = mapMatchingData.get(carKey);  //Read 
data to compute with it from Ignite cache. This data's size is 154M for 
PARTITIONED mode.
if(existMapbaselink != null)
local_mapMatchingData.putIfAbsent(carKey, 
existMapbaselink);
}

//some compute logic code

mapbaselink = local_writeCache.get(carKey);
if(mapbaselink == null){
mapbaselink = new TreeMap>();
}
mapbaselink.put(stdtime, ListBaseLink);
local_writeCache.put(carKey, mapbaselink);
}

//batch to write data into Ignite.
Iterator>>> it = 
local_writeCache.entrySet().iterator();
while(it.hasNext()){
Entry>> entry = it.next();
String carKey = entry.getKey();
final Map> value = entry.getValue();

if(!mapMatchingData.containsKey(carKey)){
mapMatchingData.put(carKey, value);
}else{
mapMatchingData.invoke(carKey, new EntryProcessor>, Void>() {
  @Override 
  public Void process(MutableEntry>> entry, Object... args) {
  Map> map = entry.getValue();
  map.putAll(value);
  entry.setValue(map);
  return null;
  }
  });
}

}




bob
 
From: Vladislav Pyatkov
Date: 2016-09-12 18:37
To: user@ignite.apache.org
Subject: Re: Increase Ignite instances can't increase the speed of compute
Hello,

I don't understand, what do you try to measure, without code.
Size of calculation task, size of data moved into network have importance.

Could you please provide code example?

On Mon, Sep 12, 2016 at 12:33 PM, 胡永亮/Bob  wrote:
Hi, everyone:

I am using Ignite for computing and cache.

I use the same input data and the same compute logic.
When my ignite cluster's node is 2 in 2 machines, the total cost time is 
38s.

But, when I increase the Ignite cluster nodes to 3 in 3 machines, the cost 
time is 32s/51s/41s
4 instances in 4 machines, the cost time is 32s/40s.

 The compute speed can't change faster, what may the reason be?

Thanks.

Bob

---
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please 
immediately notify the sender by return e-mail, and delete the original message 
and all copies from 
your system. Thank you. 
---



-- 
Vladislav Pyatkov


---
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s)
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please
immediately notify the sender by return e-mail, and delete the original message 
and all