12 ms·
"100% of our production system is now running Go"
- aaronblohowiak 14y agoCreator of SASS and Haml now using Go for whole production system. When asked about surprising things about Go, its creators have said that they expected to recruit people from c++ communities, instead it seems to be more ruby/python people.
- cageface 14y agoIn hindsight it doesn't seem so surprising. Go really isn't a good alternative to C++ for the kinds of things that really need the low-level control and direct memory access C++ provides. And if you don't really need those things you probably should have moved on to Java or Ruby/Python/etc already. And since a lot of Java shops are fantastically risk averse I'm not at all surprised that the same kind of people that were willing to take a risk on Python or Ruby are now into Go. It offers a lot of the expressiveness of either of the former with much better performance, concurrency as a fundamental, and the extra safety of static type checking.
- thebigshane 14y agoStraight from Rob Pike -- http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html http://commandcenter.blogspot.com/2012/06/less-is-exponentia... Python and Ruby programmers come to Go because they don't have to surrender much expressiveness, but gain performance and get to play with concurrency. C++ programmers don't come to Go because they have fought hard to gain exquisite control of their programming domain, and don't want to surrender any of it. To them, software isn't just about getting the job done, it's about doing it a certain way. The issue, then, is that Go's success would contradict their world view. And we should have realized that from the beginning. People who are excited about C++11's new features are not going to care about a language that has so much less. Even if, in the end, it offers so much more.
- mturmon 14y agoNice link. The separate submission and thread is here: http://news.ycombinator.com/item?id=4158865 http://news.ycombinator.com/item?id=4158865
- batista 14y ago>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.
- qznc 14y agoC++ 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.
- tptacek 14y agoOne look at the Go standard library contradicts this. Go is perfectly adequate for abstraction.
- kragen 14y agoI think you may be talking past each other. C++ or D templates allow you to express (in a crude, verbose, error-prone way) some kinds of abstractions that are not expressible in Golang or ML. Not sure about C#. There are certainly lots of abstractions you can express in Golang.
- draven 14y agoGo has interfaces, which can be used to write generic code. Go performance is not on par with optimized C++ but for me it's fast enough and the performance / dev_time ratio is higher.
- 14y ago
- oofabz 14y agoI write Go and I have been satisfied with the low-level control and direct memory access. The language has pointers and you can cast between ints and pointers, so you can do anything you can do in C. If you're writing realtime code, you can avoid triggering the garbage collector simply by not allocating memory on the heap. It is harder to get anything done this way, but writing realtime code in any language is difficult.
- cageface 14y agoI actually haven't gotten this far with Go myself so I'm glad to hear that it's possible. But there's a huge uphill battle ahead for Go here. For instance, I write C++ code because I'm doing music software and all the APIs and existing code libraries and samples are in C++. It's just so much easier in this environment to put up with C++'s warts than it would be to try to shoehorn Go in there. As John Carmack says, externalities can quickly overwhelm the advantages of any particular language. But if you're implementing web services from scratch you don't have any of that baggage to carry around so it's much easier to choose Go.
- aaronblohowiak 14y ago>you can do anything you can do in C This is true only for very limited meanings of "anything"; if your point was that you had direct control of memory layout and you can use CGO for those things that C offers but go does not. For instance, the volatile keyword..
- StavrosK 14y ago> In hindsight it doesn't seem so surprising. Most things don't seem surprising in hindsight. That's why you don't judge surprises by it. If C++ programmers did flock to Go, would you then say that that was surprising? If not, you've just fallen victim to hindsight bias (because a model that predicts everything is useless).
- cageface 14y agoMost things don't seem surprising in hindsight. That's why you don't judge surprises by it. Surprising was GP's original term, not mine. I don't expect Go or any other language to displace C++ any time soon. But I do think the "scripting" languages are very vulnerable to challenges from languages with static typing systems less primitive than Java's.
- StavrosK 14y agoThat's because the GP was surprised. I rather should have said, you don't judge that something wasn't surprising by hindsight. Hindsight makes things obvious.
- Lewisham 14y agoI think a lot of it is that people sort of did want some static type checking, but were not willing to give up on things like garbage collection or some of the other niceties that the dynamic languages provided. As someone who has been clamoring for a statically-checked Python-esque language, Go looks awesome.
- deleted 14y ago[deleted]
- jonathansizz 14y agoI think that Mozilla's Rust is aiming squarely at C++ developers, whereas Go is more of a Java replacement. And it's interesting to see Python and Ruby being squeezed lately, from various directions; Clojure, Go, other languages. Since Python went mainstream and started being picked up for serious projects, it naturally came under the spotlight a lot more than it had previously, and I think many people have started to see some of its warts. The transition from version 2 -> 3 wasn't exactly a smooth one, either. Furthermore, although Python is a pretty good all-round language, it doesn't really excel at anything in particular, unlike for example Perl which continues to maintain a strong niche in the areas of text processing and system administration, despite its popularity having fallen away in some of the other areas it was formerly strong in. In my case, although I have recently moved from Perl to Racket for larger and/or more complex work, I still use Perl a lot for small, simple scripts (which constitute most of my programming). A couple of the Java guys I know switched from Python to Clojure for scripting tasks (I could never convince them to like Perl..), and have started to take an interest in languages like Scala and now Go for more substantial projects. For many years now, Python has been the fresh, fun challenger going up against older (and perhaps clunkier) languages, whereas now things seem to be shifting and Python may soon find its role has reversed and it has become the old, crufty language.
- pcwalton 14y ago"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, I'm completely fine with that; different language designs are appropriate for different roles. The huge amount of work that we've done to make non-allocating and manually-memory-managed code easy, predictable, and type-safe is totally overkill for Go's niche, for example, while for games and web browsers this sort of thing is essential.
- heretohelp 14y agoAs 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 frickin' documentation. Digging through the core libs to figure out how to dp fairly common case stuff is obscene. Part of the reason I like to tinker with Go in my spare time is that it's extremely hygienic, clean, cheap, and cheerful. Look at the way the "go" binary works, it does everything. It does builds, automatic formatting of code, the works. And it just "works". On top of that, I'd consider getting somebody more knowledgeable about Rust and get them to team up / pair-document with somebody who is a goddamn dumbass like me and start building tutorials/documentation together. I can't imagine the language's syntax and features are so nascent that tutorials and docs for core functionality/libs would be out of the question, you're already prototyping that web browser engine. Documentation is a UX problem, like syntax. Syntax alone crippled Erlang, please don't let obscurity harm a language I am very excited about. If there's any way I can help (maybe a trail of bread crumbs/notes from me as I try to learn it?), let me know in this thread or via email.
- drbawb 14y agoIf that's the case, I hope that Haml [and Sass] get properly ported to Go! I'm aware of gohaml; but last I checked it hasn't been updated to work with Go1 and friends. Namely it's using `gomake` and the packages aren't organized for use with `go build`; those issues alone have stopped me from considering it. I went for a version of mustache.go instead, and then bolted Lambda support onto it.
- siculars 14y agoIt's really annoying to have to log in to read something on google+, or groups for that matter. I just won't do it.
- spicyj 14y agoThis happens only if you have some Google login cookies already -- if you delete all your Google cookies then you won't be asked to log in.
- siculars 14y agoUm. What? Did you just tell me to fuck myself?
- lambda 14y agoRather than suggesting that people delete their cookies, you could suggest checking the article in private browsing mode (or whatever their browser of choice calls the feature).
- ck2 14y agoTo continue shopping on m.macys.com, please enable cookies in your settings. Really? in 2012?
- batista 14y agoYes. It's 2012, cookies are non tin-foil material, get on with the program and enable them. Or, if you insist, at least do not expect to use any web app / sales page, anything without them.
- deleted 14y ago[deleted]
- kyrra 14y agoIt's a shopping website. It's sorta hard to do cart management without cookies.
- Evbn 14y agoJust put a session id in the URLs.
- pilif 14y agokeeping a session id in the URLs is way less secure as it is susceptible to XSS attacks, it can leak in referer headers, it can be accidentally shared by people copy & pasting the URL and by extension, the session ID might even end up in a search engine and depending on your bad luck, the bots might visit the page just often enough so the session doesn't expire on the server at which point an authenticated session is in the search engines. Session cookies on the other hand can be marked as http-only, mitigating XSS in many browsers (there are some that still screw this up with XmlHttpRequest) and by not having the session id in the url, the id is much less likely to be shared with others, nor to appear in search engines. Also, it keeps the URLs nice looking. So why exactly would one want to disable session cookies? Because of all of the above reasons, I'd much rather keep users with cookies disabled away from my application than to subject them to the ugly URL fallback which will impact their security much, much more than the perceived privacy loss of session cookies (which go away when you close the browser)
- dbecker 14y agoThis is a really awkward sentence: "100% of our production system is now running Go as 95% of our application." I'm curious what the 5% is that they didn't convert to go.
- jmaygarden 14y agoRead the whole paragraph. It's C. "100% of our production system is now running Go as 95% of our application (C being the other bits). Not side bits, but our critical path."
- dbecker 14y agoI meant "what functionality is the remaining 5%." Not "what language is it." Basically, once you are 95% Go, what parts are hard to convert to Go to make it 100%
- luriel 14y agoProbably binding to pre-existing C libs. It will take some time to replace 40 years of existing accumulated C libraries.
- Evbn 14y agoThat would be silly. It's silly to talk about the source language of third party libraries when discussing languages you use. 3rd party library code is all object code or bytecode for all it matters to your project.
- zeeg 14y agoI'd be really curious to know what their "800 million requests a month" means. When we actually added up numbers a while back, we were doing around 250 million requests to our Python machines/day, and we only had 200 servers (which included dbs/etc), that was around 3-3.5 billion pageviews a month IIRC. We now have 300 machines and do about 5 billion pageviews, but that completely ignores the huge amounts of requests to our realtime stream servers and our API (which get shit on every "pageview" at least once).
- jacques_chester 14y agoIt's really hard to compare different systems without knowing what kind of complexity each pageview engenders in terms of backend processing. At one end there's flat HTML files, where you could serve 800 million pages/month from maybe a single particularly beefy server; at the other fully-dressed SOAs and CEPs and your uncle's pet dog rover performing multivariate regressions, meaning you need 9,000 servers.
- zeeg 14y agoI'm hoping they'll provide some more insight into what the breakdown of tasks are between the machines, and if that 800 million number is actually correct. It seems extremely high for what my absolutely-no-idea-what-these-sites-could-possible-need-that-many-servers-for thought process can fathom.
- moe 14y ago200 servers for 800mio requests seems a little nuts. Two of my customers are doing 500mio and 400mio respectively on ~20 each, on Rails (i.e. as slow as it gets).
- joejohnson 14y ago"100% of our production system is now running Go as 95% of our application (C being the other bits)" So... 95% of their production system is running Go.
- ww520 14y agoI guess it's playing word semantic. 100% of their MACHINES are running GO in SOME capacity, while other languages play some roles in other capacity.
- enneff 14y agoI interpreted it as meaning that 100% of the code in the critical path is Go, while their greater application also includes some C code.
- f2f 14y agothe C code is also being run under Go's control via Cgo.
- Evbn 14y agoMy production system is written in 100% bash and some other code run under Bash's control. :-)
- aaronblohowiak 14y agoif it was a 95/5% split, that might be a fair (and terrifying) thing to say.
- lttlrck 14y agoMine is running under 100% control of grub
- mahmud 14y agogrub doesn't control anything, it transfers control to the OS and is never contacted or heard from again. More concretely, in the case of Linux, the init task (first task and parent of every other task) function has a "tail" call to cpu_idle which never turns. http://lxr.free-electrons.com/source/init/main.c?a=arm#L359 http://lxr.free-electrons.com/source/init/main.c?a=arm#L359
- pkulak 14y agoHow's the garbage collector these days for Go? Is it close to the performance of the Java GC?
- batista 14y agoNo, still the same old one. Improvements are supposedly coming though (though, they were coming 2 years ago also).
- luriel 14y agoThere have been many improvements to the GC over the last two years, and many more are coming in Go 1.1. GC is an area where always there is room for improvement, no matter how much you work at it.
- Evbn 14y agoIt's not as sophisticated, but Go structs are smaller than similar Java objects, so that helps beat the tradeoff
- danieldk 14y agoI like Go, but this is total nonsense. It does help that you can embed values in a struct, rather than using pointers. But marking everything that looks like a pointer is not efficient. Not having generations does not help. Go is still very young, a better GC will come, just give it time. In the meanwhile, let's not pretend that the current sub-par generator is as performant as that of modern JVMs.
- luriel 14y agoGo code does produce considerably less garbage than Java code. And with Go if you really care, you can be even more careful and produce close to no garbage. Control over memory layout is really useful.
- chc 14y agoAFAIK, Go does not "mark everything that looks like a pointer." My understanding is that in some specific situations, the Go GC is not precise enough to distinguish between a pointer and an integer that happens to have the same value as that pointer, but I don't think it's right to say it does that all the time. Do you have evidence that it does?
- jebblue 14y agoEdit: I just posted 3 minutes ago and I'm already in gray text. Wow. We search with Google, run our phones with Google, run Google's browser, now they want us to write all our code in Google's language. Why Google? What's wrong with Java? Other than the fact that Oracle owns it, I miss Sun. Scott McNealy tried to make the technology world better. Scott, Gosling. Google...why should everything we do all day and night be about Google? http://en.wikipedia.org/wiki/Go_(programming_language) http://en.wikipedia.org/wiki/Go_(programming_language) >> The syntax of Go is broadly similar to that of C C, seriously? C??!? Why? Why would I want to go back to ... C? >> Of features found in C++ or Java, Go does not include type inheritance, generic programming, assertions, method overloading, or pointer arithmetic. And that is a good thing or a bad thing or what? >> Go allows a programmer to write functions that can operate on inputs of arbitrary type, provided that the type implements the functions defined by a given interface. Huh? Oh I can pass interface references, ok. >> A Go interface is best described as a set of methods, each identified by a name and signature. That sounds like Microsoft's crappy COM from the 1990's. The code sample on that page shows there are no braces in the if evaluation statements. A wise man, Peter Van Der Linden formerly of Sun's Compiler Group and author of Deep C Secrets wrote about using more braces if needed as explicitness is always better. I agree with that. At this point, I think I'd rather program in Groovy or even go to JavaScript if I had to, than use Go. Oh...the language name sux. Tip, buy Oracle and fix Java or by Java rights from them and fix it, then programming in a language owned by Google when you own so much of our lives now wouldn't be so bad. PS How does Guido Van Rossom feel about Go?
- Evbn 14y agoDo you hate C syntax or love C syntax? Make up your mind.
- batista 14y ago>We search with Google, run our phones with Google, run Google's browser, now they want us to write all our code in Google's language. Which is also open source and has a community behind it. (Plus, you can search with Bing, run an iPhone, and run Safari/Firefox/IE) >Why Google? What's wrong with Java? You mean besides the stagnation (no closures? no type inference? no functional goodness? It's 2012 already), the enterprisey vibe and the lawsuits? >>>The syntax of Go is broadly similar to that of C C, seriously? C??!? Why? Why would I want to go back to ... C? They don't ask you to go back to C. The SYNTAX is similar. Which is also true for Java. That said, from reading the rant, you don't seem like the type that ever was in C in the first place, so it wont be "going back" for you. >>> Of features found in C++ or Java, Go does not include type inheritance, generic programming, assertions, method overloading, or pointer arithmetic. And that is a good thing or a bad thing or what? That is what it is. Languages have different features, and it's not a spec war. Java doesn't have tons of features C++ has (e.g operator overloading, pointer arithmetic, hey, even closures, as of the latest standard). But you don't seem to be the type that wants to go to C++, right? So why the double standard? >>> A Go interface is best described as a set of methods, each identified by a name and signature. That sounds like Microsoft's crappy COM from the 1990's. Yes, I can see how you are qualified to make this kind of comparisons: "Interface of methods, with name and signature. Ah, just like COM!" >The code sample on that page shows there are no braces in the if evaluation statements. A wise man, Peter Van Der Linden formerly of Sun's Compiler Group and author of Deep C Secrets wrote about using more braces if needed as explicitness is always better. I agree with that. Good for you. You missed the "if needed" part. >Oh...the language name sux. And Rob Pike pissed on your cornflakes. >PS How does Guido Van Rossom feel about Go? Why should we care?
- bitcartel 14y ago@enneff Do you know if they are using the default gc compiler, or gccgo which is supposed to have better optimisation?
- luriel 14y agoI'm fairly sure they use the main gc compilers. gccgo does better at some things, but the default compilers do quite well already.
- kbronson 14y agoOh, so an irrelevant company is now running almost all on Go. No implementation details, no tooltips, no "we have learn this in the process". Just it. Yawn.
- bad_user 14y agoI want to try out Go, but the problems exposed by the garbage collector on 32bit systems scared me away. Is that still the case with the latest version 1.0.2 ? Also, is there any chance for a precise generational garbage collector to get implemented for Go? As far as I know, pointers make the implementation of precise garbage collectors difficult.
- jessemc 14y agoThere is code to make the garbage collector more precise currently in review. A few packages from the stdlib were changed to reduce the chance that package level variables might pin used sections of memory. Most people have no problems with the garbage collector on 32bit systems.
- akavel 14y agoAFAIK, yes it is still the case (although somewhat slightly improved), but precise collector is officially expected (and being worked on) for version 1.1 . The latter was explicitly said on a Q&A session on Google I/O conference, the video is available somewhere on teh interwebs. edit: I think it's this one: http://youtu.be/sln-gJaURzk http://youtu.be/sln-gJaURzk ("Meet the Go team"), but maybe some other from: http://blog.golang.org/2012/07/go-videos-from-google-io-2012.html http://blog.golang.org/2012/07/go-videos-from-google-io-2012... (sorry, don't have time to watch them all again now to make sure ;)
- bad_user 14y agoThat's good to know, thanks.
- jussij 14y ago> I want to try out Go, but the problems exposed by the garbage collector on 32bit systems scared me away. If you run a 64 bit server then these problems just goes away. And from all accounts these issues will also be fixed for 32 bit systems in then next Go release or two.
- jff 14y agoHere's a dime, go buy yourself an AMD64.
- zedzedzed 14y agoThere was this dart. It somewhat failed, so what they did was, screw up a good systems language so that it sarted looking like dart..
- tocomment 14y agoHow 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?
- billwashere 14y ago>>How do you run golang as a server? Using the net/http package that comes with Go. >>Can anyone point me to a basic tutorial? To learn Go - http://tour.golang.org/ http://tour.golang.org/ To learn about http http://golang.org/doc/effective_go.html http://golang.org/doc/effective_go.html (A list of available functions are found here http://golang.org/pkg/net/http/ http://golang.org/pkg/net/http/) Gorilla is a great web framework that builds upon the net/http package - http://gorilla-web.appspot.com/ http://gorilla-web.appspot.com/ >>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? What you are describing is CGI (http://en.wikipedia.org/wiki/Common_Gateway_Interface http://en.wikipedia.org/wiki/Common_Gateway_Interface) whilst it could be possible but don't for real severs its really old and slow.
- eckyptang 14y agoThe 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.
- tocomment 14y agoThanks! 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?
- afc 14y agoWhoah, 500 servers to handle an average of ~300 queries per second? Even if you generously assume they have traffic patterns that sometimes go all the way up to sustained say 5K queries per second... 500 servers? Isn't that like ... terribly wasteful?