• Stars
    star
    731
  • Rank 61,995 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Extremely fast tracing library for Rust

minitrace: Extremely fast tracing library for Rust

Crates.io Documentation CI Status Coverage License


minitrace is a tracing library 10~100x faster than others:

benchmark

Features:

Resources

Benchmarks

By different architectures:

Benchmark result by architecture

x86-64 (Intel Broadwell) x86-64 (Intel Skylake) x86-64 (AMD Zen) ARM (AWS Graviton2)
tokio-tracing 124x slower 33x slower 36x slower 29x slower
rustracing 45x slower 10x slower 11x slower 9x slower
minitrace (baseline) 1x (3.4us) 1x (3.2us) 1x (3.8us) 1x (4.2us)

By creating different number of spans:

Benchmark result by number of spans

1 span 10 spans 100 spans 1000 spans
tokio-tracing 19x slower 61x slower 124x slower 151x slower
rustracing 13x slower 26x slower 45x slower 55x slower
minitrace (baseline) 1x (0.4us) 1x (0.8us) 1x (3.4us) 1x (27.8us)

Detailed results are available in etc/benchmark-result.

Projects using minitrace

Feel free to open a PR and add your projects here:

  • TiKV: A distributed transactional key-value database

FAQ

Why is minitrace so fast?

There are some articles posted by the maintainer of minitrace:

What is library-level tracing?

Library-level tracing refers to the capability of incorporating tracing capabilities directly within libraries, as opposed to restricting them to application-level or system-level tracing.

Tracing can introduce overhead to a program's execution. While this is generally acceptable at the application level, where the added overhead is often insignificant compared to the overall execution time, it can be more problematic at the library level. Here, functions may be invoked frequently or performance may be critical, and the overhead from tracing can become substantial. As a result, tracing libraries not designed with speed and efficiency in mind may not be suitable for library-level tracing.

In the realm of the minitrace library, library-level tracing is engineered to be fast and lightweight, resulting in zero overhead when it's not activated. This makes minitrace an excellent choice for use in performance-sensitive applications, and it can be seamlessly integrated into libraries in a similar fashion to the log crate, something other tracing libraries may not offer.

How does minitrace differ from other tracing libraries?

While many tracing libraries aim for extensive features, minitrace prioritizes performance and simplicity.

For example, minitrace doesn't introduce new logging macros, e.g. info!() or error!(), but seamlessly integrates with the log crate. This allows you to use existing logging macros and dependencies, with logs automatically attached to the current tracing span.

Will minitrace incorporate 'level' for spans?

The concept of 'level' may not be an optimal feature for tracing systems. While tokio-tracing incorporates this feature, the underlying motivation for having levels in a span primarily revolves around performance. More specifically, it relates to the performance implications of tracing elements that are not of interest. However, tracing differs from logging in two key aspects:

  1. Disregarding a low-level span might inadvertently discard a high-level child span.
  2. The process of filtering, or 'level' as it's often called, in a tracing system should be applied to a trace as a whole rather than individual spans within a trace.

In this context, minitrace offers a more efficient solution by filtering out entire traces that are not of interest through its unique tail-sampling design. Therefore, the concept of 'level', borrowed directly from logging systems, may not be suitable for minitrace.

Will minitrace support OpenTelemetry feature 'X'?

minitrace is focused on high performance tracing only. You can open an issue for the missing tracing features you want to have.

Note that we always prioritize performance over features, so that not all tracing feature requests may be accepted.

What's the status of this library?

API Unstable: The API is not stabilized yet, may be changed in the future.

Code base Tested: minitrace has been tested with high coverage. However, applications utilizing minitrace have not been widely deployed, so that minitrace is currently NOT regarded as battle-tested.

More Repositories

1

tikv

Distributed transactional key-value database, originally created to complement TiDB
Rust
15,068
star
2

raft-rs

Raft distributed consensus algorithm implemented in Rust.
Rust
2,916
star
3

grpc-rs

The gRPC library for Rust built on C Core library and futures
Rust
1,801
star
4

pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Rust
1,299
star
5

rust-prometheus

Prometheus instrumentation library for Rust applications
Rust
1,056
star
6

pd

Placement driver for TiKV
Go
1,041
star
7

agatedb

A persistent key-value storage in rust.
Rust
829
star
8

raft-engine

A persistent storage engine for Multi-Raft log
Rust
547
star
9

titan

A RocksDB plugin for key-value separation, inspired by WiscKey.
C++
485
star
10

client-rust

Rust Client for TiKV.
Rust
388
star
11

fail-rs

Fail points for rust
Rust
333
star
12

client-go

Go client for TiKV
Go
279
star
13

minstant

Performant time measuring in Rust
Rust
170
star
14

yatp

Yet another thread pool in rust for both callbacks or futures.
Rust
134
star
15

client-java

TiKV Java Client
Java
111
star
16

deep-dive-tikv

How do we build a distributed, transactional key-value database - TiKV?
HTML
97
star
17

rfcs

RFCs for changes to TiKV and its ecosystem
78
star
18

auto-tikv

Tool to tune TiKV with ML method
Python
67
star
19

sig-transaction

Resources for the transaction SIG
63
star
20

async-speed-limit

Asynchronously speed-limiting multiple byte streams
Rust
57
star
21

minitrace-go

A high-performance timeline tracing library for Golang, used by TiDB
Go
45
star
22

crc64fast

SIMD accelerated CRC-64-ECMA computation
Rust
43
star
23

community

TiKV community content
43
star
24

client-c

The C++ TiKV client used by TiFlash.
C++
40
star
25

migration

Migration tools for TiKV, e.g. online bulk load.
Go
35
star
26

tikv-dev-guide

The TiKV development/contribution guide
34
star
27

client-py

Rust
27
star
28

importer

tikv-importer is a front-end to help ingesting large number of KV pairs into a TiKV cluster
Rust
20
star
29

website

Website for tikv.org
HTML
19
star
30

tikv-operator

Go
19
star
31

protobuf-build

Rust
17
star
32

client-cpp

TiKV Client for C++
Rust
14
star
33

client-node

Rust
11
star
34

mur3

Rust implementation of MurmurHash3.
Rust
11
star
35

copr-test

Go
10
star
36

mock-tikv

A mocked TiKV server for testing clients that written in different languages.
Go
6
star
37

jepsen-test

Clojure
6
star
38

slog-global

Global loggers for slog-rs. Similar to slog-scope but more simple.
Rust
5
star
39

match-template

match-template is a procedural macro that generates repeated match arms by pattern.
Rust
5
star
40

terraform-tikv-bench

An Orcestrated TiKV benchmark. Not for production deployment.
HCL
4
star
41

skiplist-rs

Rust
4
star
42

client-validator

Provide functional checks for tikv client implementations in different languages.
Go
3
star
43

tracing-active-tree

Rust
3
star
44

tlaplus-specs

TiKV TLA+ specifications
TLA
3
star