SlideShare a Scribd company logo
1 of 29
Microservices
Code Session
● Overview Of Microservices
● Service Discovery
○ Consul - Overview
○ Demo
● Protocol Buffers
○ Overview
○ Example
● gRPC
○ RPC - Overview
○ Google’s gRPC - Example
● Yotpo Services
○ Structure
○ Workflow of creating a new service
● Yotpo Service Utilities and The PB Project
● Deployment
○ Makefile
○ Travis
○ Testing
● Creating a new Service - Demo
Agenda
Microservices - Overview
The Microservice architectural style is an approach to developing a single
application as a suite of small services, each running in its own process and
communicating with lightweight mechanisms, often an HTTP resource API. These
services are built around business capabilities and independently deployable by
fully automated deployment machinery. There is a bare minimum of centralized
management of these services, which may be written in different programming
languages and use different data storage technologies.
Attributes Of Microservices
● Componentization as a Service: bringing certain components together to make a customized service.
● Organized Around Business Capabilities: segregating capabilities for specific business areas like user interface and
external integrations.
● Development Process is Based on Products Not Projects: following Amazon’s “eat your own dog food,” developers
stay with the software for the product’s lifetime.
● Smart Endpoints and Dumb Pipes: each microservice is as decoupled as possible with its own domain logic.
● Decentralized Governance: enabling developer choice to build on preferred languages for each component.
● Decentralized Data Management: having each microservice label and handle data differently.
● Infrastructure Automation: including automated deployment up the pipeline.
● Design for Failure: meaning that more ongoing testing of “what if” has to occur to prepare for failure.
The Good
● Microservice architecture gives developers the freedom to independently develop and deploy
services
● A microservice can be developed by a fairly small team
● Code for different services can be written in different languages (though many practitioners
discourage it)
● Easy integration and automatic deployment (using open-source continuous integration tools such
as Jenkins, Hudson, etc.)
● Easy to understand and modify for developers, thus can help a new team member become
productive quickly
● The developers can make use of the latest technologies
● The code is organized around business capabilities
● When change is required in a certain part of the application, only the related service can be
modified and redeployed—no need to modify and redeploy the entire application
● Better fault isolation: if one microservice fails, the other will continue to work (although one
problematic area of a monolith application can jeopardize the entire system)
● Easy to scale and integrate with third-party services
● No long-term commitment to technology stack
The Bad
● Due to distributed deployment, testing can become complicated and tedious
● The architecture brings additional complexity as the developers have to mitigate fault tolerance, network latency,
and deal with a variety of message formats as well as load balancing
● When number of services increases, integration and managing whole products can become complicated
● In addition to several complexities of monolithic architecture, the developers have to deal with the additional
complexity of a distributed system
● Developers have to put additional effort into implementing the mechanism of communication between the services
● Handling use cases that span more than one service without using distributed transactions is not only tough but
also requires communication and cooperation between different teams
● Partitioning the application into microservices is very much an art
The Ugly
Yotpo Monolithic App
B2B
Widget
Analytics
API MySQL
Yotpo Microservices
B2B
Widget
Analytics
Router/Api
Mongo
MySQL
Redis
RethinkDB
Cassandra
Link
Service
Review
Service
Feature
Service
Account
Service
Purchase
Service
**General Concept
New Api - General Request Overview
Service Discovery
Service discovery is a key component of most distributed systems and service oriented architectures.
There are two sides to the problem of locating services. Service Registration and Service Discovery.
● Service Registration - The process of a service registering its location in a central registry. It usually register
its host and port and sometimes authentication credentials, protocols, versions numbers, and/or environment
details.
● Service Discovery - The process of a client application querying the central registry to learn of the location of
services.
Service Discovery Diagram
Consul
Key Features
● Service Health Checks
● Support for multiple Datacenters - Datacenter Aware
● Built in Key/Value store
● Query using DNS or HTTP
Installation is here
Consul Demo
Protocol Buffers
“Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing
structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be
structured once, then you can use special generated source code to easily write and read your structured
data to and from a variety of data streams and using a variety of languages.”
Why use Protobuffs?
● Validations and Extensibility and Saftey
○ No need for model validation
○ required, optional, repeated keywords
● Less Boilerplate Code
○ No Need to for Encoding/Decoding/Parsing Logic - this is handled by the class that was generated by the
proto file.
● Easy Language Interoperability
○ Generate proto file for the every language you need
● Very Dense data and Very Fast Processing
Example of Proto definition
Language examples and guidelines here
RPC - Remote Procedure Call
Remote Procedure Call (RPC) is a protocol for inter-process communication that allows
a computer program to cause a subroutine or procedure to execute in another address
space without having to understand network details.
RPC uses the client/server model. The requesting program is a client and the service-
providing program is the server. Like a regular or local procedure call, an RPC is a
synchronous operation requiring the requesting program to be suspended until the results
of the remote procedure are returned. However, the use of lightweight processes or
threads that share the same address space allows multiple RPCs to be performed
concurrently.
RPC Diagram
Google’s gRPC
In gRPC a client application can directly call
methods on a server application on a different
machine as if it was a local object, making it easier
for you to create distributed applications and
services. As in many RPC systems, gRPC is based
around the idea of defining a service, specifying the
methods that can be called remotely with their
parameters and return types. On the server side,
the server implements this interface and runs a
gRPC server to handle client calls. On the client
side, the client has a stub that provides exactly the
same methods as the server.
gRPC Example
The Yotpo Service
Motivation and guiding principles
● Using gRPC with Protobuf makes development easy - no need to take care of
server core code (connection pools etc) we generate the code in the
language of our choosing and implement our business logic.
● Code reuse and abstraction - Our Service code doesn't care which service
discovery we use - we can change it in the utils and it would be transparent
to other services - INTERFACES.
Creating a new Service
Client Server
Utils Service
Service
Discovery DB
Protobuf
EndPoints Messages
gRPC
Shared Code
Serialization
Compiled
Objects
Yotpo Service Utils
Is a project for common utilities that we would like to share between services.
Some of the things we implemented :
● Service Discovery - Interaction with Consul
● Logging
● Flags
● Signals
● Service Factory:
○ Database Clients - RedisConnection
○ Service Struct - Built from Service Config (host, port, type) and an interface of Service
Connector - all services must implemented the ping method so we could treat them all as
service connectors
Deployment
● Makefile
● Travis
Live Demo
Questions?
What’s Next?
Putting it all together
Router project
Yotpo microservices

