Live data from Hacker News

Program your next server in Go

talks.golang.org

251–260 of 384 posts

Re: Program your next server in Go

#251
post #240

Earlier quoted context omitted.

> We continue to use Go because of its strengths, but it just really surprises me how little Google seems to care about the language and ecosystem. Go is certainly a language that is used at Google, but AFAIK a lot of "Googlers" don't really like it and don't use it. It certainly not the "official language at Google", given the weight of C++ and Java there. But that's the consequence of being opinionated. Using Go me…

> but AFAIK a lot of "Googlers" don't really like it and don't use it Where on earth did you hear that? It's simply not true. (googler)

Wow. Is Google so homogeneous that you both can be so sure about your respective affirmations?

Re: Program your next server in Go

#252

All of the server backends at my company are written in Go. This was a result of me writing a couple servers in Python a few years back, ending up with lots of problems related to hanging connections, timeouts, etc. I tried a couple different server libraries on Python but they all seemed to struggle with even tiny loads. Not sure what was up with that, but ultimately I gave Go a swing, having heard that it was good…

Slide 13 ( https://talks.golang.org/2016/applicative.slide#13 ) is interesting. I was expecting Go to be very close to C/C++ on the X axis (fast/efficient) as it doesn't use VM, but it is more close to Java ?

In my experience programming speed goes like this:

- 1x benchmark - C / static C++

- 2x slower - pure virtual C++ / objective-c

- 3x slower - statically typed GC languages (java,go)

- +6x slower - dynamically typed GC languages (js, python, etc)

After a well optimized implementation, speed comes down to manual vs GC memory management, static vs virtual function dispatch, dynamic vs static typing and heap vs stack allocation.

Compile speed is usually slowed down by any sort of type inference or templating/generics, which is probably one reason why go resists implementing generics or subclassing

Re: Program your next server in Go

#253
post #82

One important niche I see that Go serves very well is in distributed, fault-tolerant deploy platforms (aka schedulers), like Kubernetes or Mesos. If you look at the amount of tooling that uses Go, you almost feel there just is no other choice out there. I would not adventure to say state-of-the-art schedulers would not have been possible without Go, but for sure Go fits the requirements pretty well.

Mesos is c++ and marathon and other schedulers are based on jvm :)

Re: Program your next server in Go

#254
post #150
post #20

Earlier quoted context omitted.

When you want to hire developers.

> When you want to hire developers. When you want to hire good developers pick Erlang, Elixir, Rust, Haskell, ML, LISP. Because chances they went out of their way to learn the language as it is not taught in US universities in depth. They are probably curious, good learners and could probably learn or adapt to other new things thrown at them. I am at shop were we use Erlang and syntax has not phased new people that m…

I've also found though that these languages attract primadonnas who care more about "attractive" code and getting to play with cutting edge technology that might not be ready for prime time yet than they care about providing business value.

Edit: fixing typo. Pay -> play

Re: Program your next server in Go

#255
post #150

Earlier quoted context omitted.

> When you want to hire developers. When you want to hire good developers pick Erlang, Elixir, Rust, Haskell, ML, LISP. Because chances they went out of their way to learn the language as it is not taught in US universities in depth. They are probably curious, good learners and could probably learn or adapt to other new things thrown at them. I am at shop were we use Erlang and syntax has not phased new people that m…

I've also found though that these languages attract primadonnas who care more about "attractive" code and getting to play with cutting edge technology that might not be ready for prime time yet than they care about providing business value. Edit: fixing typo. Pay -> play

Agreed. I've seen that too.

Re: Program your next server in Go

#256
post #230
post #159

Earlier quoted context omitted.

>> given the weight of C++ and Java there. Python as well. >> how little Google seems to care about the language and ecosystem Let's compare with Microsoft. The top four out of five users at StackOverFlow have top tags in C#, I guess Google have a long way to Go.

And yet the os group at ms is famous for their naked derision of the .net Framework.

Hum .Net is their own dog food .. did you mean Android/iOS? :-D

Re: Program your next server in Go

#257

Earlier quoted context omitted.

> especially when you have to unlearn sound and proven practices, which Go often requires to do. Such as? I'm not really sure what "sound and proven practices" a Java developer would have to "unlearn" to adopt Go. Most of the differences between Go and Java amount to removing features that 20 years of Java experience have proved to be unsound or unnecessary (inheritance and exceptions, for example). From a feature pe…

I'll say that Java doesn't do currency worse than Go, that's for sure. It has all of the primitives in whatever arrangement you want to put them (Javaflow and now Coroutines if you want go-I'm-sorry-coroutines, native threads if you want those, and Go channels can be implemented in maybe two dozen lines), more flexible, battle-tested abstractions (such as Akka offering you an asynchronous, message-passing actor model…

Debugging is definitely a valid counter-point. Go's debugging story is rapidly evolving, but it's not particularly friendly or settled at this point.

Goroutines are subtly different than coroutines, mostly in that goroutines are not bound to the OS thread they're created on, and also that they don't need to be explicitly yielded--any I/O or lock-blocking (including reading or writing on channels) are potential interrupt points. Channels are probably also less easy than you might think, particularly the nuances around Go's `select` keyword.

I'm not sure where exactly Java stands on all of this. I've heard that the Quasar library comes close to bringing Go's concurrency tools to the JVM, but it's not widely used and any non-Quasar I/O is likely going to block your OS thread. At any rate, while I agree that Java can theoretically come very close to matching Go's concurrency story, it falls very short in practice.

> you can't build an unbounded buffered channel and at that point the use of channels for what I write rapidly approaches zero

If you're using Ruby, I'm guessing you don't need thread safety, so you probably just want a slice.

> I don't think a fair comparison of concurrency-related stuff ... is nearly as clear as you assert

Like I said, I think libraries like Quasar have a lot of potential, but they're not widely used. If it was the de-facto solution for concurrency in Java, I would agree that "concurrency in Java is no worse than in Go" (and I would have to, since Quasar's stated purpose is to bring Go-like concurrency to Java).

Re: Program your next server in Go

#258

Earlier quoted context omitted.

Have you considered pausing the GC for those blocks? Or am I misunderstanding your use case?

How do you do this? I didn't know there was a way to temporarily disable the GC for specific blocks.

https://golang.org/pkg/runtime/debug/#SetGCPercent

Do note that it triggers a GC when you call this, so it's not for all situations, but can be useful.

Re: Program your next server in Go

#259

Earlier quoted context omitted.

Have you considered pausing the GC for those blocks? Or am I misunderstanding your use case?

How do you do this? I didn't know there was a way to temporarily disable the GC for specific blocks.

You can toggle the GC with https://golang.org/pkg/runtime/debug/#SetGCPercent. Turn it off before you enter your block and enable it again at the end of your block.
Post reply on HN