GithubHelp home page GithubHelp logo

aloha's Introduction

Aloha is a webserver, implemented using Netty and Clojure.

(use 'aloha.core)

(start-http-server
  (fn [request]
    {:status 200
	 :headers {:content-type "text/plain"}
	 :body "Aloha!\n"})
  {:port 8080})

Aloha is a reference implementation of a Clojure/Netty webserver, or basically Aleph without any extraneous fluff. It exists as a reminder that Aleph could be faster, but also as a very fast, fully functional webserver in its own right.

You can use Aloha in your own project by adding this to your project.clj:

[aloha "1.0.1"]

Since much of Aloha's existence will be spent returning a single string over and over again, it's easy to start up a server for benchmarking.

$  lein run &
Server listening on port 8080.
$  curl localhost:8080
Aloha!

If you have any ideas on how to improve Aloha's performance, please send a pull request.

Benchmarking

In OS X

$  sudo sysctl -w net.inet.tcp.msl=1000
net.inet.tcp.msl: 15000 -> 1000
$  httperf --num-conns=16 --rate=16 --num-calls=100000 --port=8080
...

If you don't have httperf installed, try brew install httperf or port install httperf. If neither of those work, consider installing Homebrew.

If you want to be contrary and use ab instead, be aware that the ApacheBench binary is broken on OS X Lion. You can fix it following these instructions.

In Linux

$  echo 1 | sudo tee /proc/sys/net/ipv4/tcp_tw_reuse
1
$  httperf --num-conns=16 --rate=16 --num-calls=100000 --port=8080
...

If you don't have httperf installed, use your package manager of choice to install it.

aloha's People

Contributors

mpenet avatar ztellman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.