diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-02-11 10:12:57 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-02-18 08:19:01 +0300 |
commit | 514c899275a32e6ef63305f9424c50344d41b12e (patch) | |
tree | ac6be2ed464506378e1d8ccd20439677c89c9896 /lib/mix/tasks/pleroma/benchmark.ex | |
parent | 962eb8d4ac1aafeed6e3ae9b17847b9afaec7712 (diff) | |
download | pleroma-514c899275a32e6ef63305f9424c50344d41b12e.tar.gz |
adding gun adapter
Diffstat (limited to 'lib/mix/tasks/pleroma/benchmark.ex')
-rw-r--r-- | lib/mix/tasks/pleroma/benchmark.ex | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/benchmark.ex b/lib/mix/tasks/pleroma/benchmark.ex index 84dccf7f3..01e079136 100644 --- a/lib/mix/tasks/pleroma/benchmark.ex +++ b/lib/mix/tasks/pleroma/benchmark.ex @@ -74,4 +74,43 @@ defmodule Mix.Tasks.Pleroma.Benchmark do inputs: inputs ) end + + def run(["adapters"]) do + start_pleroma() + + :ok = + Pleroma.Pool.Connections.open_conn( + "https://httpbin.org/stream-bytes/1500", + :gun_connections + ) + + Process.sleep(1_500) + + Benchee.run( + %{ + "Without conn and without pool" => fn -> + {:ok, %Tesla.Env{}} = + Pleroma.HTTP.get("https://httpbin.org/stream-bytes/1500", [], + adapter: [pool: :no_pool, receive_conn: false] + ) + end, + "Without conn and with pool" => fn -> + {:ok, %Tesla.Env{}} = + Pleroma.HTTP.get("https://httpbin.org/stream-bytes/1500", [], + adapter: [receive_conn: false] + ) + end, + "With reused conn and without pool" => fn -> + {:ok, %Tesla.Env{}} = + Pleroma.HTTP.get("https://httpbin.org/stream-bytes/1500", [], + adapter: [pool: :no_pool] + ) + end, + "With reused conn and with pool" => fn -> + {:ok, %Tesla.Env{}} = Pleroma.HTTP.get("https://httpbin.org/stream-bytes/1500") + end + }, + parallel: 10 + ) + end end |