SlideShare a Scribd company logo
1 of 22
Download to read offline
Monolith vs Microservices with
Golang at Practice
Ivan Kutuzov, SoftServe, #GolangUA
Agenda:
- Quick introduction to GO
- How to create monolith app
- How to create microservice
- What a difference
Go pros
● Fast compilation
● Simplicity
● Memory safe
● Efficiency
● Concurrency
● Network oriented
Guiding principles
● Simplicity
● Readability
● Productivity
Monolith
Maintainability
● Changes in one area of an application should affect
as few other places as possible
● Adding features should not require large code-base
changes
● Adding new ways to interact with the application
should require as few changes as possible
● Debugging should require as few work-arounds and
"just this once" hacks as possible
● Testing should be relatively easy
https://dave.cheney.net/practical-go/presentations/qcon-china.html
Hexagonal Architecture/ Clean Architecture / Port and Adapters
● Entity
● Value Object
● Domain Event
● Aggregate
● Service
● Repository
Where read more
● Kat Zien: How Do You Structure Your Go Apps
● Peter Bourgon: Go for Industrial Programming
● Ben Johnson: Standard Package Layout
● Marcus Olsson: gh: marcusolsson/goddd
Existing frameworks & tools
https://github.com/speedwheel/awesome-go-web-frameworks/blob/master/README.md
Existing frameworks & tools
● Router: Named Path Parameters & Wildcard, Regex,
Grouping, Custom HTTP Errors, Auto Docs
● Middleware ecosystem
● Server: Automatic HTTPS, Gracefully Shutdown,
Multi listeners, Sessions, Websockets, Files
● View Engines
● Renderer, Caching
● Security, Authentication
● Logging, Metrics
Microservice
Microservices design principles
● Single purpose
● Loose coupling
● High cohesion
● Is not a service in small number of lines of code
● Is not a service that is built with new technology
● Is not a service that has to be built from scratch
Microservices design principles
https://medium.engineering/microservice-architecture-at-medium-9c33805eb74f
Go microservice toolkits statistics rating
● The most popular project is go-kit/kit
● The newest project is NYTimes/gizmo
● The project with more commits is koding/kite
● The project with biggest average contribution period is rsms/gotalk
● The project with more tags is micro/go-micro
● The project made by most notable top contributors is koding/kite
● The project with best errors resolving rate is micro/go-micro
● The project with more commits by day is koding/kite
● The project with the most active number of forkers is NYTimes/gizmo
● The project with biggest number of returning contributors is go-kit/kit
https://docs.google.com/spreadsheets/d/1d0WcI5ahmJdysyyHeZB9CVlolXF027UlY1fTPbyiFCE/edit?usp=sharing
Go microservice toolkits features
● Service Discovery
● Load Balancing
● Message Encoding
● Request / Response
● Async Messaging
● Pluggable Interfaces
https://github.com/micro/go-micro#features
Go microservice toolkits plugins
● Broker: PubSub messaging; NATS, NSQ, RabbitMQ, Kafka
● Client/Server: RPC Clients; gRPC, HTTP
● Codec: Message Encoding; BSON, Mercury
● Redistry: Service Discovery; Etcd, Gossip, NATS
● Selector: Load balancing; Label, Cache, Static
● Transport: Bidirectional Streaming; NATS, RabbitMQ
● Wrappers: Middleware; Circuit Breakers, Rate Limiting,
Tracing, Monitoring
https://github.com/micro/go-micro#features
Difference
Handler at monolith
func main() {
srv := http.Server{Addr: ":8080", Handler: homeHandler}
srv.ListenAndServe()
}
func homeHandler(w http.ResponseWriter, r *http.Request) {
l := hlog.FromRequest(r)
products := ListProducts()
// …
}
Handler at monolith
func main() {
srv :=grpc.NewServer(grpc.StatsHandler(&ocgrpc.ServerHandler{}))
svc := &productCatalog{}
pb.RegisterProductCatalogServiceServer(srv, svc)
srv.Serve(l)
}
func (p *productCatalog) GetProduct(ctx context.Context, req
*pb.GetProductRequest) (*pb.Product, error) {
Questions?
Links
● https://medium.com/seek-blog/microservices-in-go-2fc1570f6800
● https://speakerdeck.com/fedir/building-a-go-microservice-from-0-to-hero
● https://speakerdeck.com/fedir/comparison-of-10-go-web-frameworks
● https://intelligentbee.com/2017/08/14/golang-guide-list-top-golang-frameworks
-ides-tools/
Thank you!
Ivan Kutuzov, SoftServe, #GolangUA, @arbrix, ikut@softserveinc.com

More Related Content

What's hot

Micro-frontends – is it a new normal?
Micro-frontends – is it a new normal?Micro-frontends – is it a new normal?
Micro-frontends – is it a new normal?
Lohika_Odessa_TechTalks
 

What's hot (20)

Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
Front end architecture patterns
Front end architecture patternsFront end architecture patterns
Front end architecture patterns
 
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
 
.NET 6 時代のデスクトップ アプリケーション開発
.NET 6 時代のデスクトップ アプリケーション開発.NET 6 時代のデスクトップ アプリケーション開発
.NET 6 時代のデスクトップ アプリケーション開発
 
Micro frontend
Micro frontendMicro frontend
Micro frontend
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Microservices in Node.js: Patterns and techniques
Microservices in Node.js: Patterns and techniquesMicroservices in Node.js: Patterns and techniques
Microservices in Node.js: Patterns and techniques
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
"Micro-frontends, web development", Oleksandr Khivrych
"Micro-frontends, web development", Oleksandr Khivrych"Micro-frontends, web development", Oleksandr Khivrych
"Micro-frontends, web development", Oleksandr Khivrych
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)
 
Modeling microservices using DDD
Modeling microservices using DDDModeling microservices using DDD
Modeling microservices using DDD
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Micro-frontends – is it a new normal?
Micro-frontends – is it a new normal?Micro-frontends – is it a new normal?
Micro-frontends – is it a new normal?
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
Micro Frontends Architecture
Micro Frontends ArchitectureMicro Frontends Architecture
Micro Frontends Architecture
 
Microservices
MicroservicesMicroservices
Microservices
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 

Similar to Monolith vs Microservices with Golang at practice - Ivan Kutuzov

Resume_Arindom_Updated
Resume_Arindom_UpdatedResume_Arindom_Updated
Resume_Arindom_Updated
Arindom Biswas
 
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and MockitoQCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
Szczepan Faber
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
Rodrigo Gil
 

Similar to Monolith vs Microservices with Golang at practice - Ivan Kutuzov (20)

Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand Rao
 
Cloud-Native Progressive Delivery
Cloud-Native Progressive DeliveryCloud-Native Progressive Delivery
Cloud-Native Progressive Delivery
 
202104 technical challenging and our solutions - golang taipei
202104   technical challenging and our solutions - golang taipei202104   technical challenging and our solutions - golang taipei
202104 technical challenging and our solutions - golang taipei
 
AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)
 
Google Cloud Platform Solutions for DevOps Engineers
Google Cloud Platform Solutions  for DevOps EngineersGoogle Cloud Platform Solutions  for DevOps Engineers
Google Cloud Platform Solutions for DevOps Engineers
 
CI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and MockitoCI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and Mockito
 
Design and Monitoring Performance of Digital Properties
Design and Monitoring Performance of Digital PropertiesDesign and Monitoring Performance of Digital Properties
Design and Monitoring Performance of Digital Properties
 
Resume_Arindom_Updated
Resume_Arindom_UpdatedResume_Arindom_Updated
Resume_Arindom_Updated
 
Developing high performance and responsive web apps using web worker
Developing high performance and responsive web apps using web workerDeveloping high performance and responsive web apps using web worker
Developing high performance and responsive web apps using web worker
 
