5 ms·
> While historically Uber has been mostly a Node.js and Python shop, the Go language is becoming the language of choice for building many of Uber Engineering’s
by artursapek 11y ago
> While historically Uber has been mostly a Node.js and Python shop, the Go language is becoming the language of choice for building many of Uber Engineering’s new services.
It feels like this type of narrative is becoming more common.
- lcfcjs 11y agoOr actually the truth is the exact opposite. Javascript is exploding right now.
- hughw 11y agoI was surprised that they felt Node's performance was slower for computation, given the effort V8 has put into optimization. Particularly he called out "interpreted" and "dynamic-typed". But V8 compiles and optimizes frequently used functions, and recompiles running functions when it detects that they are being called with the same runtime types repeatedly. This runtime optimization can't be quite as fast overall as Go, but I'd be surprised if well-designed JS couldn't run 60-80% as fast. Maybe that's enough difference for them to make the switch.
- hughw 11y agoIt's chickens*t to down vote my comment, when you could argue a fact, or explain something to me that I don't understand. My question isn't silly. I just now wrote two short programs, one in Go and one Javascript, to run a vector multiply and add on two length 1000 vectors, a million times. The JS program is faster. Result (in seconds): $ node vmadd.js 0.984 $ go run vmadd.go 1.141044662 JS code: https://gist.github.com/hwinkler/62c9da0d9f2d8c7981b0 https://gist.github.com/hwinkler/62c9da0d9f2d8c7981b0 Go code: https://gist.github.com/hwinkler/d234bb62b2c5fa081a50 https://gist.github.com/hwinkler/d234bb62b2c5fa081a50
- thwarted 11y agoThis is obviously a highly scientific experiment! I get the exact opposite results!
- hughw 11y agoEven if you got the opposite numbers, it shows that the js code is nearly as fast as the go code.
- _ph_ 11y agoGo run first compiles the code and builds an executable. You are mostly benchmarking for both systems the compilation time. Building an executable in Go takes most of a second. A significant benchmark would check the run times.
- artursapek 11y agoExactly. Build it and then benchmark the binary. Nobody uses `go run` in production.
- hughw 11y agoNo, if you examine the code, you'll see the timer times only the accumulated execution time for the loop. The code has been compiled. See below to eliminate doubt -- I used go build and got similar numbers.
- cdelsolar 11y agoI think the bigger issue here is that Node is blocking while a computationally intensive algorithm is running whereas Go can have multiple goroutines still serving requests while running the algorithm.
- kintamanimatt 11y agoYou just take the computationally expensive work and run it elsewhere, like a worker pool. This is a standard pattern for this kind of work and what you would do with go too, except the worker pool might just be a number of goroutines.
- sloppyfocus 11y agoI work at Uber. We've discovered that in terms of average response time, our node services have remarkable performance. For example, some of our fastest node services have 1-5ms p95 response time. When you start diving into the p99 latency, garbage collection pauses can spike response time to tens or hundreds of ms, and eliminating these spikes is incredibly nontrivial.
- nailer 11y agoIs it possible to tune the V8 GC in the same way trading environments (or anywhere where RAM is cheaper than latency) do for Java?
- physguy1123 11y agoUsually, financial companies will use one of the commercial realtime jvms - it's not just some tuning. Javascript being singlethreaded would certainly simplify having a pauseless GC but it's still a nontrivial problem and I'm not sure how much that would benefit the browser use case.
- nailer 11y agoUnderstood. Small point: I wasn't discussing browsers (nor was the article).
- extrapickles 11y agoIts more of a application life-cycle thing rather than Node.js/Python being bad. One creates the first version in Node.js/Python as its quick to build and iterate an app. At this stage you are still hammering out exactly how things need to be done and accessing the actual needs of your users. Speed of iteration is the most important attribute for any choice made during this stage as generally you don't have enough scale for choices to matter much and it prevents wasted effort on things that end up on the cutting room floor. Once you have built the app, and it gets stable major feature wise, you then have plenty of data to drive decisions about what the pieces actually need to be and the tool best suited for them. Go happens to be well suited for swapping out various generic back end pieces with something custom to the problem at hand. Another way to think about it is the Node.js/Python version is the next step up from diagramming the app out on paper. Its more like the previsulazation stage of a movie (roughly animated, with intern voiceovers). This is important as it can save you a bunch of time on things that are unneeded and can help identify problem areas you should focus on first.
- dllthomas 11y ago"One creates the first version in Node.js/Python as its quick to build and iterate an app." That's the narrative, but I don't find Python (I have minimal experience with Node) faster to write in any way but library availability, and very painful to refactor without the ability to reach for a type checker.
- deleted 11y ago[deleted]
- nitwit005 11y agoOr, they're just following what's trendy, and node stopped being cool.
- VeejayRampay 11y agoIt's the classic point in time when Node.js is not the cool kid on the block anymore. Passionate Node.js programmers should rejoice.
- bliti 11y agoGo is lighter than the other two. It can run on lesser hardware (or resources) and is pretty much reliable. The code is easy to write and simple. I don't get to "enjoy" too many smart hacks from others in Go. Its a nice language for what it was meant to do: systems programming. Although Elixir is really shaping up to be a solid competitor. Elixir's syntax and idioms are easier to read, IMO.
- nailer 11y agoAlso Elixir's crazy fast: Phoenix apps with no tuning handle most GETs in 5-10ms.
- bliti 11y agoIt is indeed fast. I'm just waiting for it to mature a little bit more to use it in production. My goal is to start working on production system after summer 2016. By the, more information about gotchas and issues should have arose.