2017-10-11 61 views
0
  1. 荫使用艾斯波从交通流得到车辆计数1分钟运行窗口,
  2. 它工作正常,IAM能够获得基于的分组计数传感器,车辆类型和方向。
  3. 它运行了一天,但在一天结束时它会给出内存不足,请你帮我们解决这个问题。 4,我已经使用@Hint不退,请建议,如果EPL必须改变

信息: 一)艾斯波版本:6.1.0,而不是企业版
B)JDK 1.8
三)OS:RHEL 7.0
d)EPL:艾斯波6.1.0出内存

@Hint('reclaim_group_aged=60,reclaim_group_freq=5') 
select max(time) as time, event_name, object_class, object_id, 
    world_position, provider, tenant, speed, count(time) as vehicle_count, 
    sum(speed) as avg_speed, sensityScope as scope_id, sensityLane as lane, 
    suportedBearing as bearing, objectType as object_type, 
    pomLatitude as pom_latitude, pomLongitude as pom_longitude, 
    refSpeed as ref_speed, sid, geoPoint, roadClass 
from com.cisco.cdp.traffic.esper.event.SensityTrafficEntity#time(1 minute) 
group by sensityScope, object_class, event_name, suportedBearing 

回答

0

的问题是时间在你的应用程序如何前进。时间由您的应用程序控制。因此,当时间停止前进时,1分钟的窗口不会再删除事件。

@hint是不必要的,因为有空的时间窗口空组会消失。

我试过重现这一点,但没有看到增加内存。这是我试过的代码,工作正常。您可以使用我的代码作为模板来测试您的特定查询。

还要确保没有任何事件的字段是可变的。

public class TestABC { 
    public static void main(String[] args) { 
     Configuration config = new Configuration(); 
     config.getEngineDefaults().getThreading().setInternalTimerEnabled(false); 
     EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config); 
     epService.getEPAdministrator().getConfiguration().addEventType(SomeEvent.class); 
     epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0)); 
     String epl = "@Hint('reclaim_group_aged=60,reclaim_group_freq=5') select sum(valueOne), valueTwo, key from SomeEvent#time(1 minute) group by key"; 
     EPStatement stmt = epService.getEPAdministrator().createEPL(epl); 
     SupportUpdateListener listener = new SupportUpdateListener(); 
     stmt.addListener(listener); 

     long time = 0; 
     while(true) { 
      epService.getEPRuntime().sendEvent(new CurrentTimeEvent(time)); 
      time += 1000; 
      epService.getEPRuntime().sendEvent(new SomeEvent(UUID.randomUUID().toString(), 0, 0)); 
      System.out.println("At time " + time); 
      listener.reset(); 
     } 
    } 

    public static class SomeEvent { 
     private final String key; 
     private final int valueOne; 
     private final int valueTwo; 

     public SomeEvent(String key, int valueOne, int valueTwo) { 
      this.key = key; 
      this.valueOne = valueOne; 
      this.valueTwo = valueTwo; 
     } 

     public String getKey() { 
      return key; 
     } 

     public int getValueOne() { 
      return valueOne; 
     } 

     public int getValueTwo() { 
      return valueTwo; 
     } 
    } 
} 
+0

“sensityScope,object_class,event_name,suportedBearing”字段都需要明确定义的哈希码和等号。 – user650839