Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Table of Contents

Title Page 2
Copyright and Credits 4
Hands-On Software Architecture with Golang 5
About Packt 6
Why subscribe? 7
Packt.com 8
Contributors 9
About the author 10
About the reviewer 11
Packt is searching for authors like you 12
Preface 21
Who this book is for 22
What this book covers 23
To get the most out of this book 25
Download the example code files 26
Download the color images 27
Conventions used 28
Get in touch 29
Reviews 30
Building Big with Go 31
Problem solving for the big picture 32
The role of the architect 34
Requirements clarification 35
True North 36
Technology selection 37
Leadership in the kitchen 38
Coaching and mentoring 39
Target state versus current state 40
Software architecture 41
Architecture versus design 42
What does architecture look like? 43
Microservices 46
The challenges for microservices – efficiency 50
The challenges for microservices – programming complexity 52
Go 53
Hello World! 55
Data types and structures 56
Functions and methods 58
Flow control 60
Packaging 62
Concurrency 64
Garbage collection 67
Object-orientation 68
Summary 69
Packaging Code 70
Contracts 71
Object orientation 72
Object orientation in Go – the struct 77
Object orientation in Go – visibility 79
Object oriented in Go – the interface 80
Object oriented in Go – embedding 84
Modules 87
Code layout 88
Third-party dependencies 90
Framework 93
Testing 94
Structuring tests 96
Summary 98
Design Patterns 99
Design principles 100
Single Responsibility Principle (S) 101
Open/Closed Principle (O) 102
Liskov Substitution Principle (L) 103
Interface Segregation Principle (I) 104
Dependency Inversion Principle (D) 106
Creational design patterns 107
Factory method 108
Builder 109
Abstract factory 111
Singleton 113
 Structural design patterns 114
Adaptor 115
Bridge 117
Composite 119
Decorator 121
Facade 122
Proxy 123
Behavioral design patterns 124
Command 125
Chain of Responsibility 128
Mediator 129
Memento 131
Observer 133
Visitor 135
Strategy 138
State 140
Summary 142
Scaling Applications 143
Scaling algorithms 145
Algorithm complexity 146
Distributed algorithms 150
Scaling data structures 152
Profiling data structures 153
Probabilistic data structures 156
Scaling data 158
Scalability bottlenecks 159
The C10K problem 160
The Thundering Herd problem 162
Sources 163
Programming 164
Operating systems 165
Memory usage 167
Losing state 169
Scaling systems 172
X-axis scaling 173
Y-axis scaling 174
Z-axis scaling 177
Scaling deployments 179
Summary 180
Going Distributed 181
Topology 183
Distributed system quirks 185
The network is reliable 186
The latency is zero 187
The bandwidth is infinite 189
The network is secure 190
The topology doesn't change 191
There is one administrator 192
The transport cost is zero 193
The network is homogeneous 196
Consistency 197
ACID 198
Client-centric consistency models 199
Strong consistency 200
Weak consistency 201
Eventual consistency 202
Sequential consistency 203
Causal consistency 204
Session consistency 205
Monotonic read consistency 206
Monotonic write consistency 207
Storage system-centric consistency model 208
CAP theorem 209
Consensus 210
The two generals problem 211
Consensus based on time – causality 212
Multi-phase commit 215
Two-phase commit 216
Three-phase commit 217
Paxos 219
Raft 222
Leader-election 223
Distributed architectures 225
Object-based systems 226
Layered architectures 228
Peer-2-peer (P2P) architecture 230
Distributed computations 235
Event-driven architecture (EDA) 237
The Actor model 241
Stream processing 242
Summary 244
Messaging 245
Performance characterization 246
Broker-based messaging 247
The queuing model 248
The Pub/Sub model 249
Delivery semantics 251
Acknowledgement 252
At-least-once delivery 253
At-most-once delivery 254
Exactly-once delivery 255
Resilience 256
AMQP 257
Apache Kafka deep dive 259
Concepts 260
Publishing messages 263
The AsyncProducer interface 264
The Sync producer 267
Consuming messages 268
Stream processing 270
Brokerless messaging 271
NSQ deep-dive 273
Concepts 274
Publishing messages 277
Consuming messages 279
Integration patterns 281
The request-reply pattern 282
The correlation identifier pattern 284
The pipes and filters pattern 285
The content-based router pattern 287
The fan-in pattern 288
The fan-out pattern 290
The background worker pattern 292
Summary 293
Building APIs 294
Endpoints 295
Networking basics 296
Service discovery 297
Server-side service discovery 298
Client-side service discovery 300
Data serialization 302
XML 303
JSON 304
Protobuf 305
Performance 306
Representational State Transfer (REST) 307
Concepts 308
Constraints 310
Client-server model 311
Stateless 312
Cacheability 313
Uniform interface 314
Richardson Maturity Model 315
Level 0 – swamp of POX 316
Level 1 – resources 317
Level 2 – HTTP verbs 318
Level 3 – hypermedia controls 319
Building a REST service using Gin 320
Gin introduction 322
Sample application 323
Router 324
Create 325
Read 327
Update 329
Delete 330
GraphQL 331
Schema 332
Endpoints 334
Queries 335
Mutations 337
Subscriptions 339
Higher-level patterns 340
Model-View-Controller (MVC) 341
Load balancing health checks 343
API gateway 344
Go kit  347
Summary 350
Modeling Data 351
Entities and relationships 352
Consistency guarantees 354
ACID (Atomicity, Consistency, Isolation, Durability) 355
Atomicity 356
Consistency 357
Isolation 358
Durability 360
BASE (Basically Available, Soft state, Eventual consistency) 361
Relational model 362
The first normal form 363
The second normal form 366
The third normal form 368
The Boyce-Codd normal form 370
The fourth normal form 372
SQL 374
Indices 375
Views 376
Inner join 378
Left outer join 379
Right outer join 380
Full outer join 381
MySQL deep-dive 382
Connection management 383
Query execution 384
Storage engines 388
InnoDB 389
MyISAM 391
Other plugins 392
High availability/scalability 393
Object Relational Mappers (ORMs) 394
Key/value stores 399
Concepts 400
Redis deep-dive 401
Architecture 402
Data structures 403
Persistence 404
Clustering 405
Use cases 406
Golang usage 407
Wide column stores 410
Column family stores 411
Cassandra deep-dive 412
Data distribution 413
Write paths 416
Read paths 417
Golang usage 418
Patterns for scaling data performance 421
Sharding 422
Denormalization 423
Materialized views 425
Summary 426
Anti-Fragile Systems 427
Reliability metrics 429
Dynamic metrics 430
Static metrics 431
Engineering reliability 432
Rugged services 435
High availability 436
Messaging 438
The asynchronous computation pattern 439
The orchestrator pattern 442
The compensating-transaction pattern 443
The pipes and filter pattern 445
Hotspots 446
The sidecar pattern 447
Throttling 448
Versioning  450
Reliability verification 451
Unit tests 453
Integration tests 455
UI tests 456
Performance tests 457
Chaos-engineering 459
Dependencies 461
Failure multiplication 462
Cascading failures 463
Dependency resilience 466
An introduction to Hystrix 467
Hystrix – fallback 469
Hystrix – circuit breaker 470
Hystrix in Golang 471
Hystrix monitoring 473
Database-level reliability 475
Datacenter-level reliability 476
Consistency 478
Routing and cutover 480
Summary 481
Case Study – Travel Website 482
The product 483
Actors 484
Requirements 485
Data modeling 488
High-level architecture 491
Search 492
Flights 493
Hotels 502
Booking 505
Payment 506
Reservation 508
Summary 514
Planning for Deployment 515
Deployment architecture 516
Components 517
Computes 519
Physical Servers 520
Virtual machines 521
Containers 522
Compute Attributes 524
Storage 525
Networking 526
Load Balancers 527
API Gateways 529
Reverse proxies 530
Messaging brokers 531
Environments 532
Capacity Planning and Sizing 534
Disaster recovery 536
CICD 537
Overview 538
Jenkins 539
Sample Code 540
Installing Jenkins 541
Installing Docker 542
Setting up Plugins 543
Creating a project 545
Running the Build 548
Target Configuration 549
Tooling 550
go fmt 551
golint 552
go build 554
Footnote 555
Monitoring 556
Logs 557
Metrics 559
Application Performance Monitoring/Dashboards 561
Alerts 563
Team 564
Clouds 565
Infrastructure as a Service (IaaS) 566
Platform as a Service (PaaS) 569
Software as a service (SaaS) 572
Security 573
Summary 576
Migrating Applications 577
Reasons for migration 578
Python 579
Java 583
Migration strategy 588
Phase 1 – Learning Go 589
Phase 2 – Piloting a service 590
Phase 3 – Defining packages 591
Phase 4 – Porting main 592
Phase 5 – Porting packages 593
Phase 6 – Improving computation 595
Building a team 596
Summary 598
Other Books You May Enjoy 599
Leave a review - let other readers know what you think 600

You might also like