p99.Ruby
Low-cost generation of performance percentiles (p50, p90, p99, p99.9, etc.), for Ruby
Table of Contents
- Introduction
- Installation
- Components
P99::Histogram
- Examples
- Project Information
- Where to get help
- Contribution guidelines
- Dependencies
- Development Dependencies
- Related projects
- License
Introduction
p99 is a lightweight, low-overhead library designed for generating real-time performance percentiles in high-frequency or latency-sensitive environments.
p99.Ruby is the Ruby implementation.
Installation
Install via gem as in:
gem install p99-ruby
or add it to your Gemfile.
Use via require, as in:
require 'p99'Components
P99::Histogram
Low-cost, fixed-size histogram for recording event durations (nanoseconds and common larger units) and querying high-resolution percentiles (p50, p90, p99, and beyond).
This release provides a pure-Ruby implementation. A C-extension backend (with automatic fallback) is planned.
See the Histogram component guide for loading, recording, statistics, percentile, and backend details. The generated API reference provides the complete source-level method documentation.
The task-oriented guides provide practical workflows for recording and reading percentiles.
require 'p99'
h = P99::Histogram.new
h.push_event_time_ns(150)
h.push_event_time_us(5)
h.push_event_time_ms(10)
h.event_count # => 3
h.value_at_p99 # => approximated duration in nanoseconds
P99::IMPLEMENTATION # => "ruby" (or "c" when a native backend is present)Force the pure-Ruby backend (for debugging or CI):
P99_PURE_RUBY=1 ruby -e "require 'p99'; puts P99::IMPLEMENTATION"Examples
See EXAMPLES.md for the full list. The primary demonstration is build_histogram:
ruby examples/build_histogram.rb
P99_TRIES=1000 ruby examples/build_histogram.rbProject Information
Where to get help
Contribution guidelines
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/p99.Ruby.
Dependencies
- <none>
Development Dependencies
Related projects
License
p99.Ruby is released under the 3-clause BSD license. See LICENSE for details.