Live data from Hacker News

Go as an alternative to Node.js for very fast servers

bbs.studygolang.com

41–50 of 168 posts

Re: Go as an alternative to Node.js for very fast servers

#41

Earlier quoted context omitted.

When I see someone doing something like this and: 1. They are not using the latest Go (atm 1.1.2) 2. GOMAXPROCS is not = the number of CPUs 3. They are using ab rather than something more scalable like wrk I assume they either don't know what they are doing, or want to make Go look bad. On a side note, Go is already known to be much faster at web-serving than node.js: http://www.techempower.com/benchmarks/#section=da…

I did the test that the article suggested, with the versions of the tools that I have installed on my system. This is a comment on a blog article, not an attempt to engineer the perfect benchmark. Also in this bench Go danced circles around node. I dunno what you're complaining about.

>I dunno what you're complaining about.

I'm complaining because you and other people will go on to:

  1. Use a version of Go in your development that is slower (as has much worse memory characteristics) and lacks new features.
  2. End up running all your programs on single core until you understand GOMAXPROCS
  3. Use ab to bench real things which is bad
So "my complaining" is trying to help you.

Re: Go as an alternative to Node.js for very fast servers

#42

If you read the original blog post on http://blog.safariflow.com/2013/02/22/go-as-an-alternative-t... , one of the commentators actually attempted the comparison between node.js and go, and his results for node.js was significantly faster.

Thanks for the link to the original. Perhaps "February 22, 2013" should be identified in the title here?

That explains the use of Go 1.0.2.

Re: Go as an alternative to Node.js for very fast servers

#43

Earlier quoted context omitted.

I did the test that the article suggested, with the versions of the tools that I have installed on my system. This is a comment on a blog article, not an attempt to engineer the perfect benchmark. Also in this bench Go danced circles around node. I dunno what you're complaining about.

>I dunno what you're complaining about. I'm complaining because you and other people will go on to: 1. Use a version of Go in your development that is slower (as has much worse memory characteristics) and lacks new features. 2. End up running all your programs on single core until you understand GOMAXPROCS 3. Use ab to bench real things which is bad So "my complaining" is trying to help you.

Can you help me by telling my why the way I used GOMAXPROCS is wrong, and how to use it correctly?

Re: Go as an alternative to Node.js for very fast servers

#44

Earlier quoted context omitted.

I did the test that the article suggested, with the versions of the tools that I have installed on my system. This is a comment on a blog article, not an attempt to engineer the perfect benchmark. Also in this bench Go danced circles around node. I dunno what you're complaining about.

>I dunno what you're complaining about. I'm complaining because you and other people will go on to: 1. Use a version of Go in your development that is slower (as has much worse memory characteristics) and lacks new features. 2. End up running all your programs on single core until you understand GOMAXPROCS 3. Use ab to bench real things which is bad So "my complaining" is trying to help you.

I agree with Voidlogic here. Perhaps his tone was a little confrontational, but his intentions were good. :)

    Go 1.1 > Go 1.0.2
    wrk > ab
In particular, ab should be avoided whenever possible. Apache Bench (ab) remains a single-threaded tool, meaning that for high-performance servers in particular, your exercise will run into the limits of Apache Bench before the limits of the server(s) being tested. The LigHTTP team has a multi-threaded clone named WeigHTTP that I would recommend if you want something that is functionally similar to ab and uses similar command-line arguments.

Wrk uses a slightly different argument syntax from ab and WeigHTTP but has some upsides:

1. Wrk is also multi-threaded.

2. In our experience, wrk is slightly higher-performance than WeigHTTP (~5 to 10%).

3. Wrk provides average, maximum, and stdev for latency.

4. Wrk provides a time-limited mode (rather than request-count limited), which is appealing for some test types.

In my experience, as long as you configure Go and node to use all of your cores, Go will benchmark better than Node in any permutation of these configuration variables:

    Go 1.0.2 and node tested with ab.
    Go 1.1 and node tested with ab.
    Go 1.0.2 and node tested with wrk.
    Go 1.1 and node tested with wrk.
V8 is a very fast JavaScript runtime; node.js is modestly quick at handling HTTP requests. But among the many features of Go is a high-performance HTTP package. If you've used both, it isn't all that surprising that Go's performance clocks in higher than node.

Re: Go as an alternative to Node.js for very fast servers

#45
post #34
post #24

Earlier quoted context omitted.

