Skip to content

jodosha/mruby-rack-json-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON API Apps w/ MRuby + Rack + Redis + H2O

This is a demo repository to show how to build and distribute really fast JSON API apps with MRuby, Rack, Redis and H2O.

Explanation

For a full explanation of how this works, please read this article: 25,000+ Req/s for Rack JSON API with MRuby.

Prerequisites

  • gcc
  • cmake
  • wrk (for benchmarks)
  • Redis

Setup

➜ git clone https://github.com/jodosha/mruby-rack-json-api.git
➜ cd mruby-json-api
➜ bin/setup

Start

➜ bin/server

This will start Redis and H2O.

There are two endpoints available:

Benchmarks

➜ bin/bench
Measuring /hardcoded
Running 10s test @ http://localhost:8080/hardcoded/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    81.22us   52.65us   4.46ms   92.27%
    Req/Sec    61.04k     8.37k   69.33k    75.74%
  1226358 requests in 10.10s, 163.74MB read
Requests/sec: 121419.22
Transfer/sec:     16.21MB

Measuring /json_api
Running 10s test @ http://localhost:8080/json_api/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   389.09us  328.37us   9.64ms   93.09%
    Req/Sec    14.24k     2.54k   18.09k    76.24%
  286091 requests in 10.10s, 55.11MB read
Requests/sec:  28326.73
Transfer/sec:      5.46MB

Yes — 28,000+ requests per second!!

Copyright

© 2015 ‐ Luca Guidi — Released under MIT License

About

Really Fast JSON API app with Mruby, Rack, Redis and H2O

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published