SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
Hurry Up and Go
(But Not Too Fast)
Stuart Fettinger
sfettinger@nvisia.com
About Me
Project Architect at NVISIA
10+ years of experience designing, developing, and delivering solutions
Recent co-founder of a tech startup
Passionate about limiting tech debt through clean and efficient design
Topic Breakdown
Brief Introduction to GO
Guiding Principles and Core Concepts
Go’s strong (and not so strong) suits
Highlighting when GO is a preferred choice, and when it’s not,
through real-world examples
Designing a GO Microservice
Tips for your design to take advantage of Go to its fullest and avoid
common pitfalls
What is GoLang?
• Developed by Google in 2007
• Designed to overcome criticism
of other languages
•Statically typed and compiled
• Syntactically similar to C
Go’s Guiding
Principles
Simplicity
Type inference
Declare-and-initialize operations
No generics
Composition rather than inheritance
Readability
As little “magic” as possible
Explicit and lean error mechanisms
Orthogonality
Do one thing well, keep things simple, standardize communication
Elimination of cross-linking complexity
Performance
Built in garbage collection
Synchronization, channels and Go routines
Pointers
A Basic Example
Main package – compiled binary
Short, concise imports
Function keywords
Multiple return values
Meaningful spaces – no semicolons
Core Concepts
Packages provide logical groupings and reusable functionality
Every Go program starts in the main package’s main() function
Main package is compiled to binary
Functions beginning with a capital letter are exported outside their package
Functions beginning with a lowercase letter are essentially private
Packages
Functions are stand-alone pieces of functionality
Methods are functions with receivers - tied to a type
Methods should be used when state is important and with interfaces
Rule of thumb – prefer methods over functions
Methods vs. Functions
Variables that store the memory address of other variables
Zero type of nil – popularly used where nil is valid and relied upon
Memory address available via &
Pointer dereferenced via *
Pointers
Structs
Named collections of fields
When initialized, all fields are set to their zero values
Fields of a struct are accessed via “.” operator
Composition over inheritance – one struct cannot be the child of another
Structs can contain other structs
Named collections of method signatures
No “Implements” keyword – can be implemented directly by implementing all methods
Interfaces can be empty – automatically satisfied by any type
Go’s answer to polymorphism
Interfaces
Errors
Errors are treated as values
Stack traces don’t come for free with errors
Idiomatic to check for errors frequently via “if” operations
No try/catch framework – error handling up to developers
Go Routines
Lightweight threads managed by the Go runtime
Spawned by simply using “go” keyword
Initially small stack size with ability to scale
Leverage channels to pass messages, block, and sync between Go routines
Performant – can run thousands of Go routines at a time with little drag
What Go Doesn’t Have
• Inheritance
• Classes
• Exceptions
• Generics
Deciding When to
Use Go
Go Is Not One-Size Fits All
• Go works well in some cases, not so great in others
• Some scenarios to consider Go
• Small, predictable routines
• Where performance margins are razor thin (ie: trading)
• Quick start-up with limited resources
• Scaling is a prime factor or an unknown
• Concurrency and communication is a prime use-case
• Scenarios where Go may fall short
• Where complexity requires extensive third-party libraries
• Where OO reduces complexity
• Front-end MVC
• Team makeup is less experienced
• Remember – design decisions should be case-by-case – try not to promote blanket use of technology
Considerations
• What are the requirements for the problem I am trying to solve?
• Can I solve the problem another way, and will doing so lose me any benefits?
• Consider technical pros and cons, but also intangible factors
• Developer happiness
• Community support
• Framework maturity
• Current trends
• Consider supporting a solution after it is live
• Scaling needs
• Technical debt and BAU maintenance
Use Case #1
Requirements
• Microservice with capabilities to
• Store high resolution images on the cloud
• Resize images without damaging resolution
• Be available on-demand to fetch data
• Data throughput may be larger than other streams (ie: text)
As a user, I want to be able to upload a high-resolution image, and retrieve it later in
whatever dimensions I want, so that I can use the image for different situations
Use Case #1
Performance exceeds
that of an interpreted
language
Package manager and
libraries are more
diverse
Higher scalability to
meet unknown data
demands
Ease of using docker to
spin up containers
Serverless architecture
support
Further developed
community
Smaller learning curve
for front-end
developers
Channels and
GoRoutines to spread
out workloads
Use Case #2
Requirements
• Several microservices connecting with different resources and providing different outputs
• Similarities in data may be a high percentage of make-up
• Data has potential to be large – multi-threading may be important
As a user, I want to be able to call APIs for different but similar data, and aggregate them
together, so that I can streamline my usage of that data
Use Case #2
Lightweight syntax –
avoid getting lost in
complex data
manipulation
Inheritance and
genericsHigh Performance
Mature libraries for
persistence and data
combination
Go Channels and Go
Routines – automate
polling data
Extensive API strategy
support
Use Case #3
Requirements
• Many file types may exist in many different formats
• Files may be made available at different times
• Must store data, potentially in a variety of formats
As a user, I want to be able to ingest and persist files from many different sources, so that I
can scrape the data later via my own processes
Use Case #3
Significant performance
benefits
Mature ORM libraries
Low learning curve
Wide database support
Higher developer
popularity
Multithreading
capabilities
Use Case #4
Requirements
• Application available on the web, potentially mobile as well
• Rich Interface and modern design
• Communicates with various microservices
• Possibilities are endless – login, registration, alerts, etc…
As a developer, I want to create a front-end web application for my users to interact with,
so that I can expand my customer base
Use Case #4
Lower learning curve Mature MVVM patterns
and support
Templating and
rendering engines
High number of built-in
must-haves for front-
end development
Third-party routing
support
Seamless integration
with a back-end Go
stack (Revel)
Designing a GO
Microservice - Tips
Don’t Reinvent
the Wheel#1
Plenty of third-party
frameworks exist to
ease microservice
development
GoMicro
• Foundation for RPC and event-driven communication with reasonable defaults built in
• Out-of-the-box:
• Service discovery
• Auto registration and name resolution
• Load Balancing
• Even distribution and node-retry
• Message Encoding
• Proto-RPC and Json-RPC by default
• Asynchronous
• Event-driven architecture
• “Pluggable” interfaces
• Platform agnostic implementations
GoKit
• Toolkit for Go – designed to be imported into a binary package
• Fills the gaps left by the base package(s)
• Security
• Monitoring
• Service Discovery
• Can be thought of as similar to
• Spring Boot
• Eureka
• Ribbon
• Integrates well with Docker, Kubernetes, and Heroku
• Different from GoMicro in that it’s more of a toolkit, less of a platform
Leverage
Interfaces#2
Interfaces provide
portable, independent
implementation
opportunities
• Expose interfaces as contracts between services
• Centralize common features such as logging and queueing
• Allow platform-agnostic implementations
• ie: data layer interfaces and repositories
ORM is Your
Friend#3
Make your entities
more meaningful by
tying them to an ORM
implementation
Go’s lean syntax drives you to use straight SQL prepared statements
• Gets messy fast with many parameters and outputs
• Nil considerations are difficult – Go values not easily nillable
• Compiler will not catch issues with prepared statements, field names, etc...
GoRM
• Provides associations between entities – Has One, Has Many, Many to
Many, Belongs To, etc…
• Uses any field with ID as the primary key – no need to annotate
• Auto support for creation, update, and soft-delete timestamps
• Auto-update capabilities – No need to explicitly call update vs insert
• Provides hooks to execute functionality pre or post running SQL
• API for transaction management and rollback
• Eager loading vs lazy loading (default) capabilities
• Can run raw SQL if needed
Centralize
configurations#4
Go’s binary nature may drive you to place configs in files within the application, or
on the server in a central location
• It works – but you’re missing out
Create a central location where configurations live – ideally another microservice
serving up files
• Place security on top of configs
• Integrate with CI/CD pipelines
• Inject configs via use of Docker secrets, etc…
• Leverage caching for failure scenarios
Read configurations into your services by leveraging Go-based configuration
solutions
Viper
• API to find and load config files of varying formats
• Also supports writing configuration files
• Provides defaults and gracefully handles overrides
• Live-watching of configs, and hot-reloading
• Alias-based naming, allowing non-breaking renames
• Uses environment variables to manage different configurations
• Remote key/value store support
Centralized
configuration keeps
things DRY
Make Errors
Meaningful#5
• Errors are values so it’s easy to treat them as strings and just pass them up the
chain
• There is no stacktrace included with an error by default
• There is no concept of an exception in Go – up to the developer to handle
• Implement the error interface to construct meaningful errors of different types
• Add stack trace information by using go-errors package
• Add important logging info using go log flags
Supplement your error
framework with
additional logging and
packages
When Designing Your Microservices…
• Understand the cases where your chosen technology works best
• Do POCs, reach out to the community, benchmark test – make informed decisions based on use cases
• Don’t be afraid to mix and match to get your desired result
• i.e – Go, third-party Go packages, Spring, Docker, etc…
• Always look for opportunities to improve, but not to the point of development paralysis
• Go is meant to be simple – don’t head down the rabbit hole of over-inventiveness
• Don’t invite unnecessary technical debt
• Consider your long-term goals and scaling needs when deciding how to implement functionality
• Design for technical soundness but also developer satisfaction
• Go is so popular, in part, because it’s fun
Questions

