Apache License 2.0

项目介绍

hengyoush/kyanos 是一个托管在 GitHub 上的开源项目,主要使用 C 编写,采用 Apache License 2.0 许可证,目前获得 5.1k 个 Star、235 次 Fork。

仓库全名
hengyoush/kyanos
开源许可证
Apache License 2.0
Star 数
5.1k
Fork 数
235
未关闭 Issue
32

README 摘要

kyanos One command to find slowest requests and identify the reasons. 简体中文 | English English Document Table of Contents kyanos Table of Contents What is kyanos Examples ❗ Requirements 🎯 How to get kyanos 📝 Documentation ⚙ Usage 🏠 How to build 🤝 Feedback and Contributions 🙇‍ Special Thanks 🗨️ Contacts Star History What is kyanos Kyanos is an eBPF-based network issue analysis tool that enables you to capture…

完整内容见 GitHub 原始 README 或本页 。

常见问题

kyanos 用什么语言开发?

主要使用 C 编写,采用 Apache License 2.0 许可证,目前有 5.1k 个 Star。

kyanos 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 kyanos 的源码?

可以直接克隆仓库:git clone https://github.com/hengyoush/kyanos.git;安装与运行步骤见仓库 README。

kyanos 最近还在维护吗?

仓库最近一次更新为 18 小时前,当前有 32 个未关闭 Issue;Star 数为 5.1k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Kyanos is a networking analysis tool using eBPF. It can visualize the time packets spend in the kernel, capture requests/responses, makes troubleshooting more efficient.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
5571
价值分
3118
活跃状态
活跃

语言占比

C
Go
JavaScript
Makefile
Shell

Release

README

kyanos

One command to find slowest requests and identify the reasons.

GitHub last commit GitHub release Test

hengyoush%2Fkyanos | Trendshift Featured on Hacker News Featured|HelloGitHub

简体中文 | English

Table of Contents

What is kyanos

Kyanos is an eBPF-based network issue analysis tool that enables you to capture network requests, such as HTTP, Redis, MySQL, Kafka, MongoDB, RocketMQ, and DNS requests. It also helps you analyze abnormal network issues and quickly troubleshooting without the complex steps of packet capturing, downloading, and analysis.

  1. Powerful Traffic Filtering: Not only can filter based on traditional IP/port information, can also filter by process/container, L7 protocol information, request/response byte size, latency, and more.
# Filter by pid
./kyanos watch --pids 1234
# Filter by container id
./kyanos watch --container-id abc
# Filter by Redis key
./kyanos watch redis --keys my-key1,my-key2
# Filter by response byte size
./kyanos watch --resp-size 10000
  1. Advanced Analysis Capabilities : Unlike tcpdump, which only provides fine-grained packet capture, Kyanos supports aggregating captured packet metrics across various dimensions, quickly providing the critical data most useful for troubleshooting.
    Imagine if the bandwidth of your HTTP service is suddenly maxed out—how would you quickly analyze which IPs and which requests are causing it?
    With Kyanos, you just need one command: kyanos stat http --bigresp to find the largest response byte sizes sent to remote IPs and view specific data on request and response metrics.
    kyanos find big response

  2. In-Depth Kernel-Level Latency Details: In real-world, slow queries to remote services like Redis can be challenging to diagnose precisely. Kyanos provides kernel trace points from the arrival of requests/responses at the network card to the kernel socket buffer, displaying these details in a visual format. This allows you to identify exactly which stage is causing delays.

kyanos time detail

  1. Lightweight and Dependency-Free: Almost zero dependencies—just a single binary file and one command, with all results displayed in the command line.

  2. Automatic SSL Traffic Decryption : All captured requests and responses are presented in plaintext.

Examples

Capture HTTP Traffic with Latency Details

Run the command:

./kyanos watch http

The result is as follows:

kyanos quick start watch http

Capture Redis Traffic with Latency Details

Run the command:

./kyanos watch redis

The result is as follows:

kyanos quick start watch redis

Identify the Slowest Requests in the Last 5 Seconds

Run the command:

 ./kyanos stat --slow --time 5

The result is as follows:

kyanos stat slow

❗ Requirements

Kyanos currently supports kernel versions 3.10(from 3.10.0-957) and 4.14 or above (with plans to support versions between 4.7 and 4.14 in the future).

You can check your kernel version using uname -r.

🎯 How to get kyanos

You can download a statically linked binary compatible with amd64 and arm64 architectures from the release page:

tar xvf kyanos_vx.x.x_linux_amd64.tar.gz

Then, run kyanos with root privilege:

sudo ./kyanos watch

If the following table appears: kyanos quick start success 🎉 Congratulations! Kyanos has started successfully.

📝 Documentation

English Document

⚙ Usage

The simplest usage captures all protocols currently supported by Kyanos:

sudo ./kyanos watch

Each request-response record is stored as a row in a table, with each column capturing basic information about that request. You can use the arrow keys or j/k to move up and down through the records: kyanos watch result

Press Enter to access the details view:

kyanos watch result detail

In the details view, the first section shows Latency Details. Each block represents a “node” that the data packet passes through, such as the process, network card, and socket buffer.
Each block includes a time value indicating the time elapsed from the previous node to this node, showing the process flow from the process sending the request to the network card, to the response being copied to the socket buffer, and finally read by the process, with each step’s duration displayed.

The second section provides Detailed Request and Response Content, split into Request and Response parts, and truncates content over 1024 bytes.

For targeted traffic capture, such as HTTP traffic:

./kyanos watch http

You can narrow it further to capture traffic for a specific HTTP path:

./kyanos watch http --path /abc

Learn more: Kyanos Docs

🏠 How to build

👉 COMPILATION.md

🤝 Feedback and Contributions

Important 重要

If you encounter any issues or bugs while using the tool, please feel free to ask questions in the issue tracker.

🙇‍ Special Thanks

During the development of kyanos, some code was borrowed from the following projects:

🗨️ Contacts

For more detailed inquiries, you can use the following contact methods:

Star History

Star History Chart

Back to top

评论

暂无评论