Skip to content

Commit

Permalink
Initial implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Jan 28, 2018
1 parent d75e79e commit ca4b804
Show file tree
Hide file tree
Showing 49 changed files with 5,730 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
/test/tmp/
/test/version_tmp/
/tmp/
\#*\#
.\#*
*~
*.o
*.so
Makefile
*.bundle
.rbenv-version
.ruby-version
Gemfile.lock

# Used by dotenv library to load environment variables.
# .env
Expand Down Expand Up @@ -48,3 +58,5 @@ build-iPhoneSimulator/

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

test/log
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
os:
- linux
- osx

sudo: false
env:
global:
- MAKE="make -j 2"

language: ruby
rvm:
- 2.4.2
- 2.5.0
- ruby-head

script:
- ./test/tests.rb
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

### 0.9.0 - 2018-01-28

Initial release.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gemspec
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Peter Ohler
Copyright (c) 2018 Peter Ohler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,61 @@
# hayai
An HTTP Server for Ruby
# agoo

[![Build Status](https://img.shields.io/travis/ohler55/agoo/master.svg)](http://travis-ci.org/ohler55/agoo?branch=master)

A High Performance HTTP Server for Ruby

## Usage

```ruby
require 'agoo'

server = Agoo::Server.new(6464, 'root')

class MyHandler
def initialize
end

def call(req)
[ 200, { }, [ "hello world" ] ]
end
end

handler = TellMeHandler.new
server.handle(:GET, "/hello", handler)
server.start()
```

## Installation
```
gem install agoo
```

## What Is This?

Agoo is Japanese for a type of flying fish. This gem flies. It is a high
performance HTTP server that serves static resource at hundreds of thousands
of fetchs per second. A a simple hello world Ruby handler at over 100,000
requests per second on a desktop computer. That places Agoo at about 80 times
faster than Sinatra and 1000 times faster than Rails. In both cases the
latency was an order of magnitude lower or more. Checkout the benchmarks on <a
href="http://opo.technology/benchmarks.html#web_benchmarks">OpO
benchmarks</a>. Note that the benchmarks had to use a C program called _hose_
from the <a href="http://opo.technology/index.html">OpO</a> downloads to hit
the Agoo limits. Ruby benchmarks driver could not push Agoo hard enough.

Agoo supports the [Ruby rack API](https://rack.github.io) which allows for the
use of rack compatible gems.

## Releases

See [{file:CHANGELOG.md}](CHANGELOG.md)

## Links

- *Documentation*: http://rubydoc.info/gems/agoo

- *GitHub* *repo*: https://github.com/ohler55/agoo

- *RubyGems* *repo*: https://rubygems.org/gems/agoo

Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announcements and news about the Agoo gem.
31 changes: 31 additions & 0 deletions agoo.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

require 'date'
require File.join(File.dirname(__FILE__), 'lib/agoo/version')

Gem::Specification.new do |s|
s.name = "agoo"
s.version = Agoo::VERSION
s.authors = "Peter Ohler"
s.date = Date.today.to_s
s.email = "[email protected]"
s.homepage = "http://www.ohler.com/agoo"
s.summary = "An HTTP server"
s.description = "A fast HTTP server supporting rack."
s.licenses = ['MIT']
s.required_ruby_version = ">= 2.0"

s.files = Dir["{lib,ext,test}/**/*.{rb,h,c}"] + ['LICENSE', 'README.md']
s.test_files = Dir["test/**/*.rb"]
s.extensions = ["ext/agoo/extconf.rb"]

s.has_rdoc = true
s.extra_rdoc_files = ['README.md'] + Dir["pages/*.md"]
s.rdoc_options = ['-t', 'Agoo', '-m', 'README.md', '-x', 'test/*']

s.rubyforge_project = 'agoo'

s.add_development_dependency 'rake-compiler', '>= 0.9', '< 2.0'
s.add_development_dependency 'minitest', '~> 5'
s.add_development_dependency 'test-unit', '~> 3.0'
s.add_development_dependency 'wwtd', '~> 0'
end
19 changes: 19 additions & 0 deletions ext/agoo/agoo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2018, Peter Ohler, All rights reserved.

#include <stdio.h>
#include <ruby.h>

#include "error_stream.h"
#include "request.h"
#include "response.h"
#include "server.h"

void
Init_agoo() {
VALUE mod = rb_define_module("Agoo");

error_stream_init(mod);
request_init(mod);
response_init(mod);
server_init(mod);
}
Loading

0 comments on commit ca4b804

Please sign in to comment.