Here is a simple solution. Write some middleware that will wrap your http.Handlers.
In order to handle at most 100 requests the middleware needs to have access to a channel with a buffer size of 100 (I'll call it x) and do the following: 1. Send to x 2. Defer a receive from x. 3. Run the original http.Handler If at any point x's buffer comes full (at 100 concurrently running handlers), step 1 will block and wait until a handler finishes and receives from x. If you want to view the queue of work you'd need a different solution. I'm not aware of an existing open source solution. On Saturday, October 28, 2017 at 9:23:41 AM UTC-4, Keith Brown wrote: > > Here is a scenario: a high traffic site which executes costly operations > (database / filesystem / compute heavy operations). The web server is > running standard go/http/server. > > I would like to handle at most 100 requests and the remainder to queue -- > all while the client (curl) is waiting. Are there tools to throttle the web > server? And is there a way to view the queue of work? > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.