On Wed, May 15, 2013 at 6:56 PM, Mike <
mikes...@gmail.com> wrote:
> I am new to GO and I am not sure as how GO should be best used for the
> development of a highly concurrent web service.
Sure it does, Go was designed to do that.
> Imagine I want to build a web service(most probably a rest service) were it
> is supposed to process many concurrent requests. The thing is that for every
> request that arrives at the web service, some has to be processed
> sequentially and some can be processed in parallel. How should I go about
> doing so? Should the web service have some kind of go routine entrance that
> depending on the call, it will send it to another GO routine responsible for
> processing those requests and dynamically instantiate a GO routine for every
> request that can be handled in parallel and send the request to it?
First: just read the
golang.org/pkg/net/http and learn how to use that
package (take the go tour too)
Second: Read
http://golang.org/doc and give some attention to the
Talks topic (watch all videos)
Third: What do you mean by: some services can be run parallel and
others can't? The client can't make two requests or the server can
only handle one single request to the given service?
> I want the client code to be blocking so that the client don't care how the
> request is being handled and the just get a response on their synchronous
> call. How will I make the web service not to return to the client until the
> associated go routine is done handling the request?
Just don't exit the handler function, usually this is done using a
channel to block the thread while the response is built.
> Is this how you will build such web service? How else will you build a
> Highly Concurrent Web Service With Go?
--
André Moraes
http://amoraes.info