<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>You should have added this answer, it would have led to a very interesting discussion!</div><div><br></div><div>Robert<br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Jesper Louis Andersen" <jesper.louis.andersen@erlang-solutions.com><br><br><div dir="ltr">I remember reading that discussion on Hacker News as for why Google considered but did not pick Erlang. The reason I did not answer was because I don't believe it would be fruitful to do so, but on this mailing list I can't resist.<div><br></div><div>One of the things I've been looking into as of late is the price paid for error handling. When you anticipate error and handle it, there is an overhead to this handling. It is easy to get extreme Queries per second (QPS) rates if you ignore faults and have no way to mitigate them.</div><div><br></div><div>I believe that the stance of many systems are to claim that the system is void of any internal error and then run without the internal error protection of the system. Outside, you run something like monit in order to keep the system up and restarted should it die. In turn, such systems can be made so they run much faster than the typical Erlang system easily:</div><div><br></div><div>* There is no need for doing hot code upgrade on the fly. Hence, you can native-compile everything into one static binary, inline like mad and so on. This speeds up a lot of the computational stuff.</div><div>* You don't need to set a monitor for each call. Since there are no errors (by your claim) the code never goes wrong and hence why set it?</div><div>* You have no distribution. So everything happens locally in your own memory space. This usually gives complete knowledge and simplifies a lot of possible error paths to "non-existent".</div><div><br></div><div>To make Go work in practice, you need to adopt this stance: you deploy small statically compiled binaries which are "obviously correct" by being small. And if something is amiss, you do not go for a partial failure or a gradual degradation of the system: off with its head!</div><div><br></div><div>It is a trade-off. You get more speed, but are ignoring certain failure scenarios. But you are also suddenly going to rely 100% on the code being correct. In your code and in all libraries you use.</div><div><br></div></div><div class="gmail_extra"><br><div><br></div><div class="gmail_quote">On Tue, Aug 20, 2013 at 9:26 AM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank" data-mce-href="mailto:essen@ninenines.eu">essen@ninenines.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">Why do you paste us HN discussions? There's no better waste of time than to read programmers comparing "sizes".<div class="HOEnZb"><div class="h5"><br> <br> On 08/20/2013 07:02 AM, giovanni_re wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><a href="https://news.ycombinator.com/item?id=6234736" target="_blank" data-mce-href="https://news.ycombinator.com/item?id=6234736">https://news.ycombinator.com/<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>item?id=6234736</a><br> Rewriting a large production system in Go (<a href="http://matt-welsh.blogspot.com" target="_blank" data-mce-href="http://matt-welsh.blogspot.com">matt-welsh.blogspot.com</a>)<br> 222 points by qdie 1 day ago | 173 comments<br> <a href="http://matt-welsh.blogspot.com/2013/08/rewriting-large-production-system-in-go.html" target="_blank" data-mce-href="http://matt-welsh.blogspot.com/2013/08/rewriting-large-production-system-in-go.html">http://matt-welsh.blogspot.<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>com/2013/08/rewriting-large-<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>production-system-in-go.html</a><br> <br> MW: PhD U. Cali Forni Berkeley<br> <br> <br> <br> ==========  <a href="https://news.ycombinator.com/item?id=6234736" target="_blank" data-mce-href="https://news.ycombinator.com/item?id=6234736">https://news.ycombinator.com/<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>item?id=6234736</a><br> derefr 1 day ago | link You know, every time I see some Googler shocked<br> at the effectiveness and various advantages of coding in Go, I wonder<br> why Google never adopted Erlang. They could have been getting all these<br> same advantages (and then some) a decade ago :)<br> <br> reply<br> <br> [GR:  Would Googl use an Erlang on its' search engine show?]<br> <br> <br> <br> <br> zaphar 1 day ago | link (full disclosure: I work at google and also like<br> erlang) Erlang has fantastic facilities for robustness and concurrency.<br> What it does not have is type safety and it's terrible at handling text<br> in a performant fashion. So if you don't care about either of those<br> things and only care about robustness and concurrency then Erlang is<br> great. There were internal discussions about Erlang here but the upshot<br> was. We had already basically duplicated Erlangs supervision model in<br> our infrastructure, only we did it for all languages and Erlang didn't<br> offer any benefits in performance for us. It's only benefit would have<br> been the concurrency model. That's much less benefit than Go gives. Go<br> gives you Erlangs concurency model, a similar philosophy of robustness,<br> type safety, all batteries included, and performance. Equating the two<br> languages works in 1 or 2 dimensions but not on all the dimensions<br> google cares about.<br> <br> reply<br> <br> derefr 1 day ago | link Interesting, thanks for that; it's pretty much<br> what I guessed (especially the bit about the supervision tree and<br> hot-code-upgrade advantages being mooted by your infrastructure.) On a<br> tangent, though: > What it does not have is type safety I've tried to<br> work this out before (I'm designing a new language for Erlang's VM), but<br> as far as I can tell, type safety is in practice incompatible with<br> VM-supported hot code upgrade. If you have two services, A and B, and<br> you need to upgrade them both, but you can't "stop the world" to do an<br> atomic upgrade of both A and B together (because you're running a<br> distributed soft real-time system, after all), then you need to switch<br> out A, and then switch out B. So, at some point, on some nodes, A will<br> be running a version with an ABI incompatible with B. In a<br> strongly-typed system, the VM wouldn't allow A's new code to load, since<br> it refers to functions in B with type signatures that don't exist. On<br> the other hand, in a system with pattern-matching and a "let it crash"<br> philosophy, you just let A's new code start up and repeatedly<br> try-and-fail to communicate with B for a while, until B's code gets<br> upgraded as well--and now the types are compatible again. It's an<br> interesting problem.<br> <br> reply<br> <br> laureny 1 day ago | link > type safety is in practice incompatible with<br> VM-supported hot code upgrade. That's not true. First, it's very easy to<br> hot reload changes that have been made to the code that are backward<br> compatible. The JVM spec describes in very specific details what that<br> means (adding or removing a method is not backward compatible, modifying<br> a body is, etc...). This is how Hotswap works, the JVM has been using it<br> for years. As for changes that are backward incompatible, you can still<br> manage them with application level techniques, such as rolling out<br> servers or simply allow two different versions of the class to exist at<br> the same time (JRebel does that, as do other a few other products in the<br> JVM ecosystem). Erlang doesn't really have any advantages over<br> statically typed systems in the hot reload area, and its lack of static<br> typing is a deal breaker for pretty much any serious production<br> deployment.<br> <br> reply<br> <br> rdtsc 20 hours ago | link > lack of static typing is a deal breaker for<br> pretty much any serious production deployment. Are you talking about<br> Google only where they made it a mandate or in general? There are<br> serious production deployments on Python, Ruby, Erlang and Javascript. I<br> will trade expressiveness and less lines of code with a strong but<br> dynamically typed language + tests over more a static typed language<br> with more lines of code all being equal. Or put it another way, if<br> strong typing is the main thing that protects against lack of faults and<br> crashes in production, there is a serious issue that needs to be<br> addressed (just my 2 cents).<br> <br> reply<br> <br> derefr 23 hours ago | link > As for changes that are backward<br> incompatible, you can still manage them with application level<br> techniques, such as rolling out servers or simply allow two different<br> versions of the class to exist at the same time (JRebel does that, as do<br> other a few other products in the JVM ecosystem). Neither of these allow<br> for the whole reason Erlang has hot code upgrade in the first place:<br> allowing to upgrade the code on one side of a TCP connection without<br> dropping the connection to the other side. Tell me how to do that with a<br> static type system :)<br> <br> reply<br> <br> pmahoney 10 hours ago | link Tomcat (and other app servers) has support<br> for doing hot reloads of Java web apps while not reloading the HTTP<br> layer (and not dropping TCP connections).<br> <a href="http://www.javacodegeeks.com/2011/06/zero-downtime-deploymen." target="_blank" data-mce-href="http://www.javacodegeeks.com/2011/06/zero-downtime-deploymen.">http://www.javacodegeeks.com/<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>2011/06/zero-downtime-<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>deploymen.</a>.. I have<br> implemented a similar system for JRuby apps running inside a Servlet<br> container. There are many caveats. I don't actually recommend it because<br> for a while you're using nearly twice the memory (and JRuby is<br> particularly memory hungry). Also there are many ways to leak the old<br> class definitions such that they are not GC'd (e.g. thread locals). But<br> it's certainly possible. I suspect that Erlang, Java, and all languages<br> are in the same boat: some parts can be upgraded live in the VM while<br> other parts require a full restart (maybe coordinating with multiple<br> nodes and a load balancer to achieve zero-downtime).<br> <br> reply<br> <br> lenkite 10 hours ago | link Out of curiosity, where/why would such an<br> exotic feature be needed in today's internet architectures where you<br> always front a group of servers with a load balancer ?<br> <br> reply<br> <br> butterflyhug 5 hours ago | link Not all Internet protocols are HTTP. If<br> you're running a service where long-lived connections are the norm,<br> "simply fronting a bunch of servers with a load balancer" can require a<br> pretty smart load balancer. E.g. IMAP connections often last hours or<br> even days, and are required to maintain a degree of statefulness.<br> <br> reply<br> <br> DanWaterworth 1 day ago | link Go gives you Erlangs concurency model<br> There are a number of significant differences between Erlang's and Go's<br> concurrency models: Asynchronous vs synchronous communication,<br> per-thread vs per-process heaps, send to process vs send to channel.<br> <br> reply<br> <br> dbaupp 1 day ago | link Go doesn't have strong type safety either; I<br> remember a recent story about a Go stdlib function "accidentally"<br> calling an interface it shouldn't.<br> <br> reply<br> <br> f2f 22 hours ago | link it wasn't accidental -- it was written on<br> purpose by a programmer (a conversion from Writer to WriteCloser). it<br> was immediately acknowledged as an error and eventually may be caught by<br> the standard code examining tool "vet".<br> <br> reply<br> <br> pcwalton 22 hours ago | link What would the static analysis that "vet"<br> is performing enforce to stop this? No interface-to-interface downcasts?<br> <br> reply<br> <br> .....<br> [It goes on, & on, & on & on,<br> when Go & Erlang party together.]<br> <br> ---  Join the BerkeleyTIP-Global mail list -   <a href="http://groups.google.com/group/BerkTIPGlobal" target="_blank" data-mce-href="http://groups.google.com/group/BerkTIPGlobal">http://groups.google.com/<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>group/BerkTIPGlobal</a>. All Freedom SW, HW & Culture.<br> <br> ______________________________<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>_________________<br> erlang-questions mailing list<br> <a href="mailto:erlang-questions@erlang.org" target="_blank" data-mce-href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank" data-mce-href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>listinfo/erlang-questions</a><br> <br></blockquote><br> <br></div></div><span class="HOEnZb"><span style="color: #888888;" data-mce-style="color: #888888;" color="#888888"> -- <br> Loïc Hoguin<br> Erlang Cowboy<br> Nine Nines<br> <a href="http://ninenines.eu" target="_blank" data-mce-href="http://ninenines.eu">http://ninenines.eu</a></span></span><div class="HOEnZb"><div class="h5"><br> ______________________________<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>_________________<br> erlang-questions mailing list<br> <a href="mailto:erlang-questions@erlang.org" target="_blank" data-mce-href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank" data-mce-href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/<span style="text-decoration: underline;" data-mce-style="text-decoration: underline;"></span>listinfo/erlang-questions</a><br></div></div></blockquote></div><br></div><br>_______________________________________________<br>erlang-questions mailing list<br>erlang-questions@erlang.org<br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote><div><br></div></div></body></html>