More Related Content

What's hot

Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ IntegrationsMumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ IntegrationsAkshata Sawant
 
Mumbai MuleSoft Meetup #15
Mumbai MuleSoft Meetup #15Mumbai MuleSoft Meetup #15
Mumbai MuleSoft Meetup #15Akshata Sawant
 
SDN-enhanced Services in Enterprises and Data Centers
SDN-enhanced Services in Enterprises and Data CentersSDN-enhanced Services in Enterprises and Data Centers
SDN-enhanced Services in Enterprises and Data CentersAnees Shaikh
 
Mumbai MuleSoft Meetup #18
Mumbai MuleSoft Meetup #18Mumbai MuleSoft Meetup #18
Mumbai MuleSoft Meetup #18Akshata Sawant
 
An open management plane (2015 Open Networking Summit)
An open management plane (2015 Open Networking Summit)An open management plane (2015 Open Networking Summit)
An open management plane (2015 Open Networking Summit)Anees Shaikh
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stackLuca Mattia Ferrari
 
Bringing SDN to the Management Plane
Bringing SDN to the Management PlaneBringing SDN to the Management Plane
Bringing SDN to the Management PlaneAnees Shaikh
 
Extending SDN beyond the control plane
Extending SDN beyond the control planeExtending SDN beyond the control plane
Extending SDN beyond the control planeAnees Shaikh
 
[WSO2Con EU 2018] Deploying Applications in K8S and Docker
[WSO2Con EU 2018] Deploying Applications in K8S and Docker[WSO2Con EU 2018] Deploying Applications in K8S and Docker
[WSO2Con EU 2018] Deploying Applications in K8S and DockerWSO2
 
MuleSoft Meetup Roma - Processi di Automazione su CloudHub
MuleSoft Meetup Roma - Processi di Automazione su CloudHubMuleSoft Meetup Roma - Processi di Automazione su CloudHub
MuleSoft Meetup Roma - Processi di Automazione su CloudHubAlfonso Martino
 
Open management interfaces for NFV
Open management interfaces for NFVOpen management interfaces for NFV
Open management interfaces for NFVAnees Shaikh
 
Model-driven Network Automation
Model-driven Network AutomationModel-driven Network Automation
Model-driven Network AutomationAnees Shaikh
 
Apache Beam: Lote portátil y procesamiento de transmisión
Apache Beam: Lote portátil y procesamiento de transmisiónApache Beam: Lote portátil y procesamiento de transmisión
Apache Beam: Lote portátil y procesamiento de transmisiónGlobant
 
Multi-Lingual Accumulo Communications
Multi-Lingual Accumulo CommunicationsMulti-Lingual Accumulo Communications
Multi-Lingual Accumulo CommunicationsAccumulo Summit
 

What's hot (20)

Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ IntegrationsMumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
Mumbai MuleSoft Meetup #19 - Anypoint monitoring and MQ Integrations
 
Mumbai MuleSoft Meetup #15
Mumbai MuleSoft Meetup #15Mumbai MuleSoft Meetup #15
Mumbai MuleSoft Meetup #15
 
SDN-enhanced Services in Enterprises and Data Centers
SDN-enhanced Services in Enterprises and Data CentersSDN-enhanced Services in Enterprises and Data Centers
SDN-enhanced Services in Enterprises and Data Centers
 
Mumbai MuleSoft Meetup #18
Mumbai MuleSoft Meetup #18Mumbai MuleSoft Meetup #18
Mumbai MuleSoft Meetup #18
 
Thomson Reuters
Thomson ReutersThomson Reuters
Thomson Reuters
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
 
An open management plane (2015 Open Networking Summit)
An open management plane (2015 Open Networking Summit)An open management plane (2015 Open Networking Summit)
An open management plane (2015 Open Networking Summit)
 
#1 MuleSoft Meetup in Geneva
#1 MuleSoft Meetup in Geneva #1 MuleSoft Meetup in Geneva
#1 MuleSoft Meetup in Geneva
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stack
 
Bringing SDN to the Management Plane
Bringing SDN to the Management PlaneBringing SDN to the Management Plane
Bringing SDN to the Management Plane
 
.Net Introduction
.Net Introduction.Net Introduction
.Net Introduction
 
Extending SDN beyond the control plane
Extending SDN beyond the control planeExtending SDN beyond the control plane
Extending SDN beyond the control plane
 
Go programming language
Go programming languageGo programming language
Go programming language
 
[WSO2Con EU 2018] Deploying Applications in K8S and Docker
[WSO2Con EU 2018] Deploying Applications in K8S and Docker[WSO2Con EU 2018] Deploying Applications in K8S and Docker
[WSO2Con EU 2018] Deploying Applications in K8S and Docker
 
MuleSoft Meetup Roma - Processi di Automazione su CloudHub
MuleSoft Meetup Roma - Processi di Automazione su CloudHubMuleSoft Meetup Roma - Processi di Automazione su CloudHub
MuleSoft Meetup Roma - Processi di Automazione su CloudHub
 
gRPC services testing
gRPC services testinggRPC services testing
gRPC services testing
 
Open management interfaces for NFV
Open management interfaces for NFVOpen management interfaces for NFV
Open management interfaces for NFV
 
Model-driven Network Automation
Model-driven Network AutomationModel-driven Network Automation
Model-driven Network Automation
 
Apache Beam: Lote portátil y procesamiento de transmisión
Apache Beam: Lote portátil y procesamiento de transmisiónApache Beam: Lote portátil y procesamiento de transmisión
Apache Beam: Lote portátil y procesamiento de transmisión
 
Multi-Lingual Accumulo Communications
Multi-Lingual Accumulo CommunicationsMulti-Lingual Accumulo Communications
Multi-Lingual Accumulo Communications
 

Similar to Yotpo microservices

Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On Ram G Suri
 
Consumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With PostmanConsumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With PostmanPostman
 
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEANGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEANGINX, Inc.
 
introduction to micro services
introduction to micro servicesintroduction to micro services
introduction to micro servicesSpyros Lambrinidis
 
Modern apps in a microservices age May meet up Architecting for Innovation
Modern apps in a microservices age May meet up Architecting for InnovationModern apps in a microservices age May meet up Architecting for Innovation
Modern apps in a microservices age May meet up Architecting for InnovationAndrew Blades
 
MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021Ieva Navickaite
 
Nginx Conference 2016 - Learnings and State of the Industry
Nginx Conference 2016 - Learnings and State of the IndustryNginx Conference 2016 - Learnings and State of the Industry
Nginx Conference 2016 - Learnings and State of the IndustryBenjamin Scholler
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureMRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureNGINX, Inc.
 
Service-Mesh-Presentation.pdf
Service-Mesh-Presentation.pdfService-Mesh-Presentation.pdf
Service-Mesh-Presentation.pdfchanhluc2112
 
Ato Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoAto Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoSystango
 
Microservice Pattern Launguage
Microservice Pattern LaunguageMicroservice Pattern Launguage
Microservice Pattern LaunguageInho Kang
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service ArchitectureLinjith Kunnon
 