Front end microservices: architectures and solution
Front end microservices: architectures and solutionFront end microservices: architectures and solution
Front end microservices: architectures and solution
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Analyzing Optimal Practises for Web Frameworks
Analyzing Optimal Practises for Web FrameworksAnalyzing Optimal Practises for Web Frameworks
Analyzing Optimal Practises for Web Frameworks
 
Abhinav Nigam
Abhinav NigamAbhinav Nigam
Abhinav Nigam
 
Introduction to DevOps and the Practical Use Cases at Credit OK
Introduction to DevOps and the Practical Use Cases at Credit OKIntroduction to DevOps and the Practical Use Cases at Credit OK
Introduction to DevOps and the Practical Use Cases at Credit OK
 
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and MockitoQCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
QCon'17 talk: CI/CD at scale - lessons from LinkedIn and Mockito
 
Node js vs golang -which one is better ?
Node js vs golang -which one is better ?Node js vs golang -which one is better ?
Node js vs golang -which one is better ?
 
Multiplier Effect: Case Studies in Distributions for Publishers
Multiplier Effect: Case Studies in Distributions for PublishersMultiplier Effect: Case Studies in Distributions for Publishers
Multiplier Effect: Case Studies in Distributions for Publishers
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
 
Microservice
MicroserviceMicroservice
Microservice
 
Why we should consider Open Hybrid Cloud.pdf
Why we should  consider Open Hybrid Cloud.pdfWhy we should  consider Open Hybrid Cloud.pdf
Why we should consider Open Hybrid Cloud.pdf
 

More from Kuberton

More from Kuberton (7)

Using Sentry for error collection and analysis in a distributed system - Yevg...
Using Sentry for error collection and analysis in a distributed system - Yevg...Using Sentry for error collection and analysis in a distributed system - Yevg...
Using Sentry for error collection and analysis in a distributed system - Yevg...
 
Monitoring&Logging - Stanislav Kolenkin
Monitoring&Logging - Stanislav Kolenkin  Monitoring&Logging - Stanislav Kolenkin
Monitoring&Logging - Stanislav Kolenkin
 
How to grant permission to your Kubernetes cluster for another users. - Stan...
 How to grant permission to your Kubernetes cluster for another users. - Stan... How to grant permission to your Kubernetes cluster for another users. - Stan...
How to grant permission to your Kubernetes cluster for another users. - Stan...
 
Security threats with Kubernetes - Igor Khoroshchenko
 Security threats with Kubernetes - Igor Khoroshchenko Security threats with Kubernetes - Igor Khoroshchenko
Security threats with Kubernetes - Igor Khoroshchenko
 
Chaos Testing of Microservices - Shalamov Maksym
 Chaos Testing of Microservices  - Shalamov Maksym Chaos Testing of Microservices  - Shalamov Maksym
