Live data from Hacker News

"100% of our production system is now running Go"

groups.google.com

131–140 of 189 posts

Re: "100% of our production system is now running Go"

#131
post #93

Earlier quoted context omitted.

I have such a hard time believing how anyone could have believed that C/C++ programmers would switch to a GC-only language just like that. I just can't see Go as an alternative to C or C++, and I'm quite surprised that anyone (especially someone such as Rob Pike) could. Sure there are situations where a program that typically would have been written in C/C++ could benefit from Go (so there is a place for it), but the…

I think C/C++ programmers have had their reign long enough and have shown us through the amount of utterly horrible security issues that managing memory yourself is a bad idea. Go fits an important niche: stuff that doesn't have to play with the hardware directly, which is pretty much everything but the OS. I controversially consider there to be no other use for C bsaed languages these days other than at the kernel l…

Go fits an important niche: stuff that doesn't have to play with the hardware directly, which is pretty much everything but the OS.

The anything-but-the-OS-niche? I thought we had plenty of languages for that.

It's better to centralise the memory management and optimisation either into a VM or compiler. It's easier and safer to verify a compiler (mathematically or otherwise) than every memory access that you do.

You seem to ignore performance altogether, if you programmed in C/C++ for twenty years but don't care for performance and don't do low-level work, why have you been using C/C++?

Or if you have been doing low level or performance critical work, why wouldn't you want a safer alternative for that?

When you have to tune and debug your application to please the garbage collector having to deal with your own memory seems like child's play. It is much easier and safer to verify that your own memory management won't bite you than it is to be sure that your garbage collector won't eat you. (surely that depends on the context etc. but making broad claims seems to be on topic...)

Right tool for the right job. C/C++ has "monopoly" on a lot of use cases (way more than any other language) and considering its issues I truly believe that a "better C/C++" is needed, way more than those 20 JVM-based languages that popup every other month. Or Go.

Re: "100% of our production system is now running Go"

#132
post #93

Earlier quoted context omitted.

I have such a hard time believing how anyone could have believed that C/C++ programmers would switch to a GC-only language just like that. I just can't see Go as an alternative to C or C++, and I'm quite surprised that anyone (especially someone such as Rob Pike) could. Sure there are situations where a program that typically would have been written in C/C++ could benefit from Go (so there is a place for it), but the…

You want Rust: http://www.rust-lang.org/

I'll definitely read up more on Rust, thanks.

Re: "100% of our production system is now running Go"

#133

How do you run golang as a server? Can anyone point me to a basic tutorial? Is it still running under something like Apache is golang IS the server somehow? If so Wouldn't each http request have to fire up the compiled executable? Isn't that slow?

The compiled output will contain your network server. you run the process and it listens on a socket. It is pretty straightforward. Using HTTP as an example, each request will run in a goroutine which is somewhere between a thread and a coroutine.

It is extremely fast.

The main risk is process failure which is very rare but can be mitigated via putting a front end balancer such as nginx or apache mod_proxy. Process recovery and spawning can be managed by another tool such as supervisord.

However, you can run a process happily from init if you desire.

Re: "100% of our production system is now running Go"

#134

How do you run golang as a server? Can anyone point me to a basic tutorial? Is it still running under something like Apache is golang IS the server somehow? If so Wouldn't each http request have to fire up the compiled executable? Isn't that slow?

The compiled output will contain your network server. you run the process and it listens on a socket. It is pretty straightforward. Using HTTP as an example, each request will run in a goroutine which is somewhere between a thread and a coroutine. It is extremely fast. The main risk is process failure which is very rare but can be mitigated via putting a front end balancer such as nginx or apache mod_proxy. Process r…

Thanks! That's exactly what I was trying to figure out. You're a gem.

So is there anywhere I can see an example of code that runs a server like this?

Re: "100% of our production system is now running Go"

#135
post #131

Earlier quoted context omitted.

