Chapter 65. Production Is the Happiest Place on Earth

Josh Long

Production is my first favorite place on the internet. I love production. You should love production. Go as early and often as possible. Bring the kids. Bring the family. The weather is amazing. It’s the happiest place on Earth. It’s better than Disneyland!

Getting there isn’t always easy, but trust me: once you get there, you’re going to want to stay. It’s like Mauritius. You’ll love it! Here are some tips to make your journey as pleasant as possible:

Take the continuous delivery highway.
There’s no faster way to production. Continuous delivery lets you move quickly and consistently from the latest Git commit to production. In a continuous delivery pipeline, code moves automatically from developer to deployment, and every step in between, in one smooth motion. Continuous integration tools like Travis CI or Jenkins help, but try to mine information gleaned while in production. Canary releases are a technique to reduce the risk of introducing a new software version in production by slowly rolling out the change to a small cross-section of users. Continuous delivery tools like Netflix’s Spinnaker can automate this sort of nuanced deployment strategy.
Production can be surprising.
Be prepared! Services will fail. Don’t leave your clients in the lurch. Specify aggressive client-side timeouts. Service-level agreements (SLAs) dominate a lot of technical discussions. Use service-hedging—a pattern in which multiple idempotent calls to identically configured service instances on discrete nodes are launched and all but the fastest response discarded—to meet SLAs. Failures will happen. Use circuit breakers to explicitly define failure modes and isolate failures. Spring Cloud has an abstraction, Spring Cloud Circuit Breaker, that supports reactive and nonreactive circuits.
In production, nobody can hear your application scream.
Embrace observability from the get-go. Production is a busy place! If everything goes well, you’ll have more users and demand than you’ll know what to do with. As demand increases, scale. Cloud infrastructure like Cloud Foundry, Heroku, and Kubernetes have long supported horizontal scale out by fronting an ensemble of nodes with a load balancer. This is particularly easy if you’re building stateless, 12-Factor-style microservices. This strategy works even if your application monopolizes otherwise precious resources like threads.
Your code shouldn’t monopolize threads.
Threads are super expensive. The best solutions to this problem—cooperative multithreading—are about giving signals to the runtime about when it can move work on and off a finite set of actual, operating-system threads. Learn about things like reactive programming as supported by Project Reactor (fairly common on the server side) and Spring Webflux and RxJava (fairly common on Android). If you understand how reactive programming works, it’s a natural next step to embrace things like Kotlin’s coroutines. Cooperative multithreading lets you multiply the number of users supported or divide infrastructure costs.
Autonomy is a key to success.
Microservices enable small, singly-focused teams, able to release software to production autonomously.
Ninety percent of your application is mundane.
Embrace frameworks like Spring Boot to let you focus on the bottom-line production deliverables, and not on supporting code. Is the Java programming language not your cup of tea—er—coffee? The JVM ecosystem is rich with productive alternatives like Kotlin.

Remove the friction of going to production. Eschew what Amazon CTO Werner Vogels calls “undifferentiated heavy lifting.”1 Clear the path to production and people will want to go early and often. They’ll yearn for what has been called Antoine de Saint-Exupéry’s “vast and endless seas.”

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.22.107