Cloud Native Application Integration With APIs
Cloud Native Application Integration With APIsCloud Native Application Integration With APIs
Cloud Native Application Integration With APIsNirmal Fernando
 
What do you need to know about g rpc on .net
What do you need to know about g rpc on .net What do you need to know about g rpc on .net
What do you need to know about g rpc on .net Moon Technolabs Pvt. Ltd.
 
Cpp In Soa
Cpp In SoaCpp In Soa
Cpp In SoaWSO2
 

Similar to Yotpo microservices (20)

Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On
 
Consumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With PostmanConsumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With Postman
 
Microservices-101
Microservices-101Microservices-101
Microservices-101
 
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEANGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
 
Microservice architecture
Microservice architectureMicroservice architecture
Microservice architecture
 
Twitter Finagle
Twitter FinagleTwitter Finagle
Twitter Finagle
 
introduction to micro services
introduction to micro servicesintroduction to micro services
introduction to micro services
 
Modern apps in a microservices age May meet up Architecting for Innovation
Modern apps in a microservices age May meet up Architecting for InnovationModern apps in a microservices age May meet up Architecting for Innovation
Modern apps in a microservices age May meet up Architecting for Innovation
 
MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021
 
Nginx Conference 2016 - Learnings and State of the Industry
Nginx Conference 2016 - Learnings and State of the IndustryNginx Conference 2016 - Learnings and State of the Industry
Nginx Conference 2016 - Learnings and State of the Industry
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureMRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
 
Microservices
MicroservicesMicroservices
Microservices
 
Service-Mesh-Presentation.pdf
Service-Mesh-Presentation.pdfService-Mesh-Presentation.pdf
Service-Mesh-Presentation.pdf
 
Ato Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoAto Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by Systango
 
6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF
 
Microservice Pattern Launguage
Microservice Pattern LaunguageMicroservice Pattern Launguage
Microservice Pattern Launguage
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service Architecture
 
Cloud Native Application Integration With APIs
Cloud Native Application Integration With APIsCloud Native Application Integration With APIs
Cloud Native Application Integration With APIs
 
What do you need to know about g rpc on .net
What do you need to know about g rpc on .net What do you need to know about g rpc on .net
What do you need to know about g rpc on .net
 
