HTTP Server: Async IO

280 views
Skip to first unread message

Arafath M

unread,
Dec 28, 2015, 1:09:41 PM12/28/15
to golang-nuts
Hi,

I am using golang for my server application (http). In Node.js, one will use callback pattern for getting the benifits of async io. In go, async support is given very beautifully so that one can write the app in traditional synchronous pattern and go will internally handle the async io. My expectations regarding async support in go as follows. Are the below points correct?

1. Each requests are served through new go routine.
2. In my http handler function, if I read or write to a file, then go internally use async io and switch to another go routine (if there is any)
3. If I do database operations through standard SQL package, then go will use async network io and switch to another go routine. (if there is any) (I am using MySQL now.)
4. If I connect and communicate with any third party services through TCP/IP sockets, then while sending or receiving data, go will use async network io and switch to another go routine. (if there is any)
5. While go server gives reply to the client (web browser), it uses async network io and switch to another go routine. (if there is any)

Are the above points correct?

Sincerely,
Arafath M

Arafath M

unread,
Dec 28, 2015, 1:09:49 PM12/28/15
to golan...@googlegroups.com

Hi,

I am using golang for my server application (http). In Node.js, one will use callback pattern for getting the benifits of async io. In go, async support is given very beautifully so that one can write the app in traditional synchronous pattern and go will internally handle the async io. My expectations regarding async support in go as follows. Are the below points are correct?

Brad Fitzpatrick

unread,
Dec 28, 2015, 1:16:29 PM12/28/15
to Arafath M, golang-nuts
Correct.



--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Cheney

unread,
Dec 28, 2015, 1:34:23 PM12/28/15
to golang-nuts

Arafath M

unread,
Dec 28, 2015, 11:31:37 PM12/28/15
to golang-nuts, Dave Cheney, Brad Fitzpatrick
Thanks for the replies.

Sincerely,
Arafath M

Sincerely,
Arafath M

On Tue, Dec 29, 2015 at 12:04 AM, Dave Cheney <da...@cheney.net> wrote:
Correct. http://dave.cheney.net/2015/08/08/performance-without-the-event-loop
Reply all
Reply to author
Forward
0 new messages