+ All Categories
Home > Technology > Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Date post: 11-Jan-2017
Category:
Upload: container-solutions
View: 383 times
Download: 1 times
Share this document with a friend
35
container-solutions.com | @containersoluti | [email protected] Distributed Tracing with ZipKin & Kubernetes Maximilian Schöfmann @schoefmann Container Solutions AG @containersoluti
Transcript
Page 1: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

container-solutions.com | @containersoluti | [email protected]

Distributed Tracing with ZipKin &Kubernetes Maximilian Schöfmann@schoefmann

Container Solutions AG@containersoluti

Page 2: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

container-solutions.com | @containersoluti | [email protected]

Microservices...

In short, the microservice architectural style is an approach to develop a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.

-- James Lewis and Martin Fowler

Page 3: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

The “Socks Shop”...

microservices-demo.github.io

Page 4: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

The “Socks Shop”...

Page 5: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Let’s install it in the cluster...

Page 6: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Microservice benefits● Modeling after business domains

● Independent deployment

● Technology diversity

Page 7: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Microservice costs● Distribution

● Eventual Consistency

● Operational complexity

Page 8: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Microservice requirements● Rapid provisioning

● Monitoring

● Rapid deployment

● Autonomous teams

Page 9: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Microservice architectures● Monolithic to microservice architecture

● Apps as a collection of distributed services

● Tools becoming necessary to gather metrics

Page 10: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Why distributed tracing?

Example: Google search query● Multiple index lookups● Selecting Ads● Check spelling● Personalise results● Filter DMCA takedowns ● Include relevant images...● ...and videos● ...and news● ...

Page 11: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Why distributed tracing?“Per-process logging and metric monitoring have their place, but neither can reconstruct the elaborate journeys that transactions take as they propagate across a distributed system. Distributed traces are these journeys.”

-- Chris Aniszczyk, Cloud Native Computing Foundation

Page 12: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Fundamental requirements to make it work

● Ubiquitous deployment

● Continuous monitoring

See also: “Dapper, a Large-Scale Distributed Systems Tracing Infrastructure”http://research.google.com/pubs/pub36356.html (2010)

Page 13: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Requirements to make is useful● Low overhead

● Application-level transparency

● Scalability

● (Timely) data availability

Page 14: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

A distributed trace...

“A tracing infrastructure for distributed

services needs to record information

about all the work done in a system, on

behalf of a given initiator”

Page 15: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

Data aggregation

Message record:

Record = Message identifier + timestamped event

Data aggregation classes:

● Black box

● Annotation-based

Page 16: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

Distributed Tracing | container-solutions.com

● Trace as a tree of nested calls

● Trace trees and spans

Trace data model

Page 17: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

SpanLogged event in a typical span

● Span name● Span start time● Span end time● Trace id● Span id● Span parent id● Any timing information recorded by the instrumentation library (RPC, HTTP)● Additional custom labels (“foo”)

Page 18: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

OpenTracing & ZipKinCommon libraries for several programming languages

➔ Libraries attach a trace context to the thread local storage

➔ RPC friendly (specially when using gRPC)

➔ The data is language-independent

opentracing.io zipkin.io

Page 19: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Let’s install that also in the cluster...

Page 20: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Supported languages➔ Javascript

➔ Python

➔ Java

➔ Scala

➔ Ruby

➔ C#

➔ Golang

Page 21: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Supported frameworks➔ Express (nodejs - http)➔ Jersey, RestEasy, JAXRS2, Apache HttpClient, Mysql (Java, HTTP, gRPC)➔ HDFS, HBASE➔ Spring, Spring Cloud➔ Apache Cassandra ➔ Finagle➔ Rack➔ Golang Context➔ GoKit➔ Akka, Spray, Play➔ Dropwizard➔ Roll your own

Page 22: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Opentracing Example (Go)

explicitely instrumenting a SQL query in a service written in Go

Page 23: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Annotations● Arbitrary text

● Key/Value pairs

➔Can be used for common vocabulary, e.g. “http.status_code”, “peer.service”, “sampling.priority”

Page 24: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Architecture (ZipKin with Scribe + Cassandra)

Page 25: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Performance

Low overhead is the key!

Sampling is the solution!

… at least partially...

Page 26: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Sampling➔ 2-stage sampling:

a. Client: Don’t send every trace instrumented

● limits client-side CPU and bandwidth overhead

● adjustable per service, hard to change in one go

b. Server: Don’t persist every trace received

● limits server-side IO and data volume overhead

● adjustable centrally with simple config change

➔ Adaptive sampling to trade off overhead against missing relevant traces

Page 27: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

But what about...

● Proprietary services?

● Ancient/Legacy Services?

● 3rd-Party services outside your control?

Page 28: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

But what about...

● Proprietary services?

● Ancient/Legacy Services?

● 3rd-Party services outside your control?

Proxying!

Page 29: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Linkerd overview

● Intelligent, adaptive load-balancing

● Global, fine-grained instrumentation

● Application-centric naming

● Powerful traffic routing mechanisms

Page 30: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Some of the answered questions......with a distributed tracing system are:

● Which parts of my system are slow?● Which call pattern can be optimized with parallelization?● Which calls are redundant?● Which routes are affected by this failing part?● Under which circumstances is it failing?● How often is it failing?● Detect queries issued to read and write masters,

instead of read only replicas

Page 31: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

A word of caution about distributed tracing● Documentation is still rather poor

● Yet another moving part

● Can accumulate huge amounts of data

● Metrics need to be interpreted

● Commercial APM solutions might be an easier route for your use case...

Page 32: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

A word of caution about distributed tracing● Documentation is still rather poor

● Yet another moving part

● Can accumulate huge amounts of data

● Metrics need to be interpreted

● Commercial APM solutions might be an easier route for your use case...

Page 35: Distributed Tracing with OpenTracing, ZipKin and Kubernetes

www.container-solutions.com | [email protected]

Questions? Want to learn more?

● Come to our 2 day tinyurl.com/microservice-workshop

(November 8. + 9. or at your company on request)

● Follow us on Twitter: @containersoluti

● Read more on our blog: container-solutions.com/blog

● Or just get in touch: [email protected]


Recommended