Chaos Testing of Microservices - Shalamov Maksym
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 
Kubernetes in Modern Application Architecture - Orkhan Gasimov
Kubernetes in Modern Application Architecture - Orkhan GasimovKubernetes in Modern Application Architecture - Orkhan Gasimov
Kubernetes in Modern Application Architecture - Orkhan Gasimov
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Monolith vs Microservices with Golang at practice - Ivan Kutuzov

  • 1. Monolith vs Microservices with Golang at Practice Ivan Kutuzov, SoftServe, #GolangUA
  • 2. Agenda: - Quick introduction to GO - How to create monolith app - How to create microservice - What a difference
  • 3. Go pros ● Fast compilation ● Simplicity ● Memory safe ● Efficiency ● Concurrency ● Network oriented
  • 4. Guiding principles ● Simplicity ● Readability ● Productivity
  • 6. Maintainability ● Changes in one area of an application should affect as few other places as possible ● Adding features should not require large code-base changes ● Adding new ways to interact with the application should require as few changes as possible ● Debugging should require as few work-arounds and "just this once" hacks as possible ● Testing should be relatively easy https://dave.cheney.net/practical-go/presentations/qcon-china.html
  • 7. Hexagonal Architecture/ Clean Architecture / Port and Adapters ● Entity ● Value Object ● Domain Event ● Aggregate ● Service ● Repository
  • 8. Where read more ● Kat Zien: How Do You Structure Your Go Apps ● Peter Bourgon: Go for Industrial Programming ● Ben Johnson: Standard Package Layout ● Marcus Olsson: gh: marcusolsson/goddd
  • 9. Existing frameworks & tools https://github.com/speedwheel/awesome-go-web-frameworks/blob/master/README.md
  • 10. Existing frameworks & tools ● Router: Named Path Parameters & Wildcard, Regex, Grouping, Custom HTTP Errors, Auto Docs ● Middleware ecosystem ● Server: Automatic HTTPS, Gracefully Shutdown, Multi listeners, Sessions, Websockets, Files ● View Engines ● Renderer, Caching ● Security, Authentication ● Logging, Metrics
  • 12. Microservices design principles ● Single purpose ● Loose coupling ● High cohesion ● Is not a service in small number of lines of code ● Is not a service that is built with new technology ● Is not a service that has to be built from scratch
  • 14. Go microservice toolkits statistics rating ● The most popular project is go-kit/kit ● The newest project is NYTimes/gizmo ● The project with more commits is koding/kite ● The project with biggest average contribution period is rsms/gotalk ● The project with more tags is micro/go-micro ● The project made by most notable top contributors is koding/kite ● The project with best errors resolving rate is micro/go-micro ● The project with more commits by day is koding/kite ● The project with the most active number of forkers is NYTimes/gizmo ● The project with biggest number of returning contributors is go-kit/kit https://docs.google.com/spreadsheets/d/1d0WcI5ahmJdysyyHeZB9CVlolXF027UlY1fTPbyiFCE/edit?usp=sharing
  • 15. Go microservice toolkits features ● Service Discovery ● Load Balancing ● Message Encoding ● Request / Response ● Async Messaging ● Pluggable Interfaces https://github.com/micro/go-micro#features
  • 16. Go microservice toolkits plugins ● Broker: PubSub messaging; NATS, NSQ, RabbitMQ, Kafka ● Client/Server: RPC Clients; gRPC, HTTP ● Codec: Message Encoding; BSON, Mercury ● Redistry: Service Discovery; Etcd, Gossip, NATS ● Selector: Load balancing; Label, Cache, Static ● Transport: Bidirectional Streaming; NATS, RabbitMQ ● Wrappers: Middleware; Circuit Breakers, Rate Limiting, Tracing, Monitoring https://github.com/micro/go-micro#features
  • 18. Handler at monolith func main() { srv := http.Server{Addr: ":8080", Handler: homeHandler} srv.ListenAndServe() } func homeHandler(w http.ResponseWriter, r *http.Request) { l := hlog.FromRequest(r) products := ListProducts() // … }
  • 19. Handler at monolith func main() { srv :=grpc.NewServer(grpc.StatsHandler(&ocgrpc.ServerHandler{})) svc := &productCatalog{} pb.RegisterProductCatalogServiceServer(srv, svc) srv.Serve(l) } func (p *productCatalog) GetProduct(ctx context.Context, req *pb.GetProductRequest) (*pb.Product, error) {
  • 21. Links ● https://medium.com/seek-blog/microservices-in-go-2fc1570f6800 ● https://speakerdeck.com/fedir/building-a-go-microservice-from-0-to-hero ● https://speakerdeck.com/fedir/comparison-of-10-go-web-frameworks ● https://intelligentbee.com/2017/08/14/golang-guide-list-top-golang-frameworks -ides-tools/
  • 22. Thank you! Ivan Kutuzov, SoftServe, #GolangUA, @arbrix, ikut@softserveinc.com