Module: Hyperion
- Defined in:
- lib/hyperion.rb,
lib/hyperion/cli.rb,
lib/hyperion/tls.rb,
lib/hyperion/pool.rb,
lib/hyperion/config.rb,
lib/hyperion/logger.rb,
lib/hyperion/master.rb,
lib/hyperion/parser.rb,
lib/hyperion/server.rb,
lib/hyperion/worker.rb,
lib/hyperion/metrics.rb,
lib/hyperion/request.rb,
lib/hyperion/version.rb,
lib/hyperion/connection.rb,
lib/hyperion/fiber_local.rb,
lib/hyperion/thread_pool.rb,
lib/hyperion/adapter/rack.rb,
lib/hyperion/http2_handler.rb,
lib/hyperion/worker_health.rb,
lib/hyperion/response_writer.rb,
lib/hyperion/admin_middleware.rb
Defined Under Namespace
Modules: Adapter, FiberLocal, TLS, WorkerHealth Classes: AdminMiddleware, CLI, CParser, Config, Connection, Error, Http2Handler, Logger, Master, Metrics, ParseError, Parser, Pool, Request, ResponseWriter, Server, ThreadPool, UnsupportedError, Worker
Constant Summary collapse
- VERSION =
'1.1.0'
Class Attribute Summary collapse
-
.log_requests ⇒ Object
writeonly
Sets the attribute log_requests.
- .logger ⇒ Object
Class Method Summary collapse
-
.c_parser_available? ⇒ Boolean
Whether the llhttp C extension loaded.
-
.log_requests? ⇒ Boolean
Per-request access logging is ON by default — matches Puma/Rails operator expectations (Rails::Rack::Logger emits one line per request out of the box).
- .metrics ⇒ Object
- .stats ⇒ Object
-
.yjit_enabled? ⇒ Boolean
Whether YJIT is currently enabled in this Ruby process.
Class Attribute Details
.log_requests=(value) ⇒ Object (writeonly)
Sets the attribute log_requests
18 19 20 |
# File 'lib/hyperion.rb', line 18 def log_requests=(value) @log_requests = value end |
Class Method Details
.c_parser_available? ⇒ Boolean
Whether the llhttp C extension loaded. False on JRuby/TruffleRuby and any environment where extconf.rb / make failed at install time. The pure-Ruby parser handles those cases correctly but is ~2× slower on parse-heavy workloads. Operators running production should confirm this returns true; CLI emits a startup banner if it doesn’t.
41 42 43 |
# File 'lib/hyperion.rb', line 41 def c_parser_available? defined?(::Hyperion::CParser) && ::Hyperion::CParser.respond_to?(:build_response_head) end |
.log_requests? ⇒ Boolean
Per-request access logging is ON by default — matches Puma/Rails operator expectations (Rails::Rack::Logger emits one line per request out of the box). Operators can disable it via ‘–no-log-requests`, `HYPERION_LOG_REQUESTS=0|false|no|off`, or programmatically via `Hyperion.log_requests = false`. When false, Connection skips ALL access-log work — no Process.clock_gettime, no hash build, nothing.
The hot path uses Logger#access (single-interpolation line build, per-thread cached timestamp, lock-free emit) so default-ON throughput stays well above Puma’s default-OFF baseline.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/hyperion.rb', line 55 def log_requests? return @log_requests unless @log_requests.nil? env = ENV['HYPERION_LOG_REQUESTS']&.downcase @log_requests = case env when '0', 'false', 'no', 'off' then false when '1', 'true', 'yes', 'on' then true else true # default ON end end |
.metrics ⇒ Object
20 21 22 |
# File 'lib/hyperion.rb', line 20 def metrics @metrics ||= Metrics.new end |
.stats ⇒ Object
24 25 26 |
# File 'lib/hyperion.rb', line 24 def stats metrics.snapshot end |
.yjit_enabled? ⇒ Boolean
Whether YJIT is currently enabled in this Ruby process. False on Rubies that don’t ship YJIT (JRuby, TruffleRuby) and on CRuby builds compiled without YJIT support. Cheap (no allocations) — safe to call from hot paths if needed for diagnostics.
32 33 34 |
# File 'lib/hyperion.rb', line 32 def yjit_enabled? defined?(::RubyVM::YJIT) && ::RubyVM::YJIT.enabled? end |