Skip to content

relvinarsenio/calyx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

147 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calyx - Rapid VPS Profiler

Calyx is a high-performance, rapid Linux server profiling and benchmarking tool written in Modern C++ (C++23). It is designed to be completely static, memory-safe, and incredibly fast.

Unlike traditional bash scripts that rely on external tools (like awk, sed, or grep), Calyx parses kernel interfaces (/proc, /sys) directly using native C++ system calls for maximum precision and zero overhead.

🔥 Key Features

  • Hardcore Disk I/O Test: Uses O_DIRECT + io_uring (where available) to bypass RAM Cache (Page Cache), measuring true raw disk speed / commit speed.
  • Rapid System Profiling: Instant detection of CPU Model, Cache, Virtualization (Docker/KVM/Hyper-V), and specific RAM/Swap types (ZRAM/ZSwap).
  • Context-Aware Storage Check: Automatically detects the filesystem and capacity of the specific partition where the test is running (supports OverlayFS, Btrfs, Ext4, etc.).
  • Network Speedtest: Native integration with Ookla Speedtest CLI via JSON parsing for accurate Latency, Jitter, and Packet Loss data (impersonating a real browser to avoid blocks).
  • Fully Static Binary: Zero runtime dependencies (Musl-linked) - runs on Linux Kernel 5.x+ with io_uring support distribution (Alpine, Ubuntu, CentOS, Arch, etc.).
  • Modern Tech Stack: Built with C++23 (std::print, std::expected) and utilizes io_uring for asynchronous I/O.

🧠 Understanding ZSwap Metrics

Calyx provides deep insights into the Linux ZSwap subsystem (when available), identifying memory bottlenecks:

  • Spilled (Written-back): Data that overflowed from ZSwap and was forced onto the disk swap. High values indicate actual RAM exhaustion.
  • Rejected (Reclaim Fail): Data that failed to enter ZSwap because the system couldn't cycle space fast enough. A key indicator of extreme memory pressure.
  • Capped (Pool Limit Hit): Data turned away because the configured max pool size was reached. Suggests the ZSwap limit is too tight for the load.

📦 Quick Start (Pre-built Binary)

Download and run the pre-built static binary - no compilation required:

curl -fsL https://calyx.pages.dev/run | bash

(This script automatically detects your architecture, downloads the latest binary securely to a temporary location, runs the benchmark, and cleans up afterwards.)


🛠️ Build from Source

Requirements

Component Requirement Notes
OS Linux Any distro with Docker support
Kernel 5.x+ 5.10+ required for Disk Benchmark (io_uring)
Docker 20.10+ Required for building static binary

Dependencies (Handled Automatically)

This project is fully reproducible. All dependencies are automatically downloaded and built from source during the Docker build process:

  • zlib (v1.3.1) - Full LTO + -Oz
  • LibreSSL (v4.2.1) - Full LTO + -Oz
  • libcurl (v8.17.0) - Ultra-minimal (HTTP/HTTPS only)
  • nlohmann/json (v3.12.0)

Build with Docker 🐳

The build script will create a fully static binary (~2.7 MB) inside the dist/ folder:

# Clone the repo
git clone https://github.com/relvinarsenio/calyx.git
cd calyx

# Build using Docker
chmod +x build-static.sh
./build-static.sh

# Run the result
./dist/calyx

Build Options

# Normal build (uses cached Docker image if available)
./build-static.sh

# Fresh build (force rebuild dependencies)
./build-static.sh --fresh-build

📊 Example Output

--------------------- Calyx - Rapid VPS Profiler (v7.3.1) ----------------------
 Author             : Alfie Ardinata (https://calyx.pages.dev/)
 GitHub             : https://github.com/relvinarsenio/calyx
 Usage              : ./calyx
--------------------------------------------------------------------------------
 -> CPU & Hardware
 CPU Model            : AMD Ryzen 5 7535HS with Radeon Graphics
 CPU Cores            : 6 @ 4584.2 MHz
 CPU Cache            : 16 MB
 AES-NI               : ✓ Enabled
 Hardware Virt        : ✗ Disabled

 -> System Info
 OS                   : Debian GNU/Linux 13 (trixie)
 Arch                 : x86_64 (64 Bit)
 Kernel               : 6.19.6+deb14-amd64
 TCP CC               : bbr
 Virtualization       : Hyper-V
 System Uptime        : 14 hours, 38 mins
 Load Average         : 1.54, 1.06, 0.97

 -> Storage & Memory
 Test Path            : /home/user/Github/calyx (/dev/sda2 (xfs))
 Size Partition       : 63 GB (25 GB Used)
 Total Mem            : 6.9 GB (4.5 GB Used)
 Total Swap           : 5.2 GB (3.1 GB Used)
   -> Partition        : 4 GB (2.8 GB Used) (/dev/sdb)
   -> ZSwap            : 1.2 GB → 308.1 MB (3.88×) [zstd, limit: 1.4 GB (20%)]
                         Spilled: 10.8 GB  Rejected: 22.1 GB  Capped: 157.1 MB

 -> Network
 IPv4/IPv6            : ✓ Online / ✗ Offline
 ISP                  : AS13335 Cloudflare, Inc.
 Location             : Bandar Lampung / ID
 Region               : Lampung
--------------------------------------------------------------------------------
Running I/O Test (1 GB File)...
  I/O Speed (Run #1)   : Write    440.1 MB/s   Read    385.9 MB/s
  I/O Speed (Run #2)   : Write    390.3 MB/s   Read    392.7 MB/s
  I/O Speed (Run #3)   : Write    389.9 MB/s   Read    385.9 MB/s
  I/O Speed (Average)  : Write    406.8 MB/s   Read    388.2 MB/s
--------------------------------------------------------------------------------
Downloading Speedtest CLI...
 Node Name              Download          Upload            Latency     Loss    
 Speedtest.net (Auto)   66.99 Mbps        21.29 Mbps        47.00 ms    0.00 %  
 Singapore, SG          65.99 Mbps        21.13 Mbps        30.85 ms    0.00 %  
 Los Angeles, US        71.33 Mbps        21.15 Mbps        200.30 ms   0.00 %  
 Montreal, CA           65.52 Mbps        21.02 Mbps        283.15 ms   0.00 %  
 London, UK             71.84 Mbps        20.94 Mbps        278.54 ms   0.00 %  
 Amsterdam, NL          68.61 Mbps        21.16 Mbps        237.72 ms   0.00 %  
 Sydney, AU             69.05 Mbps        20.52 Mbps        123.62 ms   0.33 %  
--------------------------------------------------------------------------------
 Finished in        : 3 min 47 sec


⚖️ License

This project is licensed under the Mozilla Public License 2.0.