1

I am using ibrowse to make POST and GET requests to the external server but I have issues when it comes to supporting frequent and simultaneous requests.

I start ibrowse with default settings:

application:start(ibrowse).

Then I use ibrowse to carry out POST requests:

ibrowse:send_req("http://somelink.com/api/capi/send.php?" ++ Data,[],get,[]).   

or:

ibrowse:send_req("http://somelink.com/cgi-bin/send",[{"Content-Type", "application/x-www-form-urlencoded"}],post,Data).

When I call that function, it succeeds on the first try with this result:

 [{http_code,"202"},
  {http_headers,[{"Server","CCSRouter/0.1"},
                 {"Content-Length","34"},
                 {"Content-type","text/html"},
                 {"Pragma","no-cache"},
                 {"Cache-Control","no-cache"}]},
  {result,"status=1"}],

But when I call the function repeatedly, it fails returning the following error:

{error,{conn_failed,{error,econnrefused}}}

How can I ensure that whenever I make high frequency connections with ibrowse, it succeeds?

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
  • 1
    The `econnrefused` is interesting, since that comes from TCP. Are you sure your OS is configured to supply your client process with all the sockets it's trying to use? Any unusual OS-level TCP socket settings for timeouts? Is [`ERL_MAX_PORTS`](https://stackoverflow.com/a/2153809/409228) set high enough? Given that I see `cgi-bin` in your example URL, the server might be spawning a new OS process per request, and if so, are you sure the server can keep up with what you're trying to do? – Steve Vinoski Oct 04 '17 at 22:43
  • 1
    How are these functions used? I thought they were meant to solve this limitation `ibrowse:set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -> ok` and `ibrowse:set_max_sessions(Host::string(), Port::integer(), Max::integer()) -> ok` – Vianney Sserwanga Oct 05 '17 at 07:03

0 Answers0