的信息:
a)Esper版本:6.1.0,而不是企业版
b)JDK:1.8
c)操作系统:RHEL 7.0
d)EPL:
@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 :(得分: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;
}
}
}