Más contenido relacionado

La actualidad más candente

The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventuremylittleadventure
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)Aaron Schlesinger
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go langAmal Mohan N
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practiceGuilherme Garnier
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by GoogleUttam Gandhi
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrencyjgrahamc
 
Concurrency in Golang
Concurrency in GolangConcurrency in Golang
Concurrency in GolangOliver N
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewMarkus Schneider
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)Ishin Vin
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)ShubhamMishra485
 
Golang getting started
Golang getting startedGolang getting started
Golang getting startedHarshad Patil
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programmingMahmoud Masih Tehrani
 

La actualidad más candente (20)

The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Golang
GolangGolang
Golang
 
Golang
GolangGolang
Golang
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practice
 
Go lang
Go langGo lang
Go lang
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
 
Concurrency in Golang
Concurrency in GolangConcurrency in Golang
Concurrency in Golang
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 

Similar a Hurry Up and Go Microservice Design

Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...HostedbyConfluent
 
20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development PlatformHarezmi IT Solutions
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20Phil Wilkins
 
Comparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutionsComparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutionsMike Ensor
 
Manatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup MentalityManatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup MentalityTodd Kaplinger
 
Making software development processes to work for you
Making software development processes to work for youMaking software development processes to work for you
Making software development processes to work for youAmbientia
 
