I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.
| Framework | Throughput (req/s) | Latency (ms) | Consistency (σ ms) |
|---|
I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.
| Framework | Throughput (req/s) | Latency (ms) | Consistency (σ ms) |
|---|
| defmodule SomeModule do | |
| def start(host, options) do | |
| # We are assuming SomeSup has been already started somewhere | |
| # (ideally in a supervision tree). | |
| {:ok, child_pid} = SomeSup.attach_to(SomeSup, host, options) | |
| end | |
| end | |
| defmodule SomeSup do | |
| use Supervisor |
| defmodule Exq.RouterPlug do | |
| import Plug.Conn | |
| use Plug.Router | |
| plug :match | |
| plug :dispatch | |
| get "/queues" do | |
| IO.puts "YOLO" | |
| conn |> halt() |
| defmodule FibAgent do | |
| def start_link do | |
| cache = Enum.into([{0, 0}, {1, 1}], HashDict.new) | |
| Agent.start_link(fn -> cache end) | |
| end | |
| def fib(pid, n) when n >= 0 do | |
| Agent.get_and_update(pid, &do_fib(&1, n)) | |
| end | |
| % from my unit tests | |
| foo = 10 | |
| assert 10 == my_macro(:foo) | |
| assert 10 == my_macro("foo") | |
| % macro | |
| defmacro my_macro(some_var) when is_atom(some_var) do |
| defmodule Dict.Behaviour do | |
| # It is assumed that the client module implements following functions: | |
| # | |
| # size/1, fetch/2, put/3, reduce/3, update/4, delete/2 | |
| # | |
| defmacro __using__(_) do | |
| quote do | |
| # Following are exact copies of HashDict: | |
| def get(dict, key, default // nil) do |
| defmodule ExCoder do | |
| vars = [ { "	", " " }, | |
| { "!", "!" }, | |
| { "" "", "\"" }, | |
| { "#", "#" }, | |
| { "$", "$" }, | |
| { "%", "%" }, | |
| { "& &", "&" }, | |
| { "'", "'" }, | |
| { "(", "(" }, |
| def next_state do | |
| (board, x, y) -> | |
| cell = cell_at(board, x, y) | |
| live_count = live_neighbors(board, x, y) | |
| next_state(cell, live_count) | |
| (_, x, y) when (x < 0 or y < 0) -> | |
| "." | |
| end | |
| def next_state do |
| def zip(a, b) do | |
| list = to_list(a) | |
| throw do | |
| { zipped, rest } = Reducers.reduce(b, { [], list }, fn | |
| entry, { acc, [h|t] } -> { [{entry, h}|acc], t } | |
| entry, { acc, [] } -> throw { :enum_zip, acc } | |
| end) | |
| :lists.foldl(fn(x, acc) -> |