2017-10-11 58 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