Community day 2013 applied architectures
Community day 2013   applied architecturesCommunity day 2013   applied architectures
Community day 2013 applied architecturesPanagiotis Kefalidis
 
How to Migrate from .NET to Drupal
How to Migrate from .NET to DrupalHow to Migrate from .NET to Drupal
How to Migrate from .NET to DrupalAcquia
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...confluent
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software DevelopmentAhmet Bulut
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...confluent
 
Web development tips and tricks
Web development tips and tricksWeb development tips and tricks
Web development tips and tricksmaxo_64
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreDan Poltawski
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANJeff Fox
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'EnterprisePyCon Italia
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Shelly Megan
 

Similar a Hurry Up and Go Microservice Design (20)

Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...
 
20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
 
Comparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutionsComparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutions
 
Manatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup MentalityManatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup Mentality
 
Making software development processes to work for you
Making software development processes to work for youMaking software development processes to work for you
Making software development processes to work for you
 
Community day 2013 applied architectures
Community day 2013   applied architecturesCommunity day 2013   applied architectures
Community day 2013 applied architectures
 
How to Migrate from .NET to Drupal
How to Migrate from .NET to DrupalHow to Migrate from .NET to Drupal
How to Migrate from .NET to Drupal
 
resume4
resume4resume4
resume4
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
 
Web frameworks
Web frameworksWeb frameworks
Web frameworks
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Software Design
Software DesignSoftware Design
Software Design
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
 
Web development tips and tricks
Web development tips and tricksWeb development tips and tricks
Web development tips and tricks
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'Enterprise
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!
 

Más de NVISIA

The Evolution of Architecture
The Evolution of ArchitectureThe Evolution of Architecture
The Evolution of ArchitectureNVISIA
 
Expected Result - A UX Story
Expected Result - A UX StoryExpected Result - A UX Story
Expected Result - A UX StoryNVISIA
 
Antifragile Teams
Antifragile TeamsAntifragile Teams
Antifragile TeamsNVISIA
 
Digital Operations Service Design
Digital Operations Service DesignDigital Operations Service Design
Digital Operations Service DesignNVISIA
 
Executive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of ContainersExecutive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of ContainersNVISIA
 
Strengthening Business/IT Relationships
Strengthening Business/IT RelationshipsStrengthening Business/IT Relationships
Strengthening Business/IT RelationshipsNVISIA
 
Achieving Business Alignment
Achieving Business AlignmentAchieving Business Alignment
Achieving Business AlignmentNVISIA
 
Intro to AWS Machine Learning
Intro to AWS Machine LearningIntro to AWS Machine Learning
Intro to AWS Machine LearningNVISIA
 
2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in ActionNVISIA
 
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swampDAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swampNVISIA
 
Scaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the EnterpriseScaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the EnterpriseNVISIA
 
INNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL ITINNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL ITNVISIA
 
Building a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster WisconsinBuilding a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster WisconsinNVISIA
 
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be AgileNVISIA
 
Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation NVISIA
 
NVISIA Mobile Trends Presentation
NVISIA Mobile Trends PresentationNVISIA Mobile Trends Presentation
NVISIA Mobile Trends PresentationNVISIA
 

Más de NVISIA (16)

The Evolution of Architecture
The Evolution of ArchitectureThe Evolution of Architecture
The Evolution of Architecture
 
Expected Result - A UX Story
Expected Result - A UX StoryExpected Result - A UX Story
Expected Result - A UX Story
 
Antifragile Teams
Antifragile TeamsAntifragile Teams
Antifragile Teams
 
Digital Operations Service Design
Digital Operations Service DesignDigital Operations Service Design
Digital Operations Service Design
 
Executive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of ContainersExecutive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of Containers
 
Strengthening Business/IT Relationships
Strengthening Business/IT RelationshipsStrengthening Business/IT Relationships
Strengthening Business/IT Relationships
 
Achieving Business Alignment
Achieving Business AlignmentAchieving Business Alignment
Achieving Business Alignment
 
Intro to AWS Machine Learning
Intro to AWS Machine LearningIntro to AWS Machine Learning
Intro to AWS Machine Learning
 
2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action
 
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swampDAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
 
Scaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the EnterpriseScaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the Enterprise
 
INNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL ITINNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL IT
 
Building a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster WisconsinBuilding a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster Wisconsin
 
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
 
Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation
 
NVISIA Mobile Trends Presentation
NVISIA Mobile Trends PresentationNVISIA Mobile Trends Presentation
NVISIA Mobile Trends Presentation
 

Último

Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 

Último (20)

Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 

Hurry Up and Go Microservice Design

  • 1. Hurry Up and Go (But Not Too Fast) Stuart Fettinger sfettinger@nvisia.com
  • 2. About Me Project Architect at NVISIA 10+ years of experience designing, developing, and delivering solutions Recent co-founder of a tech startup Passionate about limiting tech debt through clean and efficient design
  • 3. Topic Breakdown Brief Introduction to GO Guiding Principles and Core Concepts Go’s strong (and not so strong) suits Highlighting when GO is a preferred choice, and when it’s not, through real-world examples Designing a GO Microservice Tips for your design to take advantage of Go to its fullest and avoid common pitfalls
  • 5. • Developed by Google in 2007 • Designed to overcome criticism of other languages •Statically typed and compiled • Syntactically similar to C
  • 6. Go’s Guiding Principles Simplicity Type inference Declare-and-initialize operations No generics Composition rather than inheritance Readability As little “magic” as possible Explicit and lean error mechanisms Orthogonality Do one thing well, keep things simple, standardize communication Elimination of cross-linking complexity Performance Built in garbage collection Synchronization, channels and Go routines Pointers
  • 7. A Basic Example Main package – compiled binary Short, concise imports Function keywords Multiple return values Meaningful spaces – no semicolons
  • 9. Packages provide logical groupings and reusable functionality Every Go program starts in the main package’s main() function Main package is compiled to binary Functions beginning with a capital letter are exported outside their package Functions beginning with a lowercase letter are essentially private Packages
  • 10.
  • 11. Functions are stand-alone pieces of functionality Methods are functions with receivers - tied to a type Methods should be used when state is important and with interfaces Rule of thumb – prefer methods over functions Methods vs. Functions
  • 12.
  • 13. Variables that store the memory address of other variables Zero type of nil – popularly used where nil is valid and relied upon Memory address available via & Pointer dereferenced via * Pointers
  • 14.
  • 15.
  • 16. Structs Named collections of fields When initialized, all fields are set to their zero values Fields of a struct are accessed via “.” operator Composition over inheritance – one struct cannot be the child of another Structs can contain other structs
  • 17.
  • 18. Named collections of method signatures No “Implements” keyword – can be implemented directly by implementing all methods Interfaces can be empty – automatically satisfied by any type Go’s answer to polymorphism Interfaces
  • 19.
  • 20. Errors Errors are treated as values Stack traces don’t come for free with errors Idiomatic to check for errors frequently via “if” operations No try/catch framework – error handling up to developers
  • 21.
  • 22. Go Routines Lightweight threads managed by the Go runtime Spawned by simply using “go” keyword Initially small stack size with ability to scale Leverage channels to pass messages, block, and sync between Go routines Performant – can run thousands of Go routines at a time with little drag
  • 23.
  • 24. What Go Doesn’t Have • Inheritance • Classes • Exceptions • Generics
  • 26. Go Is Not One-Size Fits All • Go works well in some cases, not so great in others • Some scenarios to consider Go • Small, predictable routines • Where performance margins are razor thin (ie: trading) • Quick start-up with limited resources • Scaling is a prime factor or an unknown • Concurrency and communication is a prime use-case • Scenarios where Go may fall short • Where complexity requires extensive third-party libraries • Where OO reduces complexity • Front-end MVC • Team makeup is less experienced • Remember – design decisions should be case-by-case – try not to promote blanket use of technology
  • 27. Considerations • What are the requirements for the problem I am trying to solve? • Can I solve the problem another way, and will doing so lose me any benefits? • Consider technical pros and cons, but also intangible factors • Developer happiness • Community support • Framework maturity • Current trends • Consider supporting a solution after it is live • Scaling needs • Technical debt and BAU maintenance
  • 28. Use Case #1 Requirements • Microservice with capabilities to • Store high resolution images on the cloud • Resize images without damaging resolution • Be available on-demand to fetch data • Data throughput may be larger than other streams (ie: text) As a user, I want to be able to upload a high-resolution image, and retrieve it later in whatever dimensions I want, so that I can use the image for different situations
  • 29. Use Case #1 Performance exceeds that of an interpreted language Package manager and libraries are more diverse Higher scalability to meet unknown data demands Ease of using docker to spin up containers Serverless architecture support Further developed community Smaller learning curve for front-end developers Channels and GoRoutines to spread out workloads
  • 30. Use Case #2 Requirements • Several microservices connecting with different resources and providing different outputs • Similarities in data may be a high percentage of make-up • Data has potential to be large – multi-threading may be important As a user, I want to be able to call APIs for different but similar data, and aggregate them together, so that I can streamline my usage of that data
  • 31. Use Case #2 Lightweight syntax – avoid getting lost in complex data manipulation Inheritance and genericsHigh Performance Mature libraries for persistence and data combination Go Channels and Go Routines – automate polling data Extensive API strategy support
  • 32. Use Case #3 Requirements • Many file types may exist in many different formats • Files may be made available at different times • Must store data, potentially in a variety of formats As a user, I want to be able to ingest and persist files from many different sources, so that I can scrape the data later via my own processes
  • 33. Use Case #3 Significant performance benefits Mature ORM libraries Low learning curve Wide database support Higher developer popularity Multithreading capabilities
  • 34. Use Case #4 Requirements • Application available on the web, potentially mobile as well • Rich Interface and modern design • Communicates with various microservices • Possibilities are endless – login, registration, alerts, etc… As a developer, I want to create a front-end web application for my users to interact with, so that I can expand my customer base
  • 35. Use Case #4 Lower learning curve Mature MVVM patterns and support Templating and rendering engines High number of built-in must-haves for front- end development Third-party routing support Seamless integration with a back-end Go stack (Revel)
  • 38. Plenty of third-party frameworks exist to ease microservice development GoMicro • Foundation for RPC and event-driven communication with reasonable defaults built in • Out-of-the-box: • Service discovery • Auto registration and name resolution • Load Balancing • Even distribution and node-retry • Message Encoding • Proto-RPC and Json-RPC by default • Asynchronous • Event-driven architecture • “Pluggable” interfaces • Platform agnostic implementations GoKit • Toolkit for Go – designed to be imported into a binary package • Fills the gaps left by the base package(s) • Security • Monitoring • Service Discovery • Can be thought of as similar to • Spring Boot • Eureka • Ribbon • Integrates well with Docker, Kubernetes, and Heroku • Different from GoMicro in that it’s more of a toolkit, less of a platform
  • 40. Interfaces provide portable, independent implementation opportunities • Expose interfaces as contracts between services • Centralize common features such as logging and queueing • Allow platform-agnostic implementations • ie: data layer interfaces and repositories
  • 42. Make your entities more meaningful by tying them to an ORM implementation Go’s lean syntax drives you to use straight SQL prepared statements • Gets messy fast with many parameters and outputs • Nil considerations are difficult – Go values not easily nillable • Compiler will not catch issues with prepared statements, field names, etc... GoRM • Provides associations between entities – Has One, Has Many, Many to Many, Belongs To, etc… • Uses any field with ID as the primary key – no need to annotate • Auto support for creation, update, and soft-delete timestamps • Auto-update capabilities – No need to explicitly call update vs insert • Provides hooks to execute functionality pre or post running SQL • API for transaction management and rollback • Eager loading vs lazy loading (default) capabilities • Can run raw SQL if needed
  • 44. Go’s binary nature may drive you to place configs in files within the application, or on the server in a central location • It works – but you’re missing out Create a central location where configurations live – ideally another microservice serving up files • Place security on top of configs • Integrate with CI/CD pipelines • Inject configs via use of Docker secrets, etc… • Leverage caching for failure scenarios Read configurations into your services by leveraging Go-based configuration solutions Viper • API to find and load config files of varying formats • Also supports writing configuration files • Provides defaults and gracefully handles overrides • Live-watching of configs, and hot-reloading • Alias-based naming, allowing non-breaking renames • Uses environment variables to manage different configurations • Remote key/value store support Centralized configuration keeps things DRY
  • 46. • Errors are values so it’s easy to treat them as strings and just pass them up the chain • There is no stacktrace included with an error by default • There is no concept of an exception in Go – up to the developer to handle • Implement the error interface to construct meaningful errors of different types • Add stack trace information by using go-errors package • Add important logging info using go log flags Supplement your error framework with additional logging and packages
  • 47. When Designing Your Microservices… • Understand the cases where your chosen technology works best • Do POCs, reach out to the community, benchmark test – make informed decisions based on use cases • Don’t be afraid to mix and match to get your desired result • i.e – Go, third-party Go packages, Spring, Docker, etc… • Always look for opportunities to improve, but not to the point of development paralysis • Go is meant to be simple – don’t head down the rabbit hole of over-inventiveness • Don’t invite unnecessary technical debt • Consider your long-term goals and scaling needs when deciding how to implement functionality • Design for technical soundness but also developer satisfaction • Go is so popular, in part, because it’s fun