I Love APIs 2015
Machine learning, big data, and API technologies have drastically reduced the complexity of building predictive apps. But all these advances also mean that these apps require a new approach to system architecture. This talk discusses the lamda architecture and microservices, and best practices on decomposing your app into batch, near-realtime, an real-time services. Learn how Apigee uses both new architectures to implement predictive apps using Hadoop, Node.js, Cassandra, and ElasticSearch.
9. Batch Layer (Offline)
• Singular Value
Decomposition
• Batch like operations
• High algorithm
complexity
• Results Flow into
Cassandra
10. Speed Layer (Near Line)
10
• Medium request/response
• Medium data
• Medium algorithm
complexity
• Intermediate caching,
incremental learning algos
11. Serving layer (Online)
• Fast request/response,
performance is key – high
availability/SLA
• Fallback mechanism to
Nearline/Offline
operations
• Low algorithm complexity
12. Final Thoughts:
• Very complete system
• Very custom and high
performance
• Lots of specialized systems
for specialized tasks
• Not practical for most
enterprises
17. 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 / Res
Processing
Historical
Events
Recent
Events
Batch
Processing
(MR)
Near
RealTime
Processing
Req / Res
Processing
Batch
Processing
(MR)
Near
RealTime
Processing
Req / Res
Processing
Batch
Processing
(MR)
Near
RealTime
Processing
Req / Res
Processing
Batch
Storage
Near RT
Storage
Query DB
Batch
Storage
Near RT
Storage
Query DB
YARN Batch Layer# Serving Layer#
18. API at all tiers
18
Batch Layer# Serving Layer#
Speed Layer#
Direct Mail
Email
Web
Mobile
Outreach
/Scores#
/Counts#
/Recommendations#
Historical
Events
Recent
Events
22. Batch Layer
• Uses R for building predictive
models
• Algorithms based on Event
Sequences
• Lots and lots of tooling
22
Hadoop
Insights
(GRASP)
API BaaS
(Batch Scores)
1
Apigee UI
25. 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
26. BaaS Node.js Counter Example
var event = new Usergrid.Counter(event_options, function (error, result) { … });
// Then we POST the event to increment the counter
var 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:#
27. Microservices Layer
• API Layer (Swagger)
• Context Injection
• Service Orchestration
• Fallback logic
27
Node.js
Node.js
API BaaS
Direct Mail
Email
Web
Mobile
Outreach
(Context)
Backend