Project

ritsudo

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
CLI bnechmark tool based on headless chrome. Also measure ajax requests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
>= 0
~> 10.0
~> 3.0

Runtime

 Project Readme

Ritsudo

CLI bnechmark tool based on headless chrome. Also measure ajax requests.

Installation

install it yourself as:

$ gem install ritsudo

Usage

CLI

ritsudo -a https://example.com -m "example.com" -u "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1"

Ruby

#!/usr/bin/env ruby
require "bundler/setup"
require "ritsudo"

ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1"
collector = Ritsudo::Collector.new(match: /example\.com/)
benchmark = Ritsudo::Benchmark.new(collector: collector)
benchmark.do("https:/www.example.com", driver_options: { user_agent: ua })
benchmark.collector.display

Result

Ritsudo requests 5 times: https://example.com
.....
[Misc]
  +------------------+--------+------+-----+-------+-----------+
  | name             | avg    | max  | min | count | outliters |
  +------------------+--------+------+-----+-------+-----------+
  | DomContentLoaded | 858.6  | 921  | 797 | 5     | 0         |
  +------------------+--------+------+-----+-------+-----------+
  | Loaded           | 1235.6 | 1672 | 975 | 5     | 0         |
  +------------------+--------+------+-----+-------+-----------+

[Document]
  +---------------------------+--------+--------+--------+-------+-------------+-----------+
  | url                       | avg    | max    | min    | count | uncompleted | outliters |
  +---------------------------+--------+--------+--------+-------+-------------+-----------+
  | https://www.example.com/  | 597.56 | 858.15 | 433.51 | 5     | 0           | 0         |
  +---------------------------+--------+--------+--------+-------+-------------+-----------+

[XHR]
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+
  | url                                       | avg     | max     | min     | count | uncompleted | outliters |
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+
  | https://www.example.com/xhr_request       | 300.39  | 500.39  | 250.39  | 3     | 1           | 1         |
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+
  | https://www.example.com/slow_xhr_request  | -       | -       | -       | -     | 5           |           |
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+

[Script]
  +--------------------------------+-------+-------+-------+-------+-------------+-----------+
  | url                            | avg   | max   | min   | count | uncompleted | outliters |
  +--------------------------------+-------+-------+-------+-------+-------------+-----------+
  | https//example.com/example.js  | 25.88 | 43.15 | 14.96 | 5     | 0           | 1         |
  +--------------------------------+-------+-------+-------+-------+-------------+-----------+

Set Cookies

ritsudo -a https://example.com/page -m "example.com" -C "hoge=fuga"

Remove outlier

-r option removes outliders outside of (stdev * numeric) value.

ritsudo -a https://example.com/page -m "example.com" -s #{numeric}

Problem

Headless chrome doesn't support to set cookies before access. So, Ritsudo accesses root path(e.g https://example.com) before each benchmark.

License

The gem is available as open source under the terms of the MIT License.