ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 胡永亮/Bob <hu...@neusoft.com>
Subject A very slow code of using entryprocessor, why?
Date Fri, 23 Sep 2016 09:27:26 GMT
hi, everyone

    The code and related log are the following content, how can I do to increase the performance?
 Thank you very much.
    Code:
    IgniteCache<String, Map<Long, List<baselink>>>  mapMatchingData = IgniteManager.getInstance().getMapMatchingData();
Iterator<Cache.Entry<String, Map<Long, List<baselink>>>>  it1 = mapMatchingData.iterator();
while(it1.hasNext()){
     Cache.Entry<String, Map<Long, List<baselink>>> cEntry = it1.next();
     final String car_key = cEntry.getKey();
     log.info("car_key:"+car_key);
     
     mapMatchingData.invoke(car_key, new EntryProcessor<String, Map<Long, List<baselink>>,
Void>() {
                     @Override 
                     public Void process(MutableEntry<String, Map<Long, List<baselink>>>
entry, Object... args) {
                      Map<Long, List<baselink>> localMap = entry.getValue();
                      
                      Iterator<Entry<Long, List<baselink>>> entryIter =
localMap.entrySet().iterator();
                      while (entryIter.hasNext()) {
                          //以当前时间戳为标准,删除过期数据
                          Entry<Long, List<baselink>> timestd = entryIter.next();
                          Long stdtime = timestd.getKey();
                         log.info("stdtime:"+stdtime);
                          //删除过期数据,根据数据保存时间
                          if(Math.abs(m_timeStamp_sec-stdtime)>keepDataTime)//过期数据删除
                          {
                           log.info("remove stdtime:"+stdtime);
                              entryIter.remove();
                          }
                      }
                      
                     if(localMap.size()==0){
                     log.info("remove car_key:"+car_key);
                     entry.remove();
                     }else{
                         entry.setValue(localMap);
                     }
                         return null;
                     }});
 }

    Some logs are the following:
17:20:25.157  INFO [Timer-0] (DataCollection.java:146) -car_key:15701311774
17:20:25.525  INFO [Timer-0] (DataCollection.java:146) -car_key:13370126402
17:20:25.895  INFO [Timer-0] (DataCollection.java:146) -car_key:13466436318
17:20:26.265  INFO [Timer-0] (DataCollection.java:146) -car_key:13331093473
17:20:26.634  INFO [Timer-0] (DataCollection.java:146) -car_key:13311577054
17:20:27.003  INFO [Timer-0] (DataCollection.java:146) -car_key:1000096559
17:20:27.370  INFO [Timer-0] (DataCollection.java:146) -car_key:13381083402
17:20:27.739  INFO [Timer-0] (DataCollection.java:146) -car_key:1000094139
17:20:28.107  INFO [Timer-0] (DataCollection.java:146) -car_key:13651216432
17:20:28.477  INFO [Timer-0] (DataCollection.java:146) -car_key:13331159406
17:20:28.844  INFO [Timer-0] (DataCollection.java:146) -car_key:13488631105
17:20:29.212  INFO [Timer-0] (DataCollection.java:146) -car_key:13488631347
17:20:29.579  INFO [Timer-0] (DataCollection.java:146) -car_key:13370103413
17:20:29.975  INFO [Timer-0] (DataCollection.java:146) -car_key:13311403662
17:20:30.343  INFO [Timer-0] (DataCollection.java:146) -car_key:13301156741
17:20:30.711  INFO [Timer-0] (DataCollection.java:146) -car_key:13311426410
17:20:31.079  INFO [Timer-0] (DataCollection.java:146) -car_key:1000099948
17:20:31.450  INFO [Timer-0] (DataCollection.java:146) -car_key:1000098617
17:20:31.819  INFO [Timer-0] (DataCollection.java:146) -car_key:1000096439
17:20:32.187  INFO [Timer-0] (DataCollection.java:146) -car_key:13301277620
17:20:32.566  INFO [Timer-0] (DataCollection.java:146) -car_key:13311403541
17:20:32.934  INFO [Timer-0] (DataCollection.java:146) -car_key:13439317371
17:20:33.302  INFO [Timer-0] (DataCollection.java:146) -car_key:13466435348
17:20:33.670  INFO [Timer-0] (DataCollection.java:146) -car_key:13331159405
17:20:34.038  INFO [Timer-0] (DataCollection.java:146) -car_key:13381095984
17:20:34.409  INFO [Timer-0] (DataCollection.java:146) -car_key:13488631346



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.
---------------------------------------------------------------------------------------------------
Mime
View raw message