baratine - cauchocaucho.com › wp-content › uploads › 2017 › 05 ›...
TRANSCRIPT
![Page 1: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/1.jpg)
#DevoxxUS #DevoxxUS
BaratineOperational Service Views
#Baratine @Cauchoresin
![Page 2: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/2.jpg)
#DevoxxUS #DevoxxUS
Architecture Overview
#Baratine @Cauchoresin
![Page 3: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/3.jpg)
#DevoxxUS #DevoxxUS #Baratine
1. Strong encapsulation boundaries.
2. Each service has its own thread and efficient lock-free inbox.
3. Inside a service, application code can be single-threaded.
Key Concepts:
@Cauchoresin
Baratine Service
![Page 4: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/4.jpg)
#DevoxxUS #DevoxxUS #Baratine
4. Persistent services load and store to a document-style key/value database.
5. Services use their data in-memory; loading and storing is transparent.
6. Services own their data in an object-oriented model. No additional locks are needed to protect against other services modifying their data
@Cauchoresin
Baratine Service
![Page 5: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/5.jpg)
#DevoxxUS #DevoxxUS #Baratine
1. In-memory persistent services are built-in to Baratine, using its asynchronous high-performance internal database Kraken.
2. An Application service operates on its data in-memory, improving performance and simplifying code.
3. The data is automatically loaded and saved to the internal document-oriented database as part of the asset lifecycle.
@Cauchoresin
Database Persistence
![Page 6: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/6.jpg)
#DevoxxUS #DevoxxUS
Use Case #1: API
#Baratine @Cauchoresin
![Page 7: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/7.jpg)
#DevoxxUS #DevoxxUS #Baratine @Cauchoresin
API Engine
![Page 8: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/8.jpg)
#DevoxxUS #DevoxxUS
Bookstore REST service
#Baratine
Traditional
Baratine
/books
/books1. Operations done in-
memory 2. No locking/blocking
threads 3. Single thread ownership of
data
1. Operations must be persisted to db
2. Objects must be synchronized for multiple requests
3. No thread ownership of data
@Cauchoresin
Service thread
![Page 9: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/9.jpg)
#DevoxxUS #DevoxxUS #Baratine
RESTEasy vs Baratine
// best out of 10 runs $ wrk "http://127.0.0.1:8080/books"
Baratine:
• Over 2x the performance • Can be scaled to match cores on CPU • Persistence added with single annotation
@Cauchoresin
Bookstore REST service
![Page 10: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/10.jpg)
#DevoxxUS #DevoxxUS #Baratine
The numbers represented are for a database that is on the same network.
Baratine is much faster because it doesn’t need to touch the database on each and every request - it just uses its data that is residing in-memory.
@Cauchoresin
• One update per request • Data persisted (MySQL)
Benchmark requirements:
In-Memory Operations
![Page 11: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/11.jpg)
#DevoxxUS #DevoxxUS #Baratine
1. Data loaded once 1.1. Only removed on an LRU
2. Large data sets shard 2.1. Data owned per service
3. Write-through in place 3.1. Baratine saves the fields of the asset to an
embedded, fully reactive document database named Kraken (No data schema)
4. Journaling for reliability/failover 4.1. The inbox is backed by a repayable journal
for failover
@Cauchoresin
In-Memory Operations
![Page 12: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/12.jpg)
#DevoxxUS #DevoxxUS #Baratine
• Continuation/async performance is consistently better than async/future, especially under load.
• Under light load, async performance is around 9M method calls/sec while future performance is 4M calls/sec
• As the load increases future performance drops to 0.5M calls/sec. Async performance drops as well but stays over 2.2M calls/sec.
Baratine Performance
@Cauchoresin
![Page 13: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/13.jpg)
#DevoxxUS #DevoxxUS
Use Case #2: Microservice
#Baratine @Cauchoresin
![Page 14: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/14.jpg)
#DevoxxUS #DevoxxUS
Auction Microservice
#Baratine @Cauchoresin
The application uses the following Baratine provided services
• DatabaseService • Store (key - value) • Timer • Event • WebSocket
![Page 15: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/15.jpg)
#DevoxxUS #DevoxxUS
Questions?
#Baratine @Cauchoresin
?
![Page 16: Baratine - Cauchocaucho.com › wp-content › uploads › 2017 › 05 › Baratine_Devoxx.pdfBookstore REST service #Baratine Traditional Baratine /books /books 1. Operations done](https://reader036.vdocuments.us/reader036/viewer/2022081405/5f0c3ade7e708231d4346009/html5/thumbnails/16.jpg)
#DevoxxUS #DevoxxUS
Thank You!
#Baratine @Cauchoresin
baratine.io