radar / elastic

A thin veneer over HTTPotion that talks to Elastic Search

Home Page:https://hex.pm/packages/elastic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some speed issues

dmarko484 opened this issue · comments

I have an app in JAVA using Elasticsearch queries and when experimenting with Elixir / Phoenix I found some significant performance decrease. The detailed code in Phoenix controller is not significant, it is just simple controller doing one ES call. To compare I used Elastic.HTTP and HTTPotion directly to see difference. Here are results (tested by Apache Benchmark)

a) HTTPotion.get("http://localhost:9200/hon_cz/catalog/_search")
460 req / sec

no failed reuqests

b) Elastic.HTTP.get("http://localhost:9200/hon_cz/catalog/_search")
330 req/sec

Using ElasticHTTP I can even see many failed request:
Complete requests: 1000
Failed requests: 41
(Connect: 0, Receive: 0, Length: 41, Exceptions: 0)

Without any HTTPPotion or Elastic call in controller I can get 1200 req/sec so Phoenix is quite fast ... so just one line of Elastic.HTTPP makes req/sec drop from 1200 to 330, which is significant especially when ES queries say it took 2ms for ES to find data ... ES doesnt seem to be bottleneck here as my former Java code can make 800 req/sec with the same ES call. Any idea whats wrong here?

For curiosity just tested the same Elasticsearch query with HTTPoison (in Phoenix controller, just the same way as previous tests)

HTTPoison.get("http://localhost:9200/hon_cz/catalog/_search", [], hackney: [pool: :default])

and I'm getting 830 req/sec ... seems to be significant performance increase by just swiching http client library ...

Closing as there's no point keeping open old stale issues.

If you would like this to be fixed, please submit a patch.