How to increase Phoenix concurrent http connection count?

Hi!!

I tried to test the Phoenix HTTP concurrent connection counts.

Below is the Phoenix Controller

defmodule PTestWeb.PageController do
  use PTestWeb, :controller
  require Logger

  def index(conn, _params) do
  	Logger.info "Controller : pid => #{inspect self()}"

  	Process.sleep 10_000   # <------ make the controller process wait here long time.. 
    text conn, "[OK]"
  end
end

And I tested it with “http poison” client in another terminal with the code below.

for x <- 1..100, do: spawn(fn -> HTTPoison.get("localhost:4000",[],[recv_timeout: 11_000]) |> IO.inspect  end)

The client terminal result is below…

[#PID<0.515.0>, #PID<0.516.0>, #PID<0.517.0>, #PID<0.518.0>, #PID<0.519.0>,
 #PID<0.520.0>, #PID<0.521.0>, #PID<0.522.0>, #PID<0.523.0>, #PID<0.524.0>,
 ...
...
 #PID<0.555.0>, #PID<0.556.0>, #PID<0.557.0>, #PID<0.558.0>, #PID<0.559.0>,
 #PID<0.560.0>, #PID<0.561.0>, #PID<0.562.0>, #PID<0.563.0>, #PID<0.564.0>, ...]
{:error, %HTTPoison.Error{id: nil, reason: :connect_timeout}}
{:error, %HTTPoison.Error{id: nil, reason: :connect_timeout}}
...
...
{:error, %HTTPoison.Error{id: nil, reason: :connect_timeout}}
{:error, %HTTPoison.Error{id: nil, reason: :connect_timeout}}
{:ok,
 %HTTPoison.Response{
   body: "[OK]",
   headers: [
     {"server", "Cowboy"},
     {"date", "Fri, 07 Sep 2018 14:10:09 GMT"},
     {"content-length", "4"},
     {"content-type", "text/plain; charset=utf-8"},
     {"cache-control", "max-age=0, private, must-revalidate"},
     {"x-frame-options", "SAMEORIGIN"},
     {"x-xss-protection", "1; mode=block"},
     {"x-content-type-options", "nosniff"},
     {"x-download-options", "noopen"},
     {"x-permitted-cross-domain-policies", "none"}
   ],
   request_url: "http://localhost:4000",
   status_code: 200
 }}
{:ok,
 %HTTPoison.Response{
   body: "[OK]",
   headers: [
     {"server", "Cowboy"},
     {"date", "Fri, 07 Sep 2018 14:10:09 GMT"},
     {"content-length", "4"},
     {"content-type", "text/plain; charset=utf-8"},
     {"cache-control", "max-age=0, private, must-revalidate"},
     {"x-frame-options", "SAMEORIGIN"},
     {"x-xss-protection", "1; mode=block"},
     {"x-content-type-options", "nosniff"},
     {"x-download-options", "noopen"},
     {"x-permitted-cross-domain-policies", "none"}
   ],
   request_url: "http://localhost:4000",
   status_code: 200
 }}
.
.
.

------------------------- And , below is Phoenix controller log prints
the Logger print out is …

[info] Controller : pid => #PID<0.444.0>


[info] Controller : pid => #PID<0.445.0> : total 50 lines of log…


It seems , only the first 50 connections is connected successfully.

Can I increase the concurrent connection count ? (Poolboy count of Cowboy…??)

I tried to change the cowboy configuration, but fail to find…

Thanks,

HTTPoison uses a pool of connections to the same host, have you tried increasing the maximum connections in the pool?

Thanks,

It was not the Phoenix concurrent connection limit… ^^

My client test code using HTTPPoison was incorrect…
(Changing HTTPoison pool make more connections to Phoenix…)

Thanks again