News for hackers. Stuff that matters.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by diminoten on Wednesday July 03, 2019 @05:46PM (#20349170)
> - No more Ruby on Rails because no good way was found to scale it organizationally; almost everything is now Go microservices back + React front

Ugh, I just... I keep trying to pretend I don't need to learn Go, but every highly scalable system I read about that's recently been written about seems to be using it. Maybe I just need to stay away from systems that need to scale? Heh...

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by snaky on Wednesday July 03, 2019 @05:59PM (#20349322)
The keyword here is organizationally.

Technically speaking you can build scalable systems using anything you want. But if you need to hire a couple of hundreds developers, you better go with Java 7 or Go than Ruby, Lisp or Perl. The dumber and more uniform the better.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by ummonk on Wednesday July 03, 2019 @06:27PM (#20349560)
The key distinguisher there is static typing. Which is how Facebook manages to make do with PHP, and Dropbox with Python. By adding top annotations for a static type-checker...
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by snaky on Wednesday July 03, 2019 @07:45PM (#20350167)
Static typing doesn't help you much, when you have 20 teams hating each other and 20 different ways to write statically typed C++ code.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by viraptor on Wednesday July 03, 2019 @06:54PM (#20349755)
It would be interesting to hear a comparison from someone using https://crystal-lang.org/ at scale. It's basically Ruby + types, which would make it the closest for isolating that one feature. It can't run Rails, but there are very similar web frameworks available.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by mcpherrinm on Wednesday July 03, 2019 @07:02PM (#20349824)
It seems Stripe solved this problem with https://sorbet.org/ which is actually Ruby + types.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by viraptor on Wednesday July 03, 2019 @07:08PM (#20349879)
It misses other benefits of static typing -> being able to compile to efficient code. Also Sorbet is still not popular enough to apply to many gems - it's a lot of work to implement it at the moment.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by pkd on Thursday July 04, 2019 @08:10PM (#20358869)
It's not Ruby + types, it just looks like it at first glance. The semantics are all diffrent (for good reasons).

I very much doubt that anyone is using Crystal at the scale Ruby/Rails is used yet. It's still far away from a 1.0 release and when I tried out 0.23 it had several issues, major ones for me were lacklustre debugging support and the type checker needing to load the whole AST into memory. Concurrency story was also not very strong but I know people were working on it actively at least.

Anyway, I wrote a non-trivial project in Crystal and overall really enjoyed it. Improving the debugging tooling would go a long way towards making it a real option.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by rhizome on Thursday July 04, 2019 @12:05AM (#20351418)
I've heard Crystal's Ruby resemblance fades once you get past the beginner stage.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by jchw on Wednesday July 03, 2019 @07:23PM (#20350015)
Personally, I think it’s hugely worth learning. Aside from some eschewed defacto behaviors, Go is very easy to pick up and learn the entirety of in a week or two, because the language itself is really not that large. So I’d argue the time investment is a good one for what you get.

Still, you definitely do not need Go to scale systems. People scale Everything, perhaps most impressively PHP applications.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by echelon on Wednesday July 03, 2019 @05:55PM (#20349281)
Go isn't the only language that scales, it just happens to be popular amongst the scripting language crowd as a next step. You're by no means limited in your choice. You could do Java, C#, Rust...
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by empath75 on Wednesday July 03, 2019 @07:47PM (#20350180)
The good news is that it takes like an hour to learn enough go to be productive.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by apta on Wednesday July 03, 2019 @10:29PM (#20351008)
Before golang was a thing, there were highly scalable systems that handled way more traffic than anything written in golang today. Those systems were (and are) written in languages like C++ and Java and C#.

You're just seeing golang in articles because of hype.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by hactually on Thursday July 04, 2019 @05:31AM (#20353002)
Java and C# lag behind Golang on most performance metrics. Combine it with the awesome deployment story (single binary) and you'd be hard pressed to choose the former
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by apta on Thursday July 04, 2019 @11:27AM (#20355382)
I'd like to see those performance metrics. Other than that, this is not true to the slightest, not just from what I observed, but from established performance people like Martin Thompson[1]. If you watch that talk, he mentions towards the end that they ported Aeron (originally Java) to C#, golang, and C++. The Java version was the fastest out of the box, but with some work, they were able to get the C# version to be faster. I suspect this mainly has to do with value types, which is being developed for the JVM as well.

What you're probably referring to is GC pauses. The golang GC is tuned for latency, at the expense of throughput. The JVM has several GCs, and is gaining several more like Shenandoah and ZGC, which allows you to select the GC that best fits your use case. You can tune for latency or throughput.

A lot of Java deployments these days are in the form of uber/shaded jars, which is basically one jar file that contains the entire app, and run with a single command, not much different than running a binary.

[1] https://www.youtube.com/watch?v=Pz-4co8IaI8

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by MrBuddyCasino on Thursday July 04, 2019 @05:50AM (#20353080)
The opposite is true. Golang is on average 2-3 times slower than Java. On the plus side, it uses less memory.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by LOLOLOLO1 on Thursday July 04, 2019 @07:50AM (#20353707)
No of course. It may loses at some benchmarks made by Java or Python/Ruby coders.

Two areas where it is actually slower are

1) Memory allocation 2) Regular expression performance.

But you must understand your Java app won’t have performance advantage because of faster alloc speed IRL: GC will take lots of CPU, because Go’s one is much easier at memory release. You can only see allocation advantage in micro benchmarks where the app stops before the GC will start.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by apta on Thursday July 04, 2019 @11:41AM (#20355478)
> You can only see allocation advantage in micro benchmarks where the app stops before the GC will start.

The golang gc is tuned for latency at the expense of throughput, meaning if you look at the duration of time spent in GC over the course of the code execution, it would actually be longer compared to a GC tuned for throughput.

If you have a use case that requires high throughput, then you cannot change the GC behavior. Unlike on the JVM, where you have several GCs to choose from. The JVM is also getting two new low latency GCs for use cases that require low latency.

And it's not just microbenchmarks where Java does better than golang, it's especially longer running processes where the JVM's runtime optimizations really kick in. Not to mention that the JVM is getting value types as well to ease the load on the GC when required (it does an excellent job as it is even without value types).

I did a dummy port of the C# version of the Havlak code here[1] to Java, preserving the same behavior and not making any data structure changes. On the machine I tested on, the C# version took over 70 seconds to run, while the Java version took ~17 seconds. In comparison, the C++ version took ~24 seconds, and the golang version took ~30 seconds.

Yes, you could most likely spend much more time tuning the C++ version, avoiding allocations, and so on, but at the expense of readability. This is what the JVM gives you, you write straight-forward, readable code, and it does a lot of optimizations for you.

The brainfuck2 benchmark is especially interesting. Kotlin tops the list, but I was able to get Java to the same performance since Kotlin by writing it in a similar manner as the Kotlin code. Again, Java/Kotlin beat out even C++ when I tested them, and by quite a margin.

[1] https://github.com/kostya/benchmarks

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by barrkel on Thursday July 04, 2019 @08:53AM (#20354125)
How much CPU GC takes for any given GC implementation is largely down to the design of the application, its data structures and allocation graph.

Request / response servers which keep caches and other allocations prone to middle age death out of the GC heap are consistent with the generational hypothesis and ought to spend no more than a few (low single digit) percent in GC with a generational collector.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by Xelbair on Thursday July 04, 2019 @07:52AM (#20353716)
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by dcu on Thursday July 04, 2019 @11:17AM (#20355288)
these microbenchmarks doesn't say anything about real world use cases... but anyway, here are the latest results:

https://www.techempower.com/benchmarks/#section=data-r17&hw=...

c#, rust, go, c++, java, c, nim.. all tied at 7M.

again, this doesn't mean anything useful.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by apta on Thursday July 04, 2019 @11:47AM (#20355526)
This benchmark isn't really useful as you pointed out. Microbenchmarks are always tricky, but check out the other two posts I just wrote here (about Martin Thompson and the benchmarks on GitHub) for hopefully more realistic benchmarks.
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by theredbox on Thursday July 04, 2019 @05:33AM (#20353011)
It's not about hype but companies using more recent languages to solve the same problem. Why did not Twitch pick Crystal or Rust or Scala or JRuby ?
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by pkd on Thursday July 04, 2019 @08:16PM (#20358901)
Because of the use case. Go wins if all you need is the easiest way to write services with high concurrency requirements. I expect this is true for Twitch's systems.

Crystal is still immature, Rust is more suited to use cases where you want to avoid garbage collection.

Hype is not the only factor but it makes hiring easier. And anything Google puts its weight behind will get hyped. More often than not it's better to choose a technology which suits your organisational (read: hiring) needs.

Re:Justin.tv's Live Video Broadcasting Architecture (2010) by apta on Thursday July 04, 2019 @07:07PM (#20358510)
I'd argue that Java or C# would have worked out just fine for Twitch. There was a recent post on Twitch's early architecture, and it seems they started out with Ruby. Unsurprisingly, they had to switch from it once they needed performance (similar story happened with Twitter).
Re:Justin.tv's Live Video Broadcasting Architecture (2010) by hajhatten on Thursday July 04, 2019 @03:56AM (#20352517)
Well deserved hype