Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fasthttp #117

Open
valyala opened this issue Nov 29, 2015 · 8 comments
Open

Add support for fasthttp #117

valyala opened this issue Nov 29, 2015 · 8 comments
Labels

Comments

@valyala
Copy link

valyala commented Nov 29, 2015

fasthttp is a fast http server with zero memory allocations like httprouter. It would be great if support for fasthttp will be added to httprouter. This will give us fast http server+router with zero memory allocations.

@EtienneBruines
Copy link

I am wondering, since httprouter would probably want to keep their API stable, what would this look like?

  • One could probably convert fasthtp.RequestCtx to a http.Request object - (nullifying the performance gain?)
  • One could probably convert fasthttp.RequestCtx to implement http.Responsewriter - but again, as it's not an http.ResponseWriter already, I would feel like this doesn't leave us with much performance gain either.
  • One could combine the two projects, resulting in a different API.

With "stable API", I mean: I expect @julienschmidt to want to keep the syntax:

func Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {}

Do you have any thoughts / ideas about this yourself, @valyala ?

@julienschmidt
Copy link
Owner

The project is very interesting. I talked about something like that with @manucorporat a while ago.
However support can not be simply added to httprouter as its API is designed for net/http.
I think the best option would be to maintain a fork for fasthttp instead. I'd be happy to do that as soon as I fixed some stuff here in the main repo.

@valyala
Copy link
Author

valyala commented Dec 8, 2015

I'd be happy to do that as soon as I fixed some stuff here in the main repo.

This would be great!

@mathvav
Copy link

mathvav commented Dec 9, 2015

What are we looking at for a timeline for this? Would you like any help with the fork? Thanks!

@buaazp
Copy link

buaazp commented Dec 13, 2015

Hi all.

I had forked [httprouter] and make it work for [fasthttp]. But there are too many conflicts with go's net/http package. It is hard to merge into the main repo, so I rename it as an individual package fasthttprouter.

All docs and tests are available and the package has been used in our online productions. Just enjoy it.

@Taik
Copy link

Taik commented Dec 15, 2015

Thanks @buaazp for your work.

@mathvav
Copy link

mathvav commented Dec 18, 2015

@buaazp looks great; planning on digging into your library to build a framework with middleware and such Sunday or Monday.

Can I ask how you are going to maintain fasthttprouter as httprouter evolves? Why don't you have issues enabled for it (are you not looking to maintain this long-term?)?

@buaazp
Copy link

buaazp commented Dec 19, 2015

Hi @Annonomus-Penguin , forked repos disable issues by default, now I have opened it.
I will rebase the httprouter's commits into fasthttprouter over a period of time. Before I can make a PR for httprouter.
I wish httprouter can support fasthttp finally. But the interfaces are different and it's a little hard to do that.
And, of cause, I will maintain fasthttprouter as a long-term project because it's used in my productions. If there are bugs, file it to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants