the-benchmarker / web-frameworks

Which is the fastest web framework?
MIT License
6.91k stars 641 forks source link

Add Elixir frameworks #2234

Closed Sgiath closed 4 years ago

Sgiath commented 4 years ago

Added frameworks:

I am not 100 % familiar with this project so I tried to replicate settings from other languages/frameworks but I am not sure I did it correctly.

Closes #2197 Closes #1353 Closes #89

waghanza commented 4 years ago

Hi @Sgiath,

Thanks for adding elixir based frameworks in here.

You work is very appreciable :heart:

/cc @essen @josevalim Could you please take a loo at this PR ?

OvermindDL1 commented 4 years ago

@waghanza For note, you might not get responses from them as they are company workers. The licenses already allow for essentially any use.

waghanza commented 4 years ago

@OvermindDL1 yep, I also think that asking for consent is not required ^^

However, it might be interesting to have their, not approval, but advice concerning this PR :stuck_out_tongue: essentially for fine tuning ...

essen commented 4 years ago

Ranch is not a Web framework so I'm not sure what's the point? You're measuring little more than TCP. Cowboy would be more appropriate, see for example https://postimg.cc/ZWM4CVRs for benchmark results for the upcoming version.

@OvermindDL1 Not sure what you mean by company workers, I'm just one guy.

OvermindDL1 commented 4 years ago

@essen Sorry, I was speaking of jose. ^.^

And yeah, just noticed the above was ranch, it should be cowboy tested, cowboy is the actual web server, ranch is used by cowboy for the tcp connector.

Plus both cowboy1 and cowboy2 run differently and are both in use, so perhaps both should be tested.

waghanza commented 4 years ago

in deed, gen_tcp or ranch are NOT what is mainly called a framework, but is it not a set of library thus we can add it here

for example, here lives https://github.com/ray-ang/basicphp which could be considered as a framework (the author calls it a nano one) but more bare-metal in php world

essen commented 4 years ago

in deed, gen_tcp or ranch are NOT what is mainly called a framework, but is it not a set of library thus we can add it here

for example, here lives https://github.com/ray-ang/basicphp which could be considered as a framework (the author calls it a nano one) but more bare-metal in php world

Yeah but basicphp still is behind a Web server, imports a Web framework and such. It's equivalent to Cowboy, not Ranch.

waghanza commented 4 years ago

convinced :heart: Thanks for clarification, but is your argument still valid for gen_tcp ?

OvermindDL1 commented 4 years ago

gen_tcp is built into the underlying VM's stdlib, it is the base-most (well...) TCP layer, it's just pure TCP sockets, nothing to do with HTTP at all.

waghanza commented 4 years ago

@Sgiath I just want to ask you what you did ^^

Sgiath commented 4 years ago

As I said, I don't know this project much so I didn't realize it compared only the "full frameworks" :) I removed the gen_tcp and ranch and added cowboy.

Any comments to the code? Or is there something else I should add? (like enabling it in the measurement)

waghanza commented 4 years ago

as this project is not very stable (yet), there is no documentation to refer to

but I take care any contribution :heart: (tests ...)

essen commented 4 years ago

I can take a look at the Cowboy side of things tomorrow.

Would it be possible to have 2 Cowboy though? There's two interfaces, one low level and one high level. The low level interface is much faster. You can probably modify this example from @petrohi here: https://gitlab.com/stressgrid/dummies/-/tree/master/elixir_cowboy_fast_stream

Sgiath commented 4 years ago

Would it be possible to have 2 Cowboy though? There's two interfaces, one low level and one high level. The low level interface is much faster.

I do not work directly with :cowboy library so I don't know it's internals too much. If you want to add the low-level cowboy please do :slightly_smiling_face:

essen commented 4 years ago

Check the link I gave you. Just need to edit fast_stream.ex to remove the sleep and perhaps change the configuration.

waghanza commented 4 years ago

if you have 2 implementations of the same framework, please make them in two separate folders.

I'll merge them during https://github.com/the-benchmarker/web-frameworks/issues/1481

Sgiath commented 4 years ago

@essen I did add :cowboy version using streams but I don't see any performance benefits when benchmarking locally (205 312 req/sec for streams vs 204 749 req/sec for the standard version). So maybe it could be implemented more efficiently.

Also options for both cowboy versions could be probably tweaked.

Sgiath commented 4 years ago

After adding compiler optimizations difference is more apparent:

606 731 req/sec for streams vs 476 103 req/sec for standard version

:slightly_smiling_face:

essen commented 4 years ago

Hmm weird that you need this to see a difference, but I suppose it depends on the environment, Erlang version and such, and perhaps also depends on how you do the benchmarking. Thanks for adding it!

essen commented 4 years ago

Assuming this is only HTTP/1.1 the Cowboy projects look fine (usual "I don't know Elixir" disclaimer). If benchmarking using HTTP/2 more configuration will be necessary, as the defaults are a bit low for benchmarks.

In other news, Cowboy 2.8 will be released sometimes in February and has received many optimizations, so keep an eye out for the release!

waghanza commented 4 years ago

In other news, Cowboy 2.8 will be released sometimes in February and has received many optimizations, so keep an eye out for the release!

@dependabot will take care of it :stuck_out_tongue: (a PR will be added for each new update)

waghanza commented 4 years ago

@essen is the code OK for you @OvermindDL1 could you take a look @Sgiath is this PR ready to be shipped ?

PS : I don't have any elixir knowledge ?

Sgiath commented 4 years ago

@waghanza as far as I am concerned it is ready to be merged

essen commented 4 years ago

I don't know Elixir but the Cowboy projects look fine.