Poke blue word “front-end technology optimization” focus on us oh!

Editor: This article describes the Node application infrastructure component: distributed link tracking system.

This article mainly tells Why, What, I am writing the next one: How.

Is your Node application connected to the distributed link Tracking system?

A, the present situation

1.1 background

With the expansion of Internet architecture, we have evolved from traditional single application to today’s increasingly complex distributed system.

The diagram below:

A request, which eventually makes its way to the backend server, becomes a very complex call.

1.2 the problem

When something goes wrong online, how do we identify the cause of the problem?

In the traditional way, when our user reports a problem, the front end looks at what’s wrong with the interface, and then it says to the back end, your interface is wrong, and the back end goes to the logs and the code, and looks at the cause of the problem. If the backend has a problem with a dependent party that it serves, it will feed back to the other backend and then locate the problem until it is resolved.

Characteristics of the traditional model:

  1. Inefficient.

  2. It will be missed, and we need to get feedback from users

  3. Depending on the complexity of links, if there are 100 back ends, how to locate… .

1.3 thinking

Since the traditional model can’t solve this problem, how can we solve this problem efficiently? Does your Node program have a problem downstream and you have to run to locate the problem every time?

Second, the introduction

To solve this problem, we need to understand the infrastructure that this Node and other languages interconnect with: Distributed Link Tracking System.

2.1 What is a Distributed Link Tracking System?

Distributed link tracking system, it can restore the distributed request to call link again and again, and explicitly check the call situation of a distributed request on the platform, such as the time consuming of each node, which machine the request specifically hit, the request status of each service node and so on.

A function:

Feature 2:

In addition to displaying each service node in the server, the link tracking system also provides the function of viewing the application topology.

For example, the Node program A relies on the back-end Java program B, which in turn relies on another service.

For example, a simple application topology:

Three features:

Some distributed link systems also provide SQL performance analysis.

2.2 What can be done with it?

Check for faulty links:

Through the distributed link tracking platform, we can check the link containing errors. For example, we can see that the /user/getUserInfo.do interface reported an error because the Mysql database has been suspended. Mysql is running out of disk space.

Check for slow links:

Through the distributed link tracking platform, we can retrieve the point that is time-consuming, at this time we will analyze, is there a problem in our system due to this piece of code? Or the server is not enough to cause the response of this piece of service A.

Only when we know the reasons for the slowness of the overall distributed link, can we optimize and improve our overall link. For example, the link purchased by the overall e-commerce consumes very little time.

The theory of distributed link

3.1 history

In fact, Tracing, a link Tracing technology, emerged in the 1990s.

But really make this field popular, or from Google Dapper, “Tracking System for Large-scale Distributed Systems”. Translation of papers address: https://bigbully.github.io/Dapper-translation/

In addition to the above paper, there is another paper on sampling. Uncertainty in Aggregate Estimates from Sampled Distributed Traces

3.2 development

With the theoretical foundation, a group of outstanding Tracing software was born. Some popular software such as:

  • Zipkin(twitter)

  • Apache Skywalking

  • Eagle eye (taobao)

  • Jaeger

  • , etc.

3.3 Core Steps

We do distributed link tracking, which is roughly divided into three steps:

  • Code buried point

  • Data is stored

  • Query show

3.4 Initial status quo

Because link systems are developed according to the above two papers, each development has a different understanding, so different link tracking systems are not compatible with each other after they are developed. This leads to major changes if we want to switch tracking systems.

Is there a specification missing?

3.5 The birth of the standard

To address the incompatibility of different distributed link system apis, the OpenTracing specification was developed.

OpenTracing is a lightweight standardization layer that sits between the application/library and the link-tracing system.

What are the advantages of standards?

  • Unified API, so that developers can easily add tracking system implementation.

  • OpenTracing has entered CNCF and is providing unified models and data standards for distributed link tracking systems around the world.

OpenTracing data model:

It’s basically a Trace, and then the Trace is made up of Span.

It should be noted that A Trace is not A tree structure, it is A directed acyclic graph (DAG graph), because service A depends on B, and B can also depend on A, and the relationship between Span and Span is called References.

Here’s an example:

For better display, the distributed link tracking system is presented in the form of a timeline:

What information does Span contain?

For more information about OpenTracing, see the following address

conclusion

Distributed link tracking system implemented by OpenTracing includes Jaeger, SkyWalking and Zipkin.

About and the support, we can see OpenTracing website: https://opentracing.io/docs/supported-tracers/

In the next section, we’ll take a hands-on look at how a Node application connects to a distributed link tracking system. The next time a problem arises, it won’t be necessary to locate the problem in the traditional way.

The more time you save, the more useful skills you’ll be able to use that knowledge to learn, over and over again, and you’ll become a giant.

The next part is about the middle of the article. It is about building a distributed link tracking system, and then sharing how to use Node program to access such a distributed link system.