I think C/C++ programmers have had their reign long enough and have shown us through the amount of utterly horrible security issues that managing memory yourself is a bad idea. Go fits an important niche: stuff that doesn't have to play with the hardware directly, which is pretty much everything but the OS. I controversially consider there to be no other use for C bsaed languages these days other than at the kernel l…

Go fits an important niche: stuff that doesn't have to play with the hardware directly, which is pretty much everything but the OS. The anything-but-the-OS-niche? I thought we had plenty of languages for that. It's better to centralise the memory management and optimisation either into a VM or compiler. It's easier and safer to verify a compiler (mathematically or otherwise) than every memory access that you do. You…

The anything-but-the-OS-niche? I thought we had plenty of languages for that.

We have plenty of languages, but most of them are low performance interpreted languages, have major compromises or are not architecturally sound. Go addresses a lot of those issues - more than any other language so far.

You seem to ignore performance altogether, if you programmed in C/C++ for twenty years but don't care for performance and don't do low-level work, why have you been using C/C++?

I don't ignore performance. There are many ways to achieve performance. I've worked on embedded systems (military, medical sector) and occasionally need direct hardware access which is where I use C/C++ and that is primarily to manipulate a device and hand off a suitable abstraction to a higher level language (with a garbage collector).

When you have to tune and debug your application to please the garbage collector having to deal with your own memory seems like child's play. It is much easier and safer to verify that your own memory management won't bite you than it is to be sure that your garbage collector won't eat you. (surely that depends on the context etc. but making broad claims seems to be on topic...)

That is all down to determinism. Determinism can be achieved in various simple ways. If you understand the language, you can write code that pre-allocates and reuses memory in critical sections therefore invoking no garbage collection penalty. Isolating critical sections from each other is still a problem in C/C++ if you consider the threading model that they use.

Right tool for the right job. C/C++ has "monopoly" on a lot of use cases (way more than any other language) and considering its issues I truly believe that a "better C/C++" is needed, way more than those 20 JVM-based languages that popup every other month. Or Go.

I'm not a fan of all "those 20 JVM-based languages" - I find them tedious and ugly. I'm the most critical person on the planet when it comes to this sort of thing. Go pretty much hits the mark.

I think your complaints could be addressed with a simple extension to pause the collector therefore introducing determinism i.e:

   func CriticalFunc() {
       defer runtime.ResumeGC()
       runtime.PauseGC()
       // critical section
   }

Re: "100% of our production system is now running Go"

#136

How do you run golang as a server? Can anyone point me to a basic tutorial? Is it still running under something like Apache is golang IS the server somehow? If so Wouldn't each http request have to fire up the compiled executable? Isn't that slow?

The compiled output will contain your network server. you run the process and it listens on a socket. It is pretty straightforward. Using HTTP as an example, each request will run in a goroutine which is somewhere between a thread and a coroutine. It is extremely fast. The main risk is process failure which is very rare but can be mitigated via putting a front end balancer such as nginx or apache mod_proxy. Process r…

I was always taught never to write my own web server since something like Apache has been tested on millions of sites, and you have security experts designing it.

Does writing your own server in Go kind of violate this idea? Are you opening yourself up to re-inventing a web server and repeating decades of mistakes something like Apache has already figured out and fixed?

Re: "100% of our production system is now running Go"

#137

Earlier quoted context omitted.

The compiled output will contain your network server. you run the process and it listens on a socket. It is pretty straightforward. Using HTTP as an example, each request will run in a goroutine which is somewhere between a thread and a coroutine. It is extremely fast. The main risk is process failure which is very rare but can be mitigated via putting a front end balancer such as nginx or apache mod_proxy. Process r…

Thanks! That's exactly what I was trying to figure out. You're a gem. So is there anywhere I can see an example of code that runs a server like this?

