Skip to content

Instantly share code, notes, and snippets.

Michael mmmries

Block or report user

Report or block mmmries

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mmmries /
Last active Jan 1, 2019
Gnat Request Benchmark

I wanted to run another round of performance benchmarks for gnat to see how it's request throughput has changed with the introduction of the ConsumerSupervisor which handles things like processing each request in its own supervised process.

I used a CPU-optimized digital ocean droplet with 16 cores, gnatsd 1.3.0, erlang 21.2.2 and elixir 1.8.0.rc0 You can read the setup instructions below for more details and the contains details about a lot of different runs.

I'm trying to measure the overhead in the system, so the requests are random byte strings that just get echoed back with processing. The measurements use byte strings of 4 bytes up to 1024 bytes.

TL/DR; You can do 170k+ synchronous requests/sec of small messages or 192MB+/sec of 1kb messages

  • Testing
    • mocking hardware
    • what is worth testing?
  • Dev environment vs firmware
  • Sensors:
    • Moisture Sensors
    • Temperator Sensors
    • Magnetic Sensors
  • Touch Screen
    • Carry the touch screen from device-to-device
mmmries /
Created Jun 7, 2018
A "Plug-ish" approach to flexible shared behavior

The main idea here is compose shared functionality into a pipeline of functions that all implement some shared behaviour.

defmodule Notification.Event do
  # The event (probably a bad name) is where you would put the structified JSON event you got from RabbitMQ
  defstruct [:sent_at, :user, :event]

defmodule Notification.Plug do
  @callback init(opts) :: opts
mmmries / language_job_postings.csv
Last active Mar 19, 2018
Language Job Postings
View language_job_postings.csv
type language postings stackoverflow postings
functional erlang 199 12
functional elixir 293 33
functional clojure 429 56
functional haskell 356 17
functional f# 126 10
functional akka 532 31
functional functional reactive programming 810 899
both scala 5260 189
both javascript 33347 1201
View benchmark_roundtrips.exs
defmodule LatencyBenchmark do
@default_settings %{
num_actors: 1,
actions_per_actor: 1,
def benchmark(action_fn, settings) do # = num_actors, actions_per_actor, setup_fn, action_fn) do
settings = Map.merge(@default_settings, %{setup_fn: fn -> %{} end}) |> Map.merge(settings)
settings = Map.put(settings, :action_fn, action_fn)
{:ok, collector_pid} = Agent.start_link(fn -> [] end)
mmmries /
Last active Jan 25, 2019
Load Test Phoenix Presence

Phoenix Nodes

First I created 3 droplets on digital ocean with 4-cores and 8GB of RAM. Login as root to each and run:

sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
mmmries /
Last active Aug 10, 2017
protobuf benchmarking

Protobuf Benchmarking

A really basic protobuf benchmark comparing the protobuf encoding/decoding performance. For details please see the benchmark.rb file in this gist and check the gpb benchmark files.

Latest Results

  • protobuf-3.6.12
  • gpb-3.26.6
mmmries / quick_benchmark.exs
Created Feb 28, 2017
Quick benchmark tool for Elixir
View quick_benchmark.exs
quick_benchmark = fn(tcfn, tcn) ->
tc_l = :lists.seq(1,tcn) |>> tcfn |> |> elem(0) end)
tc_min = :lists.min(tc_l)
tc_max = :lists.max(tc_l)
tc_med = :lists.nth(round((tcn - 1) / 2), :lists.sort(tc_l))
tc_avg = round(Enum.sum(tc_l) / tcn)
%{min: tc_min, max: tc_max, median: tc_med, average: tc_avg}
# quick_benchmark.(fn() -> do_some_work() end, 1000) will do 1000 iterations of work and report median, average, min and max back to you in microseconds

Keybase proof

I hereby claim:

  • I am mmmries on github.
  • I am mmmries ( on keybase.
  • I have a public key whose fingerprint is 99B1 CC8A FE86 779F 3F7C 3D80 DA6C FBE7 2629 D9CF

To claim this, I am signing this object:

mmmries / benchmarks.ex
Last active Oct 8, 2016
Benchmarking lbm_kv
View benchmarks.ex
defmodule Benchmarks do
def init do
:ok = :lbm_kv.create(Web.Job)
def count_entries do
IO.puts "Web.Job => #{:lbm_kv.match_key(Web.Job, :_) |> elem(1) |> Enum.count}"
def measure_throughput(fun, num_items) do
You can’t perform that action at this time.