Presentation is loading. Please wait.

Presentation is loading. Please wait.

Baratine in Practice Nam Nguyen Software Engineer Caucho Technology, Inc. 1 Date: 2014-06-17 Location: San Diego JUG.

Similar presentations


Presentation on theme: "Baratine in Practice Nam Nguyen Software Engineer Caucho Technology, Inc. 1 Date: 2014-06-17 Location: San Diego JUG."— Presentation transcript:

1 Baratine in Practice Nam Nguyen Software Engineer Caucho Technology, Inc. 1 Date: Location: San Diego JUG

2 Baratine in Practice Download Install Our - Multiple counters - implement an - implement an example Type of services chart Partitioning and clustering 2

3 Task: Baratine quick start - Download - Install - Our first service 3

4 public class CounterServiceImpl { private long _id; private long _counter; public long get() { return _counter; public long incrementAndGet() { return ++_counter; public long decrementAndGet() { return --_counter; public long addAndGet(long value) { _counter = _counter + value; return _counter; } 4

5 jonathan public class CounterServiceImpl { private long _id; private long _counter; public long get() { return _counter; public long incrementAndGet() { return ++_counter; public long decrementAndGet() { return --_counter; public long addAndGet(long value) { _counter = _counter + value; return _counter; } JOURNAL KEY-VALUE DB (internal) 5 HTTP Polling HTTP REST WebSocket Java

6 What You Get + Insane low-latency concurrent performance assign thread 1.incrementAndGet() 2.incrementAndGet() 3.addAndGet() 4.decrementAndGet() 5.incrementAndGet() assign thread 6.incrementAndGet() NO BLOCKING / LOCKING !  CPU cache stays hot (for both data and instructions) 6 Batch A Batch B CPU core uninterrupted during batch no context switching no pausing thread screams through entire batch

7 Batch Programming assign 1incrementAndGet() 2.addAndGet() 3.addAndGet() 4.decrementAndGet() 5.incrementAndGet() - flush writes assign  Leave expensive operations to be executed at the end of the batch. 7 Inbox is empty at this point

8 8 Performance Characteristics Batch Size / Clients Requests per Second Baratine

9 9 Performance Characteristics Batch Size / Clients Requests per Second Baratine Service A to Service B within the same JVM

10 Reliable to Batch assign 1incrementAndGet() 2.addAndGet() 3.addAndGet() 4.decrementAndGet() 5.incrementAndGet() - flush writes assign  Safe to process in batches.

11 Putting it All Together  Freed to operate in memory safely! ▲ Operational Data 11

12 12 public class CounterServiceImpl { private long _id; private long _counter; public long get() { return _counter; public long incrementAndGet() { return ++_counter; public long decrementAndGet() { return --_counter; public long addAndGet(long value) { _counter = _counter + value; return _counter; }

13 @Service Barebones service, basis Singleton, only one instance within a JVM -No automatic restore -No automatic paging -No automatic checkpointing -No automatic query support -No automatic partitioning 13

14 @Service Less magic: you have fine-grained control 14

15 Task: implement a logging service with 15

16 @Workers with a thread-pool acting on the inbox. Example: hibernate, SAP, MySQL, legacy, integration -Does not fully benefit from batching -Not single-threaded +Can block +Multi-threaded 16

17 Task: 17

18 Types of Services Batching ✓✓✓*✓* Journaling ✓✓ Checkpointing ✓✓ Paging ✓ Partitioning ✓ Resource ID’s ✓ Search ✓ Threaded-nesssingle multi Can Block? ✓ Performance ★★★☆★★★★★☆☆☆ 18 (manual)

19 Partitioning and Clustering 19 /auction/111 /auction/444 /auction/999 /auction/222 /auction/555 /auction/888 /auction/000 /auction/333 /auction/666 /auction/ Resources are partitioned by its service URL and ID

20 State of Baratine GPL Been in active development for over 2 years v0.8.3 (alpha) (alpha) Thank you! 20 stealth <

21 21 The End Q and A


Download ppt "Baratine in Practice Nam Nguyen Software Engineer Caucho Technology, Inc. 1 Date: 2014-06-17 Location: San Diego JUG."

Similar presentations


Ads by Google