From the tour - I've added comments for clarity:

   // this defines the entry point
   package main
   
   // import formatting and HTTP server packages
   import (
   	"fmt"
   	"net/http"
   )

   // This is your HTTP Server instance
   type Hello struct{}
   
   // This is a method on your HTTP server instance that sends hello for all requests
   func (h Hello) ServeHTTP(
   		w http.ResponseWriter,
   		r *http.Request) {
   	fmt.Fprint(w, "Hello!")
   }
   
   // this is your entry point
   func main() {
        // create a new HTTP Server instance
   	var h Hello
        // tell the runtime to serve it
   	http.ListenAndServe("localhost:4000",h)
   }

Re: "100% of our production system is now running Go"

#138
post #73
post #52

Earlier quoted context omitted.

> The issue, then, is that Go's success would contradict their world view. I call BS. The parent explanation is much better: for a lot of the kinds of jobs C++ is good for, Go is not that good, whereas for a lot of things Python is good for, Go is as good and has better performance.

C++ is better for abstraction, as Go does not have generics yet, and C++ is better for performance. Go is faster to compile. Maybe Go is better for concurrent programming, but this is hard to measure.

> Go does not have generics yet,

From all accounts it will never ever get generics.

> and C++ is better for performance.

As Go is a GC based language I would expect it will always be slower than non GC languages like c/c++.

But the big question is, is it really that much slower?

And the fact that it is a GC language means it is a much simpler language than C++.

Re: "100% of our production system is now running Go"

#139

Earlier quoted context omitted.

The compiled output will contain your network server. you run the process and it listens on a socket. It is pretty straightforward. Using HTTP as an example, each request will run in a goroutine which is somewhere between a thread and a coroutine. It is extremely fast. The main risk is process failure which is very rare but can be mitigated via putting a front end balancer such as nginx or apache mod_proxy. Process r…

I was always taught never to write my own web server since something like Apache has been tested on millions of sites, and you have security experts designing it. Does writing your own server in Go kind of violate this idea? Are you opening yourself up to re-inventing a web server and repeating decades of mistakes something like Apache has already figured out and fixed?

You are correct - you should never write your own web server. In this case, you're not writing your own web server. There is one provided with the standard library which will be embedded into your binary.

You are writing a bunch of handlers (as you would with Apache) and plugging them into the compiled in web server from the standard library.

For network servers, there is standard library support for SMTP, HTTP, normal stream based text protocols etc as well as serialization formatters and parsers for JSON, XML, HTML etc. You should never have to re-invent the wheel.

Re: "100% of our production system is now running Go"

#140

Earlier quoted context omitted.

"I think that Mozilla's Rust is aiming squarely at C++ developers, whereas Go is more of a Java replacement." I basically agree with this as a Rust developer (although I'm not sure about Go being in Java's niche; I think of it more as in node.js's niche -- highly scalable web apps). Early on, I think both Rust and Go were thought to be targeting the same segment, but it turned out that we really weren't. Personally,…

As someone who's tried (and failed) to learn Rust in the past: I'm going to elide any commentary about the syntax for now, as I know why it is the way it is (the type system/annotations). I'm basically just going to expound on one thing for the sake of emphasis. For the love of god make Rust more accessible . I don't mean dumbing down the type system or abandoning regions (I really hope that works out). I mean the fr…

Yes, the docs are awful at the moment. It's mostly a question of making sure things are stable before we commit to writing a lot of docs; we absolutely need better ones. The standard library tends to use the bleeding-edge features more than user Rust code (as it contains implementations of core traits and whatnot), so its churn is high. Despite what others have suggested, I don't think it needs a total rewrite, but various names should change.

A "go"-like binary is on the roadmap; it's mostly a question of refactoring. We have a pretty printer, a doc generator, a package manager, and a compiler (all in various stages of completeness); the trick is to just bundle them into one nice package.

A trail of notes would definitely be helpful, to see what the initial hurdles are for beginners.

From what I've seen the biggest problem is that 0.3's syntax is totally different from the unreleased 0.4 (due to be released next week). Most people, understandably, build from the packaged 0.3 and none of the examples in the documentation work. 0.4 contains the syntax we're committing to; most of the changes from then on should be backwards-compatible with it (unless you use the deprecated stuff, which we're adding warnings for).

Post reply on HN