Hands-On Software Architecture with Golang: Design and architect highly scalable and robust applications using Go

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Understand the principles of software architecture with coverage on SOA, distributed and messaging systems, and database modeling Key Features Gain knowledge of architectural approaches on SOA and microservices for architectural decisions Explore different architectural patterns for building distributed applications Migrate applications written in Java or Python to the Go language Book Description Building software requires careful planning and architectural considerations; Golang was developed with a fresh perspective on building next-generation applications on the cloud with distributed and concurrent computing concerns. Hands-On Software Architecture with Golang starts with a brief introduction to architectural elements, Go, and a case study to demonstrate architectural principles. You'll then move on to look at code-level aspects such as modularity, class design, and constructs specific to Golang and implementation of design patterns. As you make your way through the chapters, you'll explore the core objectives of architecture such as effectively managing complexity, scalability, and reliability of software systems. You'll also work through creating distributed systems and their communication before moving on to modeling and scaling of data. In the concluding chapters, you'll learn to deploy architectures and plan the migration of applications from other languages. By the end of this book, you will have gained insight into various design and architectural patterns, which will enable you to create robust, scalable architecture using Golang. What you will learn Understand architectural paradigms and deep dive into Microservices Design parallelism/concurrency patterns and learn object-oriented design patterns in Go Explore API-driven systems architecture with introduction to REST and GraphQL standards Build event-driven architectures and make your architectures anti-fragile Engineer scalability and learn how to migrate to Go from other languages Get to grips with deployment considerations with CICD pipeline, cloud deployments, and so on Build an end-to-end e-commerce (travel) application backend in Go Who this book is for Hands-On Software Architecture with Golang is for software developers, architects, and CTOs looking to use Go in their software architecture to build enterprise-grade applications. Programming knowledge of Golang is assumed.

Author(s): Jyotiswarup Raiturkar
Publisher: Packt Publishing
Year: 2018

Language: English
Pages: 500
Tags: golang

Cover
Title Page
Copyright and Credits
About Packt
Contributors
Table of Contents
Preface
Chapter 1: Building Big with Go
Problem solving for the big picture
The role of the architect
Requirements clarification
True North
Technology selection
Leadership in the kitchen
Coaching and mentoring
Target state versus current state
Software architecture
Architecture versus design
What does architecture look like?
Microservices
The challenges for microservices – efficiency
The challenges for microservices – programming complexity
Go
Hello World!
Data types and structures
Functions and methods
Flow control
Packaging
Concurrency
Garbage collection
Object-orientation
Summary
Chapter 2: Packaging Code
Contracts
Object orientation
Object orientation in Go – the struct
Object orientation in Go – visibility
Object oriented in Go – the interface
Object oriented in Go – embedding
Modules
Code layout
Third-party dependencies
Framework
Testing
Structuring tests
Summary
Chapter 3: Design Patterns
Design principles
Single Responsibility Principle (S)
Open/Closed Principle (O)
Liskov Substitution Principle (L)
Interface Segregation Principle (I)
Dependency Inversion Principle (D)
Creational design patterns
Factory method
Builder
Abstract factory
Singleton
 Structural design patterns
Adaptor
Bridge
Composite
Decorator
Facade
Proxy
Behavioral design patterns
Command
Chain of Responsibility
Mediator
Memento
Observer
Visitor
Strategy
State
Summary
Chapter 4: Scaling Applications
Scaling algorithms
Algorithm complexity
Distributed algorithms
Scaling data structures
Profiling data structures
Probabilistic data structures
Scaling data
Scalability bottlenecks
The C10K problem
The Thundering Herd problem
Sources
Programming
Operating systems
Memory usage
Losing state
Scaling systems
X-axis scaling
Y-axis scaling
Z-axis scaling
Scaling deployments
Summary
Chapter 5: Going Distributed
Topology
Distributed system quirks
The network is reliable
The latency is zero
The bandwidth is infinite
The network is secure
The topology doesn't change
There is one administrator
The transport cost is zero
The network is homogeneous
Consistency
ACID
Client-centric consistency models
Strong consistency
Weak consistency
Eventual consistency
Sequential consistency
Causal consistency
Session consistency
Monotonic read consistency
Monotonic write consistency
Storage system-centric consistency model
CAP theorem
Consensus
The two generals problem
Consensus based on time – causality
Multi-phase commit
Two-phase commit
Three-phase commit
Paxos
Raft
Leader-election
Distributed architectures
Object-based systems
Layered architectures
Peer-2-peer (P2P) architecture
Distributed computations
Event-driven architecture (EDA)
The Actor model
Stream processing
Summary
Chapter 6: Messaging
Performance characterization
Broker-based messaging
The queuing model
The Pub/Sub model
Delivery semantics
Acknowledgement
At-least-once delivery
At-most-once delivery
Exactly-once delivery
Resilience
AMQP
Apache Kafka deep dive
Concepts
Publishing messages
The AsyncProducer interface
The Sync producer
Consuming messages
Stream processing
Brokerless messaging
NSQ deep-dive
Concepts
Publishing messages
Consuming messages
Integration patterns
The request-reply pattern
The correlation identifier pattern
The pipes and filters pattern
The content-based router pattern
The fan-in pattern
The fan-out pattern
The background worker pattern
Summary
Chapter 7: Building APIs
Endpoints
Networking basics
Service discovery
Server-side service discovery
Client-side service discovery
Data serialization
XML
JSON
Protobuf
Performance
Representational State Transfer (REST)
Concepts
Constraints
Client-server model
Stateless
Cacheability
Uniform interface
Richardson Maturity Model
Level 0 – swamp of POX
Level 1 – resources
Level 2 – HTTP verbs
Level 3 – hypermedia controls
Building a REST service using Gin
Gin introduction
Sample application
Router
Create
Read
Update
Delete
GraphQL
Schema
Endpoints
Queries
Mutations
Subscriptions
Higher-level patterns
Model-View-Controller (MVC)
Load balancing health checks
API gateway
Go kit 
Summary
Chapter 8: Modeling Data
Entities and relationships
Consistency guarantees
ACID (Atomicity, Consistency, Isolation, Durability)
Atomicity
Consistency
Isolation
Durability
BASE (Basically Available, Soft state, Eventual consistency)
Relational model
The first normal form
The second normal form
The third normal form
The Boyce-Codd normal form
The fourth normal form
SQL
Indices
Views
Inner join
Left outer join
Right outer join
Full outer join
MySQL deep-dive
Connection management
Query execution
Storage engines
InnoDB
MyISAM
Other plugins
High availability/scalability
Object Relational Mappers (ORMs)
Key/value stores
Concepts
Redis deep-dive
Architecture
Data structures
Persistence
Clustering
Use cases
Golang usage
Wide column stores
Column family stores
Cassandra deep-dive
Data distribution
Write paths
Read paths
Golang usage
Patterns for scaling data performance
Sharding
Denormalization
Materialized views
Summary
Chapter 9: Anti-Fragile Systems
Reliability metrics
Dynamic metrics
Static metrics
Engineering reliability
Rugged services
High availability
Messaging
The asynchronous computation pattern
The orchestrator pattern
The compensating-transaction pattern
The pipes and filter pattern
Hotspots
The sidecar pattern
Throttling
Versioning 
Reliability verification
Unit tests
Integration tests
UI tests
Performance tests
Chaos-engineering
Dependencies
Failure multiplication
Cascading failures
Dependency resilience
An introduction to Hystrix
Hystrix – fallback
Hystrix – circuit breaker
Hystrix in Golang
Hystrix monitoring
Database-level reliability
Datacenter-level reliability
Consistency
Routing and cutover
Summary
Chapter 10: Case Study – Travel Website
The product
Actors
Requirements
Data modeling
High-level architecture
Search
Flights
Hotels
Booking
Payment
Reservation
Summary
Chapter 11: Planning for Deployment
Deployment architecture
Components
Computes
Physical Servers
Virtual machines
Containers
Compute Attributes
Storage
Networking
Load Balancers
API Gateways
Reverse proxies
Messaging brokers
Environments
Capacity Planning and Sizing
Disaster recovery
CICD
Overview
Jenkins
Sample Code
Installing Jenkins
Installing Docker
Setting up Plugins
Creating a project
Running the Build
Target Configuration
Tooling
go fmt
golint
go build
Footnote
Monitoring
Logs
Metrics
Application Performance Monitoring/Dashboards
Alerts
Team
Clouds
Infrastructure as a Service (IaaS)
Platform as a Service (PaaS)
Software as a service (SaaS)
Security
Summary
Chapter 12: Migrating Applications
Reasons for migration
Python
Java
Migration strategy
Phase 1 – Learning Go
Phase 2 – Piloting a service
Phase 3 – Defining packages
Phase 4 – Porting main
Phase 5 – Porting packages
Phase 6 – Improving computation
Building a team
Summary
Other Books You May Enjoy
Index