Cloud Native Go

Book Description

What do Docker, Kubernetes, and Prometheus have in common? All of these cloud native technologies are written in the Go programming language. This practical book shows you how to use Go’s strengths to develop cloud native services that are scalable and resilient, even in an unpredictable environment. You’ll explore the composition and construction of these applications, from lower-level features of Go to mid-level design patterns to high-level architectural considerations.

Each chapter builds on the lessons of the last, walking intermediate to advanced developers through Go to construct a simple but fully featured distributed key-value store. You’ll learn best practices for adopting Go as your cloud native development language for solving cloud native management and deployment issues.

  • Learn how cloud native applications differ from other software architectures
  • Understand how Go can solve the challenges of designing scalable, distributed services
  • Leverage Go’s lower-level features, such as channels and goroutines, to implement a reliable cloud native service
  • Explore what "service reliability" is and what it has to do with "cloud native"
  • Apply a variety of patterns, abstractions, and tooling to build and manage complex distributed systems

Publisher Resources

View/Submit Errata

Table of Contents

  1. Preface
    1. Who Should Read This Book
    2. Why I Wrote This Book
    3. Conventions Used in This Book
    4. Using Code Examples
    5. O’Reilly Online Learning
    6. How to Contact Us
    7. Acknowledgments
  2. I. Going Cloud Native
  3. 1. What Is a “Cloud Native” Application?
    1. The Story So Far
    2. What Is Cloud Native?
      1. Scalability
      2. Loose coupling
      3. Resilience
      4. Manageability
      5. Observability
    3. Why Is Cloud Native a Thing?
  4. 2. Why Go Rules the Cloud Native World
    1. The Motivation Behind Go
    2. Features For a Cloud Native World
      1. Composition and Structural Typing
      2. Comprehensibility
      3. CSP-Style Concurrency
      4. Fast Builds
      5. Linguistic Stability
      6. Memory Safety
      7. Performance
      8. Static Linking
      9. Static Typing
  5. II. Cloud Native Go Constructs
  6. 3. Go Language Foundations
    1. Types
      1. Simple Numbers
      2. Complex Numbers
      3. Booleans
    2. Variables
      1. Short Variable Declarations
      2. Zero Values
    3. Constants
    4. Pointers
    5. Collections: Arrays, Slices, and Maps
      1. Arrays
      2. Slices
      3. Maps
    6. Control Structures
      1. Fun With for
      2. The if Statement
      3. The switch Statement
    7. Error Handling
      1. Creating an Error
    8. Putting the Fun in Functions: Variadics and Closures
      1. Functions
      2. Variadic Functions
      3. Anonymous Functions and Closures
    9. Structs, Methods, and Interfaces
      1. Structs
      2. Methods
      3. Interfaces
    10. The Good Stuff: Concurrency
      1. Goroutines
      2. Channels
      3. Select
  7. 4. Cloud Native Patterns
    1. Layout of this Chapter
      1. The Context Package
    2. Stability Patterns
      1. Circuit Breaker
      2. Debounce
      3. Retry
      4. Throttle
      5. Timeout
    3. Concurrency Patterns
      1. Fan-In
      2. Fan-Out
      3. Future
      4. Sharding
  8. 5. Building a Cloud Native Service
    1. Let’s Build A Service!
      1. What’s a Key-Value Store?
    2. Requirements
      1. What Is Idempotence and Why Does It Matter?
      2. The Eventual Goal
    3. Generation 0: The Core Functionality
      1. Our Super Simple API
    4. Generation 1: The Monolith
      1. Building an HTTP Server With net/http
      2. Building an HTTP Server With gorilla/mux
      3. Building our RESTful Service
      4. Making Our Data Structure Concurrency-Safe
    5. Generation 2: Persisting Resource State
      1. What’s a Transaction Log?
      2. Storing State in a Transaction Log File
      3. Storing State in an External Database
    6. Generation 3: Implementing Transport Layer Security
      1. Transport Layer Security
      2. Private Key and Certificate Files
      3. Securing Our Web Service With HTTPS
      4. Transport Layer Summary
    7. Containerizing Our Key-Value Store
      1. Docker (Absolute) Basics
      2. Containerizing Our Key-Value Store
      3. Externalizing Container Data
    8. Summary
  9. 6. It’s All About Dependability
    1. What’s the Point of Cloud Native?
    2. It’s All About Dependability
    3. What Is Dependability and Why Is It So Important?
      1. Dependability: It’s Not Just For Ops Anymore
    4. Achieving Dependability
      1. Fault Prevention
      2. Fault Tolerance
      3. Fault Removal
      4. Fault Forecasting
    5. The Continuing Relevance of the Twelve-Factor App
      1. I. Codebase
      2. II. Dependencies
      3. III. Configuration
      4. IV. Backing Services
      5. V. Build, Release, Run
      6. VI. Processes
      7. VII. Data Isolation
      8. VIII. Scalability
      9. IX. Disposability
      10. X. Development/Production Parity
      11. XI. Logs
      12. XII. Administrative Processes
    6. Summary

Product Information

  • Title: Cloud Native Go
  • Author(s): Matthew A. Titmus
  • Release date: May 2021
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492076261