Building Microservices: Designing Fine-Grained Systems
Rate it:
Kindle Notes & Highlights
Read between November 1 - December 24, 2017
51%
Flag icon
blue/green, we have two copies of our software deployed at a time, but only one version of it is receiving real requests.
51%
Flag icon
With canary releasing, we are verifying our newly deployed software by directing amounts of production traffic against the system to see if it performs as expected.
52%
Flag icon
Many, if not most, CFRs can really only be met in production.
53%
Flag icon
Due to the time it takes to run performance tests, it isn’t always feasible to run them on every check-in.
53%
Flag icon
make the build go red or green based on the results, with a red (failing) build being a clear call to action.
53%
Flag icon
monitor the small things, and use aggregation to see the bigger picture.
53%
Flag icon
First, we’ll want to monitor the host itself. CPU, memory
53%
Flag icon
Next, we’ll want to have access to the logs from the server itself.
54%
Flag icon
Finally, we might want to monitor the application itself.
54%
Flag icon
to a single
54%
Flag icon
alert
54%
Flag icon
multiplexers, which allow us to run the same commands on multiple hosts. A big monitor and
55%
Flag icon
I would strongly suggest having your services expose basic metrics themselves.
56%
Flag icon
Each service instance should track and expose the health of its downstream dependencies, from the database to other collaborating services.
56%
Flag icon
You definitely want to have all your metrics in one place, and you may want to have a list of standard names for your metrics too;
57%
Flag icon
Alert on the things they need to know right now. Create big visible displays with this information that sit in the corner of the room.
57%
Flag icon
This data can then be dispatched to a variety of systems, like Storm for real-time analysis, Hadoop for offline batch processing, or Kibana for log analysis.
69%
Flag icon
If you build this thinking into everything you do, and plan for failure, you can make different trade-offs.
69%
Flag icon
Understanding cross-functional requirements is all about considering aspects like durability of data, availability of services, throughput, and acceptable latency of services.
69%
Flag icon
Response time/latency
69%
Flag icon
Availability
69%
Flag icon
Durability of data
70%
Flag icon
An essential part of building a resilient system, especially when your functionality is spread over a number of different microservices that may be up or down, is the ability to safely degrade functionality.
70%
Flag icon
What we need to do is understand the impact of each outage, and work out how to properly degrade functionality.
70%
Flag icon
architectural safety measures,
71%
Flag icon
Netflix has made these tools available under an open source license.
71%
Flag icon
Put timeouts on all out-of-process calls, and pick a default timeout for everything. Log when timeouts occur, look at what happens, and change them accordingly.
71%
Flag icon
With a circuit breaker, after a certain number of requests to the downstream resource have failed, the circuit breaker is blown. All further requests fail fast while the circuit breaker is in its blown state. After a certain period of time, the client sends a few requests through to see if the downstream service has recovered, and if it gets enough healthy responses it resets the circuit breaker.
71%
Flag icon
How you implement a circuit breaker depends on what a failed request means,
72%
Flag icon
Separation of concerns can also be a way to implement bulkheads.
72%
Flag icon
I’d recommend mandating circuit breakers for all your synchronous downstream calls.
72%
Flag icon
Polly for .NET, or the circuit_breaker mixin for Ruby.
Tommy
polly library
72%
Flag icon
Hystrix allows you, for example, to implement bulkheads that actually reject requests in certain conditions to ensure that resources don’t become even more saturated; this is known as load shedding.
72%
Flag icon
Some of the HTTP verbs, such as GET and PUT, are defined in the HTTP specification to be idempotent,
74%
Flag icon
the configuration of a load balancer, treat it as you treat the configuration of your service: make sure it is stored in version control and can be applied automatically.
75%
Flag icon
primary node, but distribute reads to one or more read replicas,
75%
Flag icon
Reads are comparatively easy to scale. What about writes? One approach is to use sharding.
75%
Flag icon
data. To pick a very simplistic (and actually bad) example, imagine that customer records A–M go to one database instance, and N–Z another. You
75%
Flag icon
Often querying across shards is handled by an asynchronous mechanism, using cached results. Mongo uses map/reduce jobs, for example, to perform these queries.
75%
Flag icon
more systems support adding extra shards to a live system, where the rebalancing of data happens in the background; Cassandra, for example, handles this very well.
76%
Flag icon
With proxy caching, a proxy is placed between the client and the server. A great example of this is using a reverse proxy or content delivery network (CDN). With
76%
Flag icon
proxy like Squid or Varnish,
76%
Flag icon
all comes down to knowing what load you need to handle, how fresh your data needs to be, and what your system can do right now.
76%
Flag icon
First, with HTTP, we can use cache-control directives in our responses to clients.
76%
Flag icon
These tell clients if they should cache the resource at all, and if so how long they should cache it for in seconds.
76%
Flag icon
Expires h...
This highlight has been truncated due to consecutive passage length restrictions.
76%
Flag icon
ETag is used to determine if the value of a resource has changed.
76%
Flag icon
we already have the up-to-date version, the service sends us a 304 Not Modified response, telling us we have the latest version. If there is a newer version available, we get a 200 OK
77%
Flag icon
write-behind cache,
78%
Flag icon
you could also have the scaling triggered by well-known trends.