Skip to content

Instantly share code, notes, and snippets.

require 'rest-client'
class Reports
def initialize(host, args={})
@host = host
@username = args[:username] || 'exampleuser'
@password = args[:password] || 'examplepass'
@foreman_host = args[:foreman_host] || 'http://foreman.example.com'
end
@sean3z
sean3z / gist:394eefece427debf2ffe31810060cb24
Created February 7, 2017 01:48
AB Benchmark for Rust (via Rocket) - 10,000 request (10 concurrent)
D:\www\apache-2.4.25\bin>ab.exe -n 10000 -c 10 http://localhost:8000/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: rocket
Server Hostname: localhost
Server Port: 8000
@sean3z
sean3z / gist:b6426ed9dae521c4b56948ce2c6062b1
Created February 7, 2017 01:49
AB Benchmark Node.js (via Restify) - 10,000 requests (10 concurrent)
D:\www\apache-2.4.25\bin>ab.exe -n 10000 -c 10 http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software:
Server Hostname: localhost
Server Port: 8080
D:\www\apache-2.4.25\bin>ab -n 10000 -c 10 http://localhost:8000/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@sean3z
sean3z / gist:e06cfd0ebff0231771e8173f44eb5177
Last active February 7, 2017 14:22
AB Benchmark Results Rust (via Rocket) - 10,000 requests (10 concurrent)
D:\www\apache-2.4.25\bin>ab -n 10000 -c 10 http://127.0.0.1:8002/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
[sean:~/rust/rocket-api] $ ab -n 10000 -c 10 http://127.0.0.1:8000/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@sean3z
sean3z / gist:aa88bce0816878afb651277547b51f58
Created February 10, 2017 13:50
wrk Benchmark - Rust (via Rocket) - 2 threads (10 connections)
[sean:~/rust/rocket-api] $ wrk -d1m http://127.0.0.1:8000/
Running 1m test @ http://127.0.0.1:8000/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 106.75us 14.93us 1.92ms 83.38%
Req/Sec 36.25k 8.96k 47.49k 50.08%
4327977 requests in 1.00m, 602.61MB read
Requests/sec: 72133.75
Transfer/sec: 10.04MB
@sean3z
sean3z / gist:9255a421df3389c728d837bd108484a9
Created February 10, 2017 14:01
wrk Benchmark - Node.js (via Restify) - 2 threads (10 connections)
[sean:~/node/restify-api] $ wrk -d1m http://127.0.0.1:8080/
Running 1m test @ http://127.0.0.1:8080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.26ms 322.81us 22.70ms 93.94%
Req/Sec 4.02k 291.35 4.33k 91.08%
479768 requests in 1.00m, 67.26MB read
Requests/sec: 7996.19
Transfer/sec: 1.12MB
@sean3z
sean3z / main.rs
Created April 13, 2017 18:57
Example Rocket Server
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
@sean3z
sean3z / server.js
Created April 13, 2017 18:58
Example Node.js server (Restify)
"use strict";
const restify = require('restify');
const app = restify.createServer();
app.use(restify.queryParser());
app.use(restify.bodyParser());
app.get('/', (req, res, next) => {
res.send('Hello, world!');