baratine n.
Skip this Video
Loading SlideShow in 5 Seconds..
Baratine PowerPoint Presentation
play fullscreen
1 / 52
Download Presentation

Baratine - PowerPoint PPT Presentation

raja
178 Views
Download Presentation

Baratine

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Baratine Building high-performing resource services

  2. Fast Resource Services • In-memory services • Batching • CPU affinity/single-threaded • Local persistent database • Object Orientated • Communication • Resilience and Scalability • Cloud/Failover • Journaling • Microservices

  3. Microservice (noun) - ?

  4. Baratine.io In-Memory Services

  5. Baratine in the field

  6. Multitasking Multitasking Because we needed another word for “unable to focus on task at hand”

  7. In-Memory Service Uninterrupted Performance • Single threaded • CPU affinity • Batching

  8. Batching Log Service Example • Multithreaded: • synchronized • write() • flush() • synchronized • write() • flush() • synchronized • write() • flush() • Baratine: • write() • write() • write() • flush() • Automatic batching! Where else can you get that? Ex: TCP can send 100 bytes as fast as 1 byte

  9. Batching Uninterrupted Performance • Single threaded • Batching • CPU affinity/single-threaded

  10. Performance In Context Websocket (single) = 50,000 r/s Websocket (batched) = 500,000 r/s In-JVM messaging = 4,000,000 r/s

  11. Resources • In-memory services • Batching • CPU affinity/single-threaded • Resources • Locally Owned • Communication • Resilience and Scalability • Cloud/Failover • Journaling • Microservices

  12. Resources What are they? • REST style URL-addressed service • Objected Oriented: data + methods /my-auction/23456 • Auction • Shopping Cart • Atomic counter, list, queue

  13. @ResourceService Def - Service that manages resources • Each resource owned by one service • Saved to local disk • Replicated • Partitioned by URL

  14. Atomic Counter @ResourceService(“public:///counter/{_id}”) public class CounterServiceImpl { private long _id; private long _counter; @Modify public long incrementAndGet() { return ++_counter; } }

  15. @ResourceService async

  16. Fast Local Database • Store and retrieve resources > key-value store • Async, implemented in Baratine services • Journaled for performance & reliability • Replicated

  17. Resources • In-memory services • Batching • CPU affinity/single-threaded • Resources • Locally Owned • Communication • Resilience and Scalability • Cloud/Failover • Journaling • Microservices

  18. Using a Service? Protocols • REST – For simple client (like Curl), Baratine provides a REST interface. • Ajax RPC style – Simple RPC queries, can use a HTTP request where the payload is the query and the response is the result. • WebSockets – when websockets is available, provides better performance • HTTP long polling – as a WebSocket fallback, Baratine/JAMP can fallback to HTTP long polling. Nodejs Python PHP Java ee

  19. Communicate! Jamp/Hamp JAMP (JSON Active Message Protocol)

  20. Gateway Service Interfacing with existing data • Analytics/ Archive: streaming data for later processing • Loading data: using relational databases • Examples: Hibernate / JPA , Hadoop , SAP , etc…

  21. Resources • In-memory services • Batching • CPU affinity/single-threaded • Resources • Locally Owned • Communication • Resilience and Scalability • Cloud/Failover • Journaling • Microservices

  22. Scaling & Failover • Resource partitioning by URL • Replicated Data • Backup servers Client

  23. Bartender • Manages failover and scaling • Baratine within a cluster • Symmetrical, gossip protocol • Heartbeat • Service pod topology • Cloud/Dynamic Server (EC2)

  24. Service Journaling • Saves inbox method calls • Checkpointing • Recovers on restart • Replicated for failover

  25. Services • In-memory services • Batching • CPU affinity/single-threaded • Resources • Locally Owned • Communication • Resilience and Scalability • Cloud/Failover • Journaling • Microservices

  26. Overview • Key-value Store • Journal • Jamp • Bartender • Baratine File System • Service Registry • Web Server 7 MB (No external dependencies)

  27. Amdahl’s Law Amdahl’s Law: The speedup of a program using multiple processors in parallel computing is limited by the sequential fraction of the program. For example, if 95% of the program can be parallelized, the theoretical maximum speedup using parallel computing would be 20× as shown in the diagram, no matter how many processors are used.

  28. Serial & Parallel A simple way to build high-performing resource services • Partition resources for parallelism • single CPU efficiencies • CPU affinity • Batching • The same hardware can handle 10x to 100x the number of requests, so you have less vertical scaling to manage. To put it simply: Do more with less.

  29. Baratine Services Loosely Coupled Event-Driven Asynchronous Pub/Sub Non-Blocking AGILE!

  30. Microservices • In-memory services • Batching • CPU affinity/single-threaded • Resources • Locally Owned • Communication • Resilience and Scalability • Cloud/Failover • Journaling • Microservices

  31. Microservices • Code that adheres to the principles of SOA • Faster Development • Less Hardware • True Scalability • Easier to debug Marton Abbott & Michael Fisher

  32. Where are we now? Synonyms…? Microservices vs SOA SOA 2.0 Domain Driven Design Reactive Manifesto Silo’d Development 2006! Steve Jones

  33. Example Code Implementation request(s) Interface

  34. Baratine Benefits A simple way to build high-performing resource services • Combining data + service = resource service • Flexible REST/HTTP based communication - Do not need dedicated client library! Writing a non-blocking, asynchronous RPC service is as simple as writing a Java class. Can communicate with (Ruby, Go, C#, Java, Python, JavaScript, etc…).

  35. Example Code Server: Does not need to lock* batch Service request Inbox future result Outbox wake reuse thread (Blocking Integration)

  36. Performance In Context Future(blocking) = 186,000 r/s In-JVM messaging = 4,000,000 r/s

  37. Related Architectures No architecture specifically designed for Microservices

  38. Related Architectures • EJB, JPA, JSF, Jcache, Jax-RS • Can integrate with Java EE • ESB + Datagrid + Cache + NoSQL db + Asynch API • Gridgain • Redis • MongoDB • Terracotta

  39. Baratine + Existing MySQL Cache war Browser/Client Load Balancer UI Service File System Familiarity Deployable Maintainable? Testable Scalable? App Server

  40. Transition… Beer Break!

  41. BACKUP

  42. Baratine Baratine is a new GPL distributed in-memory Java architecture for building high-performance web services. Baratine presents a unification of application and data within the same JVM in a single-threaded model that goes above and beyond caching and NoSQL databases. Its actor-based non-blocking architecture ushers in a new wave of agile microservices that can be quickly built to be inherently scalable. Baratine allows users to build new resilient services or integrate their current services into a platform that can be deployed to hundreds or thousands of servers.

  43. Traditional Problems… • Modify one => Modify all • Long release cycles • Code Complexity • A/B , UI testing Overloaded IDE/Container • DB synchronization • Cache Coherency • Migration Schema • Unable to update one end without updating another

  44. Traditional Problems… Decoupling legacy systems is not easy and still reliant around DB Try to avoid distributed transactions?

  45. Architecture Details Performance -Single threaded + In-Memory • Baratine: • Ask inbox for work • Does 10 units of work • Ask inbox for work • … • Traditional (Queue): • Ask queue for work • Does 1 unit of work • Ask queue for work • … Does not need to block Needs to block (context switch) Future(blocking) = 186,000 r/s Websocket remoting = 500,000 r/s Service messaging = 4,000,000 r/s

  46. Baratine • In-memory services • Batching • CPU affinity/single-threaded • Local persistent database • Object Orientated • Communication • Resilience • Cloud/Failover • Journaling • Microservices

  47. 1992 1995 2000 2003 2006 C++ Java EJB A HISTORY OF EVENTS 2007 2009 2011 2013 2014

  48. Traditional Architecture

  49. Architecture … • Need to store and retrieve data > key-value store • JVM restarts and you need a way to recover > Journal • Need efficient communication across services > Jamp/ Web Server • Management within cloud environment > Bartender

  50. Architecture Details • Deployment in the cloud > Baratine File System • Need to identify services > Service Registry • 7 MB!