Operations 16 min read

Master SkyWalking: End‑to‑End Guide for Distributed Tracing & Monitoring

This article introduces SkyWalking, a Chinese open‑source APM framework, compares it with Spring Cloud Sleuth+Zipkin, explains server and client setup, storage configuration, log collection, performance profiling, and alerting, providing step‑by‑step instructions, code snippets, and screenshots to help developers implement comprehensive distributed tracing.

macrozheng
macrozheng
macrozheng
Master SkyWalking: End‑to‑End Guide for Distributed Tracing & Monitoring

Today we introduce another solution for distributed tracing: SkyWalking.

What is SkyWalking?

SkyWalking is an excellent open‑source APM framework originated in China in 2015 and entered the Apache incubator in 2017. It supports Dubbo, Spring Cloud, Spring Boot integration, offers non‑intrusive bytecode enhancement, uses gRPC for communication, provides good performance, Java agents, alarm, JVM monitoring, and global call statistics.

How to choose between SkyWalking and Spring Cloud Sleuth+Zipkin?

SkyWalking has several advantages over Zipkin:

SkyWalking uses bytecode enhancement for non‑intrusive integration, while Zipkin requires more code changes.

SkyWalking offers richer features, more user‑friendly UI, and comprehensive reporting.

Personal recommendation: for a new architecture, prefer SkyWalking.

What is the architecture of SkyWalking?

SkyWalking, like Zipkin, consists of a server side and a client side. The server collects log data and displays it.

The architecture has four main components:

Agent : collects log data and forwards it to the OAP server.

OAP : receives tracing and metric data, performs analysis, stores it, and provides query capabilities.

UI : web console for viewing traces, metrics, performance, etc.

Storage : stores data and supports multiple storage types.

The Agent sends data to OAP via gRPC; OAP stores the data and the UI visualizes reports, service dependencies, and topology.

How to set up the server?

SkyWalking is started via a JAR package. Download the package from https://skywalking.apache.org/downloads/.

1. Install the package

Select version V8.7.0.

Above is just one choice; you can select other versions as needed.

After extraction, the directory structure looks like this:

Important directories:

agent : contains the JAR that integrates with the client.

bin : startup scripts for the server.

config : configuration files.

logs : OAP logs.

oap-libs : OAP dependencies.

webapp : UI service files.

2. Modify configuration

Before starting, edit /config/application.yml to use Nacos as the registry:

Change the UI port from the default 8080 to 8888 to avoid conflicts:

3. Start services

Run the scripts in /bin: oapService.bat (or .sh) for the OAP service and webappService.bat (or .sh) for the UI. You can also use startup.bat to launch both at once.

Access the UI at http://localhost:8888/.

How to set up the client?

The client is a regular microservice; SkyWalking uses bytecode enhancement, so no code changes are required.

Example services:

skywalking-product1001: product microservice

skywalking-order1002: order microservice

skywalking-gateway1003: gateway microservice

Start the service with the SkyWalking agent:

-javaagent:E:\springcloud\apache-skywalking-apm-es7-8.7.0\apache-skywalking-apm-bin-es7\agent\skywalking-agent.jar
-Dskywalking.agent.service_name=skywalking-product-service
-Dskywalking.collector.backend_service=127.0.0.1:11800

Parameter explanation:

-javaagent : path to

skywalking-agent.jar

.

-Dskywalking.agent.service_name : service name (usually the Spring application name).

-Dskywalking.collector.backend_service : address of the OAP service, default 127.0.0.1:11800.

In IDEA, add these JVM options to the run configuration.

After starting, the three services appear in the UI as monitored services.

How to persist data?

By default SkyWalking stores tracing data in memory, which is lost after a restart. You can replace the storage backend, for example with MySQL.

1. Modify configuration file

Change the storage type to MySQL in config/application.yml and set the MySQL credentials.

2. Add MySQL JDBC dependency

Copy the MySQL driver JAR into the oap-libs directory.

After restarting, SkyWalking automatically creates the required tables in the MySQL database.

How to monitor logs?

SkyWalking UI includes a log module. To send logs, configure the logging framework, e.g., logback.

log4j: https://skywalking.apache.org/docs/skywalking-java/v8.8.0/en/setup/service-agent/java-agent/application-toolkit-log4j-1.x/

log4j2: https://skywalking.apache.org/docs/skywalking-java/v8.8.0/en/setup/service-agent/java-agent/application-toolkit-log4j-2.x/

logback: https://skywalking.apache.org/docs/skywalking-java/v8.8.0/en/setup/service-agent/java-agent/application-toolkit-logback-1.x/

1. Add dependency

<dependency>
   <groupId>org.apache.skywalking</groupId>
   <artifactId>apm-toolkit-logback-1.x</artifactId>
   <version>${project.release.version}</version>
</dependency>

2. Add configuration file

Create

logback-spring.xml

in the resources directory as shown in the official documentation.

After starting the service, logs with traceId appear in the UI.

How to perform performance profiling?

SkyWalking provides stack‑based profiling. Create a profiling task for the

/order/list

endpoint (which sleeps 2 seconds) and view the detailed stack trace.

How to set up alerts?

SkyWalking includes default alert rules, such as average response time > 1 s, success rate < 80 %, etc., configurable in

config/alarm-settings.yml

.

Custom webhook alerts can be defined to send notifications via email, WeChat, DingTalk, etc.

POST request

application/json payload

Parameters must match the

AlarmMessage

class.

Define a new alarm module (e.g., skywalking-alarm1004) and add the webhook configuration.

Trigger the alarm by repeatedly calling the slow endpoint; the console logs show the alert.

Summary

This article introduced SkyWalking as a distributed tracing solution, covering server and client setup, data persistence, log monitoring, performance profiling, and alerting.

JavaMonitoringAPMperformance profilingDistributed TracingSkyWalking
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.