gregors

gregors

Bandit keep alives not working in apache bench

Question y’all,

When I play with apache bench (ab) and I use the -k flag the output for the runs have this

Keep-Alive requests:    0

However if I try Cowboy for example it seems to report correctly

Keep-Alive requests:    15000   

as well as being a bit faster (due to reused connections no doubt). I tried this with a few other languages, golang etc and they seemed to handled keep alives with ab.

Now I did an initial search through Bandit docs but I’m not seeing any settings pertaining to this. I did see a small blurb saying it was supported in http/1.1. Ok hmmmmmmmmmm.

What exactly is ab pushing out? Let’s spin up tcdump

sudo tcpdump -i any -A 'port 4000'
GET /health-check HTTP/1.0                                                                                                               
Connection: Keep-Alive                                                                                                                           
Host: 127.0.0.1:4000                                                                                                                             
User-Agent: ApacheBench/2.3                                                                                                                      
Accept: */*          

huh http/1.0 so I’m guessing Bandit just doesn’t support keep alives in that version. I don’t know exactly what the difference is, I should probably read the http spec at some point, but I am asking if there’s an easy way I can configure Bandit to support that. No problem if there isn’t an easy way. I’m just having fun. But it does look like other servers do support this…probably for ab use cases :smiley:

Marked As Solved

mtrudel

mtrudel

Creator of Bandit

Thanks for the PR; it’s merged!

I’ll echo what others have said here; ab is in general a pretty outdated program that does a lot of oddball stuff like this (IIRC, this was actually strictly out of spec prior to the RFC911x series).

Also Liked

LostKobrakai

LostKobrakai

A quick google suggests keep-alive wasn’t officially supported before http 1.1, but was added as a response to people using it with http 1.0 without a spec for it existing. So it’s a question of how spec compliant bandit wants to be. A toggle might be a reasonable middleground.

gregors

gregors

Update after some weekend time to dig into this…

Where Next?

Popular in Questions Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2, I would like to get: ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43487 311
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement