Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Time Series With OrientDB - Fosdem 2015
1. Time flows, on Graph
Managing event sequences and time series with a Document-
Graph Database
FOSDEM 2015
Enrico Risa
Orient Technologies LTD
Twitter: @wolf4ood
Emanuele Tagliaferri
Orient Technologies LTD
Twitter: @tglman
2. Time What…?
Time series:
A time series is a sequence of data points, typically
consisting of successive measurements made over a
time interval (Wikipedia)
3. Time What…?
Event sequences:
• A set of events with a timestamp
• A set of relationships “happened
before/after”
• Cause and effect relationships
15. Optimization
Aggregation logic
• Second 0 -> insert
• Second 1 -> insert
• …
• Second 57 -> insert
• Second 58 -> insert
• Second 59 -> insert + aggregate update
– Write aggregate value on minute vertex
●
Minute == 59? Calculate aggregate on hour vertex
16. OrientDB
How to aggregate
Hooks: Server side triggers (Java or Javascript),
executed when DB operations happen (eg. Insert or
update)
Java interface:
Public RESULT onBeforeInsert(…);
public void onAfterInsert(…);
public RESULT onBeforeUpdate(…);
public void onAfterUpdate(…);
18. Optimization
Query logic:
• Traverse from root node to specified level
(filtering based on vertex data)
• Is there aggregate value?
– Yes: return it
– No: go one level down and do the same
Aggregation on a level will be VERY fast if you
have horizontal edges!
19. OrientDB
How to calculate aggregate values with a query
Input params:
- Root node (suppose it is #11:11)
select sum(aggregateVal) from (
traverse out() from #11:11
while in().aggregateVal is null
)
With the same logic you can query based on time
windows
21. POC Implementation
Core:
● As OrientDB Plugin
● Rely on Hooks
● Aggregation Engine
● Handle all Time Unit
Data Visualization:
● Simple UI (Realtime/History)
● Query in Studio
22. Core
● Plugin that register hook and some input/output
source (websocket ,message queue, socket etc..)
● Hook on Event Class (entry point)
- Event can be saved or not.
- Aggregations are made when the lower time units
changes
- Pre-allocation of TimeUnit Pointers
● Time unit tracked:
-Year
-Month
-Day
-Minute
-Second
23. Core
Advantages
● Simple (Few lines of code)
● No Indexes
● Easy to use
– Plain OrientDB sql to insert an event
insert into event set bets = 1, cpu = 50
● Fast (Especially in plocal mode)
25. Data Visualization
Two Charts:
● Realtime data through WebSocket
The engine pushes the events received every seconds
● Range query for history Data
Using the powerfull array range notation we can query for
a specific time range
27. Data Query Time unit
● Array Notation
select
expand(m[1].d[30].h[13].m[5-10])
from year where time = 2015
● Traverse with Next
traverse next from
(select expand(m[1].d[26].h[19].m[37])
from year where time = 2015 )
while $depth <= 3
28. Data Query Aggregation
● Array Notation
select sum(bets)from (select
expand(m[1].d[30].h[13].m[5-10])
from year where time = 2015)
● Traverse with Next
select sum(bets)from {traverse next from
(select expand(m[1].d[26].h[19].m[37])
from year where time = 2015 )
while $depth <= 3)
37. One model is not enough
One of most common issues of my customers
is:
“I have a zoo of technologies in my application
stack, and it’s getting worse every day”
My answer is: Multi-Model DB
of course ;-)