How much of an advantage, if any, does Node provide because it's more "mature", or at least has been used for far longer. For example, when I go to StackOverFlow I see that Node has far more questions asked: http://stackoverflow.com/questions/tagged/go http://stackoverflow.com/questions/tagged/node.js

I'm really uncertain about node being judged more "mature". Being developed by Thompson and Pike makes you gain something like 30 years of "maturity". Plus, running in production in the Google infrastructure is far more of a proof of maturity than running the chat service of every hackathon project for 2 years.

Mature means many things, including being able to get support, packages, existing code, solutions to common problems, etc. I'm sure Go is a solid project.

Re: Go as an alternative to Node.js for very fast servers

#46

Is it possible to write Go in a functional way? Are there first class functions? Anonymous functions? If so it seems it would be possible to write highly functional code given the flexibility of interface{}

If you're interested, I did an in depth write up on how to do it. [1]

[1] - http://blog.burntsushi.net/type-parametric-functions-golang

Re: Go as an alternative to Node.js for very fast servers

#47
post #8

If you read the original blog post on http://blog.safariflow.com/2013/02/22/go-as-an-alternative-t... , one of the commentators actually attempted the comparison between node.js and go, and his results for node.js was significantly faster.

Go version 1.1 was more than a significant increase in net handling speed.

Not only that, but although the particular test described in the linked blog post did not include database connectivity, we saw a massive increase in database performance in 1.1 versus 1.0.2 due to a fix in the sql package [1]. That was back in Round 4 of our project [2].

Just something to be aware of if anyone reading has Go 1.0.2 installed and has not yet upgraded. 1.1 is worth the upgrade.

[1] https://code.google.com/p/go/source/detail?r=45c12efb46

[2] http://www.techempower.com/blog/2013/05/02/frameworks-round-...

Re: Go as an alternative to Node.js for very fast servers

#48
post #24

I did the benchmarks outlined at the end of the article. Summary of results: 1. Node.js v0.10.15, single worker: 46.2 seconds 2. Node.js v0.10.15, cluster 8 workers using naught: 17.2 seconds 3. Go 1.0.2, GOMAXPROCS left default: 3.5 seconds 4. Go 1.0.2, GOMAXPROCS=8: 3.7 seconds Detailed results below: 1. Node.js v0.10.15, single worker Concurrency Level: 100 Time taken for tests: 46.217 seconds Complete requests: 1…

How much of an advantage, if any, does Node provide because it's more "mature", or at least has been used for far longer. For example, when I go to StackOverFlow I see that Node has far more questions asked: http://stackoverflow.com/questions/tagged/go http://stackoverflow.com/questions/tagged/node.js

By now, I'd assume the language run times are in the noise for thinking about maturity. The most likely culprits will be the application code followed by the library code. So the real question should be "Are there any big scary monsters in the libraries I need?". Followed by "Which language do I think will best enable me to hit my target?".

Re: Go as an alternative to Node.js for very fast servers

#49
post #3

So beyond the ironic comment mentioned before with the Golang Hello world tutorial using Chinese, what is the real reason behind the Chinese following behind Go? It seems like this site confirm there must be a pretty dedicated Golang following, but I cannot figure out for the life of me why. Does anyone actually know?

For me, Go has the least "What the hell does this code do?" and "Why isn't this code working?" of any language I've ever used. I'd say Go isn't an impressive programming language, but a very impressive software engineering language.

> Go isn't an impressive programming language, but a very impressive software engineering language.

Curious, what is the distinction?

Re: Go as an alternative to Node.js for very fast servers

#50

Earlier quoted context omitted.

Do you mean specifically why there is a dedicated Chinese following in particular, or just in general? Go is a clean, intuitive language with a very robust supporting ecosystem and a strong concurrency model. It builds fast, small code and makes quick work of big problems. Why shouldn't there be a big following of one of the better platforms to come out in a long time?

My only gripe is its intended use as a systems programming language. The runtime kind of makes it a silo; ie: hard to bind other languages to it through an FFI. Of course if I am mistaken or there's something being done to address such a scenario then I will be much happier seeing more and more infrastructure code shipping in Go.

> My only gripe is its intended use as a systems programming language.

It's not. It's a new Java, not a new C++.

> ie: hard to bind other languages to it through an FFI.

More or less impossible: GC and goroutines are not optional so you'd need to cleanly setup and shutdown the Go runtime. You'd have to embed Go as you do Lua or Python.

Post reply on HN