There was a post made quite a while back regarding the first two, which made mention of Tesla:
I originally started using HTTPoison, but have recently realised it is plagued with timeouts. It became such a problem for some that someone developed an extension to retry (as that seemed to solve most of the problems):
Issue which mentions changing version of Hackney helped:
Has anybody else experienced these issues with HTTPoison? I will be making around 300 concurrent requests/second (to start), and so want to reduce failure build-up as much as possible.
Tesla appears to have retry middleware built into it, and the ability to switch the adaptor (httpc, ibrowse, hackney).
I know the only real answer is to test each of these libraries under load, but I’d be interested to hear if anyone has run into any of the issues mentioned above. I can’t seem to find any information on why these timeouts sporadically happen. Don’t know if it’s the library or the adaptor or some lower-level processing.
As an aside - are there other options to increase the reliability? Perhaps using the adaptors directly? Or offloading the work to a more battle-tested library in another language?
If you are making requests to servers running nginx (or any other sane web server), then you should be okay, I think. I’ve used buoy to interface with google cloud storage api and it worked well.
The requests could be going to any server, it’s not an internal tool. Hmm… cheers, I’ll think it over a little more. Looking at the benchmarks, there was a 0% failure rate in almost all cases, including with Hackney. Makes me think something else is up - they are using 256gb ram. One of the causes of the random timeouts in Hackney was something to do with how it was managing internal queues. So could be a memory issue.
I think I’ll have to load test these libs myself. I think that’s the only way I can be sure.
I have used HTTPoison in my production server and I am too plagued with unknown intermittent timeout issues even though I am already running the latest hackney. @BitGonzo Just wondering which library you go for in the end?
Sounds like a Hackney issue. I’ve been using Tesla and the default adaptor (httpc) and not had any problems. Have wrapped all of my requests so that I can switch out the library if it becomes a problem in the future.
I almost always start out with httpc which is built right into erlang. The api is kind of eh because it’s built for Erlang instead of Elixir, but it has never done me wrong.
At least in recent versions, when passing in verify: :verify_peer and a trust store (e.g. from the certifi package) both chain validation and hostname verification work out-of-the-box:
(There are some known issues with cross-signed and wildcard certs, though; I would recommend using the ssl_verify_fun package for maximum server compatibility)
Edit: the above testing was done with Erlang/OTP 21 (inets 7.0)
I am suspecting its hackney issue too, but I really like HTTPoison default ssl options and connection pooling (hackney) but the timeout issue is really a dealbreaker. httpc also seemed to be slower for me as well as my use case require me to have concurrent TCP connections.
Dude this is amazing, I love you. I have a project now where I need 300-400 requests per second and I’m having dififulty because they dont support http1.1. This should help a lot I think.