+ All Categories
Home > Documents > Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that...

Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that...

Date post: 12-Mar-2020
Category:
Upload: others
View: 11 times
Download: 0 times
Share this document with a friend
20
Esper Language, compiler and runtime for DSM & CEP Basic version is a library that can be imported in Java or .NET Event Processing Language (EPL) enables rich expressions over events and time The mandatory assignment uses Esper and will require you to write EPL queries to get data from a stream! Documentation: http://www.espertech.com/esper/esper-documentation Try online: https://esper-epl-tryout.appspot.com/epltryout/mainform.html
Transcript
Page 1: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Esper

• Language,compilerandruntime forDSM&CEP• BasicversionisalibrarythatcanbeimportedinJavaor.NET• EventProcessingLanguage(EPL)enablesrichexpressionsovereventsandtime

• ThemandatoryassignmentusesEsperandwillrequireyoutowriteEPLqueriestogetdatafromastream!

Documentation: http://www.espertech.com/esper/esper-documentationTry online: https://esper-epl-tryout.appspot.com/epltryout/mainform.html

Page 2: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Documentation: http://www.espertech.com/esper/esper-documentationTry online: https://esper-epl-tryout.appspot.com/epltryout/mainform.html

Page 3: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

EPLSyntax• Create schema

• DataStreamManagement:

• CEP:

Documentation: http://www.espertech.com/esper/esper-documentationTry online: https://esper-epl-tryout.appspot.com/epltryout/mainform.html

select ID as sensorId, sum(countTags) as numTagsPerSensorfrom AutoIdRFIDExample#win:time(60 seconds) where Observation[0].Command = 'READ_PALLET_TAGS_ONLY’ group by ID

select a.custId, sum(a.price + b.price) from pattern [every a=ServiceOrder ->

b=ProductOrder(custId = a.custId) where timer:within(1 min)]#win:time(2 hour)

where a.name in ('Repair', b.name) group by a.custIdhaving sum(a.price + b.price) > 100

create schema SchemaName(field_name1 type, field_name2 type)

Page 4: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Window• Called aview inEsper• Choose correctwindowwhen writingEPLqueries!• Examples of windows/views:

View Syntax Description

Timewindow win:time(time period) Sliding timewindow

Externally-timed window win:ext_timed(timestampexpression, timeperiod)

Sliding timewindow,based on the millisecond timevalue supplied byanexpression

Timebatchwindow win:time_batch(timeperiod[,optional reference point][,flow control])

Tumbling window that batches events andreleasesthem every specified time interval,with flow controloptions

Externally-timed batchwindow

win:ext_timed_batch(timestamp_expression,time_period[,optional_reference_point])

Tumbling window,based on the millisecond timevalue supplied byanexpression

Documentation: http://www.espertech.com/esper/esper-documentationTry online: https://esper-epl-tryout.appspot.com/epltryout/mainform.html

Page 5: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich
Page 6: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

CEPsystemoverview

Page 7: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

CEPsystemoverview

Page 8: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Programming languages used

Page 9: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

ApacheFlink• Stream processing systemwith many features• Librarieson top of batchandstream processing• CEPuses the DataStream API• CEPispatternmatchingoverevent streams

Page 10: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

ApacheApex

• Stream processingplatform• Nativehadoopsupport• Dependsonhadoop

Page 11: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

ApacheKafka

• OriginallybyLinkedIn,open-sourced in2011• 1stversion:High-throughputpublish subscribe• 2ndversion:High-availabilityanddurability• 3rdversion:Stream processing• Then kafkastreams-cep came(unofficial),enablingCEP

Page 12: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Siddhi CEP

define stream TempStream (deviceID long,roomNo int,tempdouble);@info(name ='5minAvgQuery’)fromTempStream#window.time(5min)select roomNo,avg(temp)as avgTempgroup by roomNoinsert into OutputStream;

• Stream processinglibrary,similar toEsper.• Also offersaSQL-likeinterface forquery processing.

Page 13: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

SQLandObject-oriented interfaces

val revenue = orders .filter('cCountry === "FRANCE") .groupBy('cID, 'cName) .select('cID, 'cName, 'revenue.sum AS 'revSum)

orders = table_env.scan("Orders") evenue = (orders.filter("cCountry === 'FRANCE'").group_by("cID, cName").select("cID, cName, revenue.sum AS revSum"))

Table orders = tableEnv.scan("Orders");Table revenue = orders.filter("cCountry === 'FRANCE'").groupBy("cID, cName").select("cID, cName, revenue.sum AS

revSum");

Table revenue = tableEnv.sqlQuery("SELECT cID, cName, SUM(revenue) AS

revSum " +"FROM Orders " +"WHERE cCountry = 'FRANCE' " +"GROUP BY cID, cName");

Flink's JavaTableAPI Flink's JavaSQL

Flink’s ScalaTableAPI Flink’s PythonTableAPI

Page 14: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Benchmark

• Few exist ....andtheymay notbegeneralenough• Difficulties inbenchmarking:biases, lack of knowledge,unfaircomparisons

Page 15: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Feature comparison of DSMS/CEPlibraries

Page 16: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Feature comparisonof EPplatforms• Additional cloud features

• Scalability• Highavailability (HA)• Fault tolerance

Page 17: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Internet of ThingsUse Case

Assign 10 => Temp, 11 => Humidity, 12 => FireDefine Fire(area:string,temp: float)From Temp(value > 45) andlast Humidity([string]area=Temp.area,perc < 25)within 5000 from TempWhere area := Temp.area, temp := Temp.valueConsuming Temp, Humidity;

Page 18: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

DistributedComplex Event Processing

• Splitqueries into subqueries• Placethem on bestnode

• Which isbestnode?• Minimize latency?• Minimize energy consumption?

Page 19: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

DistributedComplex Event Processing

Page 20: Esper · Esper • Language, compiler and runtimefor DSM & CEP • Basic version is a library that can be imported in Java or .NET • Event Processing Language (EPL) enables rich

Streamprocessingvs.CEP– Stillconfused?

• Recommendedreading:• What'sthedifferencebetweenESPandCEP?ByDavidLuckham,originatorofComplexEventProcessing(CEP),authorof"ThePowerofEvents". https://en.wikipedia.org/wiki/David_Luckham• http://www.complexevents.com/2019/07/15/whats-the-difference-between-esp-and-cep-2/


Recommended