nytimes / gizmo

A Microservice Toolkit from The New York Times
https://open.nytimes.com/introducing-gizmo-aa7ea463b208
Apache License 2.0
3.76k stars 225 forks source link

FastSimpleServer for using Julien Schmidt’s httprouter #43

Closed heunglee closed 8 years ago

heunglee commented 8 years ago

I am developing an API with gizmo microservice toolkit. One of use cases is a sudden load spike for short period of time like 4 hours 2 days per week. For the use case, I am trying to optimize performance of the API in various parts as much as I can. A a part of the optimization, I would like to incorporate HttpRouter in gizmo Sever. Based on the benchmarks of various Go http routers (https://github.com/julienschmidt/go-http-routing-benchmark), HttpRouter shows very good performance with very low heap allocation rate. At this point, SimpleServer uses Gorilla mux as a http router. To use HttpRouter, it needs FastSimpleServer , which is planned this year per http://open.blogs.nytimes.com/2015/12/17/introducing-gizmo. I am looking forward to adding FastSimpleServer with HttpRouter to gizmo for those who want HttpRouter as a http router.

jprobinson commented 8 years ago

Instead of creating a FastSimpleServer, I've created a new Router interface that works with server.SimpleServer and server.RPCServer. It allows the use of either Gorilla web toolkit's mux or Julien Schmidt’s httprouter: https://github.com/NYTimes/gizmo/pull/44/

jprobinson commented 8 years ago

:boom: This has been merged into master