Suggestion support fasthttp #2

Closed
ghost opened this Issue May 17, 2016 · 7 comments

Comments

Projects
None yet
1 participant
@ghost

ghost commented May 17, 2016

Support for fasthttp will be appreciated, nice job, don't stop don't relax!

@gavv

This comment has been minimized.

Show comment
Hide comment
@gavv

gavv May 17, 2016

Owner

Thanks.

This should be easy since we already have Client interface. I'll look at it.

Owner

gavv commented May 17, 2016

Thanks.

This should be easy since we already have Client interface. I'll look at it.

@gavv gavv added the enhancement label May 17, 2016

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 18, 2016

If you need any 'help' for conversions between net/http look iris's source code or ask here. When you finish it I will add it to iris' readme as the recommended way to run api tests :)

Thanks you, I'm waiting for this!

ghost commented May 18, 2016

If you need any 'help' for conversions between net/http look iris's source code or ask here. When you finish it I will add it to iris' readme as the recommended way to run api tests :)

Thanks you, I'm waiting for this!

@gavv gavv added the performance label May 19, 2016

@gavv gavv added this to the v1 milestone May 19, 2016

gavv added a commit that referenced this issue May 19, 2016

gavv added a commit that referenced this issue May 19, 2016

gavv added a commit that referenced this issue May 19, 2016

gavv added a commit that referenced this issue May 19, 2016

gavv added a commit that referenced this issue May 19, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

gavv added a commit that referenced this issue May 20, 2016

@gavv

This comment has been minimized.

Show comment
Hide comment
@gavv

gavv May 20, 2016

Owner

@kataras

I've added fasthttpexpect module which provides two kinds of integration with fasthttp:

  • ClientAdapter - uses any fasthttp client to communicate with real server;
  • Binder - invokes fasthttp.RequestHandler directly, so you don't need to start server at all.

Both implement httpexpect.Client interface which may be set in Config struct. See details in updated README and godoc.

I also added echo_test.go example which demonstrates Binder usage with http.Handler and fasthttp.RequestHandler provided by echo framework.

I have no experience with Iris, so I have no idea how one can obtain http handler from Iris or what is the proper way to integrate with it. If you could provide an example, I'll add it to httpexpect too.

As for performance, currently fasthttp client is only a bit faster than default client (I've added benchmarks). I think the reasons are:

  • we convert net/http requests to fasthttp requests, send them using fasthttp and convert fasthttp responses back to net/http responses;
  • httpexpect is not optimized on the whole.

If performance will become a problem, we can start with locating and optimizing bottlenecks in httpexpect first, and after that we can implement (if still matters) more efficient communication with fasthttp.

I don't need it for myself right now (my test suite works fast enough) but feel free to open new issue if you'll find a problem.

Owner

gavv commented May 20, 2016

@kataras

I've added fasthttpexpect module which provides two kinds of integration with fasthttp:

  • ClientAdapter - uses any fasthttp client to communicate with real server;
  • Binder - invokes fasthttp.RequestHandler directly, so you don't need to start server at all.

Both implement httpexpect.Client interface which may be set in Config struct. See details in updated README and godoc.

I also added echo_test.go example which demonstrates Binder usage with http.Handler and fasthttp.RequestHandler provided by echo framework.

I have no experience with Iris, so I have no idea how one can obtain http handler from Iris or what is the proper way to integrate with it. If you could provide an example, I'll add it to httpexpect too.

As for performance, currently fasthttp client is only a bit faster than default client (I've added benchmarks). I think the reasons are:

  • we convert net/http requests to fasthttp requests, send them using fasthttp and convert fasthttp responses back to net/http responses;
  • httpexpect is not optimized on the whole.

If performance will become a problem, we can start with locating and optimizing bottlenecks in httpexpect first, and after that we can implement (if still matters) more efficient communication with fasthttp.

I don't need it for myself right now (my test suite works fast enough) but feel free to open new issue if you'll find a problem.

@ghost ghost referenced this issue in valyala/fasthttp May 20, 2016

Open

Info: httpexpect tests #101

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 20, 2016

@gavv Very good work, you're really fast thanks you, do you allow to PR the iris in the examples? it's less lines than echo's

ghost commented May 20, 2016

@gavv Very good work, you're really fast thanks you, do you allow to PR the iris in the examples? it's less lines than echo's

@gavv

This comment has been minimized.

Show comment
Hide comment
@gavv

gavv May 20, 2016

Owner

do you allow to PR the iris in the examples? it's less lines than echo's

Why not, you're welcome.

Owner

gavv commented May 20, 2016

do you allow to PR the iris in the examples? it's less lines than echo's

Why not, you're welcome.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 20, 2016

It's done, tests rans perfect but I didn't see really difference from other frameworks(bench=.) (normally Iris is far faster than this test shows) you have right, something happens with the Binder, maybe at the future you could improve that.

Edit 2-Info: httpexpect now lives on the iris' readme on the Testing section, if you want add something like releated projects section to your httpexpect's readme also, it wil helps with project's ranks also :)

Thanks you again, you're awesome.

ghost commented May 20, 2016

It's done, tests rans perfect but I didn't see really difference from other frameworks(bench=.) (normally Iris is far faster than this test shows) you have right, something happens with the Binder, maybe at the future you could improve that.

Edit 2-Info: httpexpect now lives on the iris' readme on the Testing section, if you want add something like releated projects section to your httpexpect's readme also, it wil helps with project's ranks also :)

Thanks you again, you're awesome.

@gavv

This comment has been minimized.

Show comment
Hide comment
@gavv

gavv May 20, 2016

Owner

Good! I've added a link to examples section in README.

Owner

gavv commented May 20, 2016

Good! I've added a link to examples section in README.

@gavv gavv closed this May 20, 2016

@gavv gavv removed the performance label Jun 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment