Skip to content

Go routines with Echo #2205

Answered by aldas
pacholoamit asked this question in Q&A
Jun 26, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Echo uses standard library http.Server by implementing http.Handler interface (here) and does not spawn any goroutines itself. http.Server creates 1 coroutine per incoming connection and in that coroutine http.Handler interface which is in our case echo.ServeHTTP function is called and middleware->handler chain starts to be executed.

If you are interested how http.Server serves request I recommend looking at these methods

  1. http.Server.Serve this is where Server is waiting for incoming connections and creates new coroutine for each connection.
  2. http.Server.serve is executing in that new coroutine and is responsible for parsing HTTP requests and calling serverHandler.ServeHTTP before we reac…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pacholoamit
Comment options

Answer selected by pacholoamit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants