I Love APIs 2015: Building Predictive Apps with Lamda and MicroServices
-
Author
apigee-google-cloud -
Category
Software
-
view
2.383 -
download
1
Embed Size (px)
Transcript of I Love APIs 2015: Building Predictive Apps with Lamda and MicroServices
-
1
Building predictive apps with & -services architecture #Alan Ho @karlunho
Director of Product
-
Context is King
2
-
Technology Choices Today
3
Datawarehouse RDBMS J2EE AppServer
-
Lambda Architecture
4
-
What is Context ?
5
Historical #Events#
Recent#Events#
Now#
-
Lambda Architecture
6
Batch Storage
Near RT Storage
Batch Processing
(MR)
Near RealTime
Processing
Query DB
Batch Layer# Serving Layer#
Speed Layer#
APIs
Direct Mail
Email
Web
Mobile
Outreach
Req / ResProcessing
HistoricalEvents
RecentEvents
-
Netflix
7
-
Offline = Batch Layer
Nearline = Speed Layer
Online = Serving Layer
-
Batch Layer (Offline) Singular Value
Decomposition
Batch like operations
High algorithm complexity
Results Flow into Cassandra
-
Speed Layer (Near Line)
10
Medium request/response
Medium data
Medium algorithm complexity
Intermediate caching, incremental learning algos
-
Serving layer (Online)
Fast request/response, performance is key high availability/SLA
Fallback mechanism to Nearline/Offline operations
Low algorithm complexity
-
Final Thoughts:
Very complete system
Very custom and high performance
Lots of specialized systems for specialized tasks
Not practical for most enterprises
-
Microservices & LambdaArchitecture
13
-
App Explosion
14
How can I embed context-awareness in all customer experiences?
-
Micro-services
15
-
Micro-services Best Practice
16
Isolation REST API
HTTP:///
-
Isolation at all tiers
17
Batch Storage
Near RT Storage
Batch Processing
(MR)
Near RealTime
Processing
Query DB
APIs
Direct Mail
Email
Web
Mobile
Outreach
Req / ResProcessing
HistoricalEvents
RecentEvents
Batch Processing
(MR)
Near RealTime
Processing
Req / ResProcessing
Batch Processing
(MR)
Near RealTime
Processing
Req / ResProcessing
Batch Processing
(MR)
Near RealTime
Processing
Req / ResProcessing
Batch Storage
Near RT Storage
Query DB
Batch Storage
Near RT Storage
Query DB
YARN Batch Layer# Serving Layer#
-
API at all tiers
18
Batch Layer# Serving Layer#
Speed Layer#
Direct Mail
Email
Web
Mobile
Outreach
/Scores#
/Counts#
/Recommendations#
HistoricalEvents
RecentEvents
-
Real-time Scoring for Recommendations
19
-
Recommendations Example
20
-
Real-time Scoring Architecture
21
Hadoop
In-Memory
Insights(GRASP)
Node.js
Node.jsAPI BaaS
(APIs)
Direct Mail
Email
Web
Mobile
Outreach
(Batch Scores)
(Activities / Counters)
(Query)
HistoricalEvents
RealtimeEvents
(Context)
Backend
(Mashup)
34
5
1
2 6
Node.js
-
Batch Layer
Uses R for building predictive models
Algorithms based on Event Sequences
Lots and lots of tooling
22
HadoopInsights(GRASP)
API BaaS
(Batch Scores)1
Apigee UI
-
23
R Code#
-
24
Scored Export to Serving Layer#
-
Speed Layer
Easy to program via node.js
Low algorithm complexity Storm is overkill for most Apigee customers
Simple aggregates via C* counters good enough
Good for capturing locations, activity stream, etc.
25
Node.js
API BaaS
Apigee UI
-
BaaS Node.js Counter Example
var event = new Usergrid.Counter(event_options, function (error, result) { });
// Then we POST the event to increment the countervar counter_options = { name: productName + .add_to_cart', value: 1 }event.increment (counter_options, function (error, result)
26
curl -X GET https://api.usergrid.com/my-org/my-app/counters?counter=appleIpad3.add_to_cart
Input code:
Output code:#
-
Microservices Layer
API Layer (Swagger)
Context Injection
Service Orchestration
Fallback logic
27
Node.js Node.jsAPI BaaS
Direct Mail
Email
Web
Mobile
Outreach
(Context)
Backend
-
Swagger Based API Design
28
-
Node.js Code
29
-
APIs are Everywhere
30
Hadoop
In-Memory
Insights
Node.js Node.jsAPI BaaS
Direct Mail
Email
Web
Mobile
Outreach
HistoricalEvents
RealtimeEvents
Backend
Hive
RHadoop
Node.js
Storm
Spark
-
Conclusion
Lambda architecture is a great way to combine realtime & batch processing
Microservices complements Lambda architecture for loosely-coupled systems
312015 Apigee. All Rights Reserved.