Be happy. Reactive applications and Microservices with Vert.x tool-kitVictor Hugo / Recife-PEhttp://titorec.net
Reactive applications
What Reactive means ?“Showing a response to a stimulus” Oxford
“Tending to be responsive or to react to a stimulus.” http://www.thefreedictionary.com/reactive
Response and react to a stimulus quickly
Reactive concepts
ResponsiveA responsive system is quick to answer to all users in beautiful ways or bad ways
Rapid
Consistent
ResilientA resilient system offer an architecture type where bad days become good days
A resilient system guarantees the availability of your service
Replication
Isolation
Failover
Load balance
Fail tolerance
ScalableA scalable system is easy to increment when you need to answer several load types
Scaling up (max memory)
Scaling out (max childs on the cluster)
Event drivenA event driven system is based on events which are expected by one or more observers
A event driven system is asynchronous where messages are delivered when the process end without block the thread where the event was fired
Microservices
Monolithic applicationHTML / JAVASCRIPT
Movie Service Recommendation ServiceAnalysis ServiceRating Service User Service
Data Access
Application domain
Microservices architectureHTML / JAVASCRIPT
Movie Service
Data Access
HTML / JAVASCRIPT
User Service
Data Access
HTML / JAVASCRIPT
Rating Service
Data Access
HTML / JAVASCRIPT
Recommendation Service
Data Access
HTML / JAVASCRIPT
Analysis Service
Data Access
MySQL MySQL Neo4j MongoDB Spark
Application domain
Microservices communication
Microservices characteristics• Automation• Continuous delivery• Decentralize the things• Each team take control about their deploys• Small teams (max of 4 people)• Does not necessary stop all services to deploy a new service• Easy scaling• Architecture fail tolerance (One fail does not stop all application)• Each service is elastic, resilient, composable, minimal, and complete• The services are small and easy to manage
And now. Who will help me ?
General purpose
http://vertx.io/
Vert.x is incredibly flexible – whether it’s simple network utilities, sophisticated modern web applications, HTTP/REST microservices, high volume event processing or a full blown back-end message-bus application, Vert.x is a great fit.
Vert.x is not restrictive framework or container and we don’t tell you a correct way to write an application. Instead we give you a lot of useful bricks and let you create your app the way you want to.
Scale
http://vertx.io/
Vert.x is event driven and non blocking. This means your app can handle a lot of concurrency using a small number of kernel threads. Vert.x lets you app scale with minimal hardware.
Scale
Vert.x architecture
How the Event Loop(non-blocking) worksIf a thread to execute a long operation that does not use CPU like read or write data to disk other thread can be executed until the first operation to be finished maximizing the CPU use.
Polyglot
http://vertx.io/
You can use Vert.x with multiple languages including Java, JavaScript, Groovy and Ruby.
Vert.x doesn’t preach about what language is best – you choose the languages you want based on the task at hand and the skill-set of your team.
Advantages
http://vertx.io/
• Vert.x is lightweight - Vert.x core is around 650kB in size.• Vert.x is fast. Here are some independent numbers.• Vert.x is not an application server. There's no monolithic Vert.x instance into which you
deploy applications. You just run your apps wherever you want to.• Vert.x is modular - when you need more bits just add the bits you need and nothing
more.• Vert.x is simple but not simplistic. Vert.x allows you to create powerful apps, simply.• Vert.x is an ideal choice for creating light-weight, high-performance, microservices.
Some things that Vert.x can do• Core / Web (UDP / TCP / HTTP / Rest / Json / Xml)• Data (MongoDB / JDBC Client / Redis Client / Spring data using JAVA language)• Hibernate using JAVA language• Mail Client• Authentication and Authorisation• Docker (Let you run Vert.x Applications in docker containers)• Clustering(Hazelcast)• Maven• Spring framework using JAVA language• and more...
Hands on