Live data from Hacker News

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

bbs.studygolang.com

31–40 of 168 posts

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

#31
post #29

Earlier quoted context omitted.

There was some discussion here but no OK me seems to know more https://news.ycombinator.com/item?id=6161399

Your original comment: > They seem to be making a concerted effort to make Go Chinese friendly https://code.google.com/p/go-zh/ The Chinese fork seems to be a project started by Minux. Minux (Shenghou Ma) is a Go contributer and is very active in the Go community, but he does not work for Google, as far as I know.

Interesting. Unfortunately I did not make it past year one Chinese in university, so I do not remember enough. If I had known, I would go find out if he contributes a lot on the Study Golang BBS.

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

#32

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.

Go has the same FFI language that most languages do: C.

http://golang.org/cmd/cgo/

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

#33

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{}

It seems to me that Go is incredibly crappy for writing in a functional style. Have a look at Rust if that's what you're after.

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

#34
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

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.

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

#35
That test is rigged to be a best case scenario for Go. How often do you send 1MB responses down to the client?

If you send 3KB responses then you would see both setups are much closer in performance.

Factor in some actual I/O and the difference will be even less. Then you'll eventually realize using either one makes little difference when it comes to performance.

This is why micro benchmarks are pure jokes. A real world site has a mix of response sizes, database I/O and caching. It's the only way to test something properly and you'll see if you properly test both there will be little difference in performance.

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

#36

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…

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=data-r6&hw=i7...

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

#37

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…

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.

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

#38
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?

Maybe because a lot of choice has been removed from the system? I've worked with a bunch of people from different countries and find that the more strict the gov't, the less they like choice, in general. All anecdotal of course...

Giving one guy from the Ukraine the typical choices at a restaurant here in the US would freeze him in place.

    What would you like to drink?  Tea

    Sweetened or Unsweetened?  Sweet. frustration += 1

    Sugar or artificial sweetener.  Sugar.  frustration += 2

    Soup or Salad?  Soup.  frustration += 7

    Which soup?  Minestrone, Pasta Fagioli, Italian Wedding?  frustration += 14
and on and on... Ukraine started packing his lunch.

Then there was the guy from Iceland... He took 10+ minutes to decide what to order in a new place and once he figured out what he liked in a particular place, he never gave the waitstaff a chance to offer him a choice. This, well done, salad with x dressing, with unsweetened tea. Iceland liked making the choices but only a few times.

Some people like to be dictated to: Code will be formatted like this. Braces will be like this. etc. The author of the article thinks these are a feature while I find it obnoxious.

My brain requires braces to line up in the left column, anything else slows me down. Maybe I'm just old?

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

#39

That test is rigged to be a best case scenario for Go. How often do you send 1MB responses down to the client? If you send 3KB responses then you would see both setups are much closer in performance. Factor in some actual I/O and the difference will be even less. Then you'll eventually realize using either one makes little difference when it comes to performance. This is why micro benchmarks are pure jokes. A real wo…

Original author of the post in question here.

Please note that the microbench was "rigged" by the author of Node when he was first presenting it several years ago (spelled out in the article).

If you need a tl;dr, it's this: I don't care for JavaScript as a language. Many make the argument that JavaScript should be adopted widely server-side because of its speed. I assert that languages should be evaluated not only for performance but for maintainability, feature sets, standard library, etc. Go provides a great combination of execution speed, development speed, and ease of maintainability.

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

#40

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.

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

Go has absurdly simple FFI through, as mratzloff mentioned, C. This is self-promotion and apologies, but see my submission history for two examples.

Post reply on HN