Spring Cloud Distributed Link Tracking (integrated zipkin)

Source: Internet
Author: User
Tags message queue

Write a distributed Link Tracking Spring Cloud Distributed Link Tracking

This kind of link tracking can solve the problem but the log is too fragmented if too many microservices can become quite complex

Zipkin can help us gather all the link-call processes.

It's like a registry, which is divided into clients and services that want to use a module first as his server.

First add the following dependencies

Compile ' io.zipkin.java:zipkin-server' Io.zipkin.java:zipkin-autoconfigure-ui '

Configure its port number and project name in the configuration file

Server:   9999Spring:  application:    name:zikpin-server

And then add @enablezipkinserver to his startup class.

@EnableZipkinServer @springbootapplication  Public class Zikpinserverprovider {    publicstaticvoid  main (string[] args) {        Springapplication.run (Zikpinserverprovider. class , args);}    }

It means that this is the Zipkin server.

Then you need to join the dependency on the client

    Compile group: ' Org.springframework.cloud ', Name: ' Spring-cloud-sleuth-zipkin '

Configuring on the Client

Spring:     zipkin:        base-url:http://localhost:9999 #代表zipkin服务端的地址     Sleuth:        Sampler:           1.0  #代表提交链路到zipkin的频率

Run localhost:9999

Can see this page this is Zipkin's homepage He can be very specific image of the link between the micro-services and their calls and time, performance, etc.

We run a method to invoke another microservices with the microservices try it if that's not going to be able to see my previous call between the spring cloud Eureka MicroServices

Then select time to query to see

Have seen us call two microservices for this request

We can also find the call chain based on the ID in the upper right corner to find the need to introduce sleuth based on the requested ID.

Refer to one of my blogs for details Spring cloud Distributed Link Tracking

And then, speaking of the above

Sleuth:        Sampler:           1.0

The following values can be entered between 0.1-1.0 for how much

It means that a percentage of the requests will be uploaded to Zipkin, like 50% of us. Upload it once, and then do it for the second time. Display only in the form of a log

Why do you use this thing?

Calls between our microservices are inherently resource-intensive and limited because the need to invoke another micro-service now needs to be uploaded to Zipkin, which can affect performance very much.

If it takes 30 seconds to upload to Zipkin, then the micro-service will do nothing but wait for 30 seconds to do something else so if the upload volume is particularly large, you can upload just a few samples

Link information can also be uploaded to the message queue so that it can be decoupled to the efficiency will not have an impact and then Zipkin from the message queue to download can be used Kafka and the like, I will write another blog in detail

The above is distributed Link tracking with integrated Zipkin

Spring Cloud Distributed Link Tracking (integrated zipkin)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.