Cpp In Soa
Cpp In SoaCpp In Soa
Cpp In Soa
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Yotpo microservices

  • 2.
  • 3. ● Overview Of Microservices ● Service Discovery ○ Consul - Overview ○ Demo ● Protocol Buffers ○ Overview ○ Example ● gRPC ○ RPC - Overview ○ Google’s gRPC - Example ● Yotpo Services ○ Structure ○ Workflow of creating a new service ● Yotpo Service Utilities and The PB Project ● Deployment ○ Makefile ○ Travis ○ Testing ● Creating a new Service - Demo Agenda
  • 4. Microservices - Overview The Microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.
  • 5. Attributes Of Microservices ● Componentization as a Service: bringing certain components together to make a customized service. ● Organized Around Business Capabilities: segregating capabilities for specific business areas like user interface and external integrations. ● Development Process is Based on Products Not Projects: following Amazon’s “eat your own dog food,” developers stay with the software for the product’s lifetime. ● Smart Endpoints and Dumb Pipes: each microservice is as decoupled as possible with its own domain logic. ● Decentralized Governance: enabling developer choice to build on preferred languages for each component. ● Decentralized Data Management: having each microservice label and handle data differently. ● Infrastructure Automation: including automated deployment up the pipeline. ● Design for Failure: meaning that more ongoing testing of “what if” has to occur to prepare for failure.
  • 6. The Good ● Microservice architecture gives developers the freedom to independently develop and deploy services ● A microservice can be developed by a fairly small team ● Code for different services can be written in different languages (though many practitioners discourage it) ● Easy integration and automatic deployment (using open-source continuous integration tools such as Jenkins, Hudson, etc.) ● Easy to understand and modify for developers, thus can help a new team member become productive quickly ● The developers can make use of the latest technologies ● The code is organized around business capabilities ● When change is required in a certain part of the application, only the related service can be modified and redeployed—no need to modify and redeploy the entire application ● Better fault isolation: if one microservice fails, the other will continue to work (although one problematic area of a monolith application can jeopardize the entire system) ● Easy to scale and integrate with third-party services ● No long-term commitment to technology stack
  • 7. The Bad ● Due to distributed deployment, testing can become complicated and tedious ● The architecture brings additional complexity as the developers have to mitigate fault tolerance, network latency, and deal with a variety of message formats as well as load balancing ● When number of services increases, integration and managing whole products can become complicated ● In addition to several complexities of monolithic architecture, the developers have to deal with the additional complexity of a distributed system ● Developers have to put additional effort into implementing the mechanism of communication between the services ● Handling use cases that span more than one service without using distributed transactions is not only tough but also requires communication and cooperation between different teams ● Partitioning the application into microservices is very much an art
  • 9. Yotpo Monolithic App B2B Widget Analytics API MySQL Yotpo Microservices B2B Widget Analytics Router/Api Mongo MySQL Redis RethinkDB Cassandra Link Service Review Service Feature Service Account Service Purchase Service **General Concept
  • 10. New Api - General Request Overview
  • 11. Service Discovery Service discovery is a key component of most distributed systems and service oriented architectures. There are two sides to the problem of locating services. Service Registration and Service Discovery. ● Service Registration - The process of a service registering its location in a central registry. It usually register its host and port and sometimes authentication credentials, protocols, versions numbers, and/or environment details. ● Service Discovery - The process of a client application querying the central registry to learn of the location of services.
  • 12.
  • 14. Consul Key Features ● Service Health Checks ● Support for multiple Datacenters - Datacenter Aware ● Built in Key/Value store ● Query using DNS or HTTP Installation is here
  • 16. Protocol Buffers “Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.” Why use Protobuffs? ● Validations and Extensibility and Saftey ○ No need for model validation ○ required, optional, repeated keywords ● Less Boilerplate Code ○ No Need to for Encoding/Decoding/Parsing Logic - this is handled by the class that was generated by the proto file. ● Easy Language Interoperability ○ Generate proto file for the every language you need ● Very Dense data and Very Fast Processing
  • 17. Example of Proto definition Language examples and guidelines here
  • 18. RPC - Remote Procedure Call Remote Procedure Call (RPC) is a protocol for inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without having to understand network details. RPC uses the client/server model. The requesting program is a client and the service- providing program is the server. Like a regular or local procedure call, an RPC is a synchronous operation requiring the requesting program to be suspended until the results of the remote procedure are returned. However, the use of lightweight processes or threads that share the same address space allows multiple RPCs to be performed concurrently.
  • 20. Google’s gRPC In gRPC a client application can directly call methods on a server application on a different machine as if it was a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based around the idea of defining a service, specifying the methods that can be called remotely with their parameters and return types. On the server side, the server implements this interface and runs a gRPC server to handle client calls. On the client side, the client has a stub that provides exactly the same methods as the server.
  • 22. The Yotpo Service Motivation and guiding principles ● Using gRPC with Protobuf makes development easy - no need to take care of server core code (connection pools etc) we generate the code in the language of our choosing and implement our business logic. ● Code reuse and abstraction - Our Service code doesn't care which service discovery we use - we can change it in the utils and it would be transparent to other services - INTERFACES.
  • 23. Creating a new Service Client Server Utils Service Service Discovery DB Protobuf EndPoints Messages gRPC Shared Code Serialization Compiled Objects
  • 24. Yotpo Service Utils Is a project for common utilities that we would like to share between services. Some of the things we implemented : ● Service Discovery - Interaction with Consul ● Logging ● Flags ● Signals ● Service Factory: ○ Database Clients - RedisConnection ○ Service Struct - Built from Service Config (host, port, type) and an interface of Service Connector - all services must implemented the ping method so we could treat them all as service connectors
  • 28. What’s Next? Putting it all together Router project

Editor's Notes

  1. How would services know to communicate with each other? no need for config files
  2. Service discovery is the concept of separating how processes and services find and communicate with one another. Typically this involves each service/node announcing themselves, some form of storage of the name and host/port of the service, and the ability to query (discover) this data from other services. In effect and in short, decoupling services.
  3. http://demo.consul.io/ui/
  4. Protocol Buffers offer several compelling advantages over JSON for sending data over the wire between internal services. While not a wholesale replacement for JSON, especially for services which are directly consumed by a web browser, Protocol Buffers offers very real advantages not only in the ways outlined above, but also typically in terms of speed of encoding and decoding, size of the data on the wire, and more. - Simple installation using brew
  5. Proto3 - New version of proto now in beta stage protoc -I . lib/no_rpc/review_no_rpc.proto --go_out=plugins=grpc:. protoc -I . lib/with_rpc/review_with_rpc.proto --go_out=plugins=grpc:.
  6. Building on the HTTP/2 standard brings many capabilities such as bidirectional streaming, flow control, header compression, multiplexing requests over a single TCP connection and more. These features save battery life and data usage on mobile devices while speeding up services and web applications running in the cloud.