diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-04-02 14:47:17 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-04-02 14:47:17 +0300 |
commit | dbcfac11b45b367185a3b18a2db3e3fb07e8f20d (patch) | |
tree | 039254a94616f04f4ea00e893bf0fb66dc06d9e8 /lib/mix/tasks/pleroma/benchmark.ex | |
parent | dfd2c741849e9afaf35e3ddbecbb50feb47f5d22 (diff) | |
parent | fd932b14a7e7335a91a2acc2d6dd6fba7e2e90b3 (diff) | |
download | pleroma-dbcfac11b45b367185a3b18a2db3e3fb07e8f20d.tar.gz |
Merge branch 'develop' into issue/1276
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 a4885b70c..dd2b9c8f2 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.Gun.Conn.open( + "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 |