8 ms·
Great article. The JVM is one of the most astonishing pieces of software ever created. I was looking at gRPC benchmarks the other day (https://github.com/Lesny
by thinkharderdev 5y ago
Great article. The JVM is one of the most astonishing pieces of software ever created.
I was looking at gRPC benchmarks the other day (https://github.com/LesnyRumcajs/grpc_bench/wiki/2021-08-30-bench-results https://github.com/LesnyRumcajs/grpc_bench/wiki/2021-08-30-b...) and 6 of the top 7 performing gRPC implementations on 3 core CPUS were on the JVM.
- srazzaque 5y agoCompletely agree. Say what you will about Java (the language), the JVM is a seriously good piece of kit.
- bognition 5y agoJava is a fantastic language. It's simple and in the right environment can be elegant. It's incredibly easy to ramp up new engineers on it and the tooling thats available make discovery and navigation a breeze. It may lack a lot of the fancier features of some newer languages but its still a very effective language.
- cygned 5y ago> It may lack a lot of the fancier features Coming from JavaScript, TypeScript, Python and Go back to Java I can tell you that’s actually a good thing.
- bognition 5y agoAgree 100%. Let me build stuff using simple easy to understand tools. Cleverness in code starts working against you as a code base and organizations scale.
- throwaway894345 5y agoDoesn’t Java tend to have a lot of cleverness/magic? Pretty crazy runtime codegen, reflection, etc? Spring and other DI frameworks seem overly clever to me, as do many ORMs. I guess my standard for a simple, minimal-magic language is Go.
- bognition 5y agoYes but idiomatic java doesn't require you to use those thing.
- throwaway894345 5y agoWhat does “cleverness” refer to then? Couldn’t I equally argue that idiomatic Python (or any other language) doesn’t require I use cleverness? And if so, what sense is there in praising Java for its lack of cleverness?
- cygned 5y agoThe aspects mentioned (Spring, DI containers, ...) are tool on top, though. If we just look at the language, I'd argue Java is boring - which is a good thing for certain types of applications. In languages like JavaScript, you have a number of ways to do things with all kinds of different syntaxes. In Java, there are fewer, but well understood options, that sometimes require more and sometimes require less actual code to achieve the same thing. This is highly subjective, if course.
- throwaway894345 5y agoOk, I understand your meaning, and I agree that gratuitous syntax sugar is a bummer; however, I've never found it to be particularly problematic. On the other hand, I have found a culture of magic/cleverness and a magical ecosystem to be problematic--this is one of my bigger grievances with Python after a decade and a half of experience.
- cygned 5y agoI am leading a transition from TypeScript to Java + Spring Boot and comparing those side-by-side, Java is significantly easier to follow. In TypeScript, we have a (from my point of view) too complex type system and features like destructuring and spreading, that sound smart but actually make it difficult to understand if you are not the author of the piece in question. What do you find magical in terms of Python in particular?
- _bohm 5y agoMy experience with Go is that it's quite a bit more stripped back of a language than Java. Could you explain what you mean by this?
- skinkestek 5y agoI love Java but happen to like TypeScript a lot, at least the way we write it. The rest of them I've been enthusiastic about for a few weeks until reality catches up with me and I realize what I am missing out on.
- AmpsterMan 5y agoI find it interesting that you'd lump Go with those languages. Java and Go are my favorite languages to code in for muchof the same reasons.
- thinkharderdev 5y agoYeah, I have my complaints about Java the language (and mostly use Scala myself) but the tooling for Java development is really compelling. Everything just works (IDE, debuggers, etc) and idiomatic Java code tends to be very high performance without a ton of special effort required for performance tuning. And if you do need to do performance tuning, the tooling for metrics and performance tuning is also amazing. One of the most underrated aspects of building on the JVM is that the runtime itself provides a lot of visibility into runtime performance "out of the box". If I do have to debug performance issues, I can just fire up JFR and get a ton of useful metrics about performance bottlenecks with no changes to the actual source code. I can even run JFR on my production workloads and get great visibility into the were the "real world" performance bottlenecks are happening.
- scopendo 5y agoAll I want is named parameters so that I don't need to have N variations of the same method with different signatures, also particularly helpful for understanding boolean parameters.
- bognition 5y agoNamed parameters are great but RequestTypes are better. It lets you roll validation into the request type itself which helps clean up methods a ton
- grumpyprole 5y agoIf Java had anonymous (structural) records, then named arguments could just be a function with a parameter that has a record structural type. It could even be given syntactic sugar, something like: foo{ bar=true, baz=true }
- qsort 5y agoMy main complaint is the treatment of generics and lack of value types, which are actually two sides of the same coin. Another thing I'd like to see is opt-in null safety. The Optional type is a very good mechanism, but when every reference is potentially null, its ability to enhance language safety is limited. Other than that, it has everything I want. And of course, the ecosystem, tooling, etc. is simply the best in class. My personal preference is for ML-style languages, so Java will never be my true love. But as far as languages go, you can do much worse.
- knuthsat 5y agoI think there's work being done on value types in Java. Although this was the case 6+ years ago. I'm surprised they still didn't land into Java.
- papercrane 5y agoJEP 169 is for value objects and JEP 218 is for generics over primitives. As the grandparent comment said they go hand-in-hand. My sense is they're more concerned about getting it right then getting it shipped, as both have been in the works for years.
- qsort 5y agoYeah, it doesn't look like Project Valhalla will land before the next LTS. The original separation of primitive types and reference types was necessary when Java was first released, but it's a deal with the devil. It made everything else much harder than it could have been otherwise. Even then we won't have fully reified generics, but some of the stuff they're doing with type projections is insane. I'm pretty sure it's going to be a game changer.
- native_samples 5y agoUse Kotlin to get null safety (and more), plus the ecosystem and tooling.
- qsort 5y ago
- kaba0 5y agoWhat I especially like about Java that it moves slowly, but when it does, it is a very thought out feature. For example, here’s one on the future of a seemingly trivial feature, string interpolation: https://github.com/openjdk/amber-docs/blob/master/site/design-notes/templated-strings.md https://github.com/openjdk/amber-docs/blob/master/site/desig...
- Thaxll 5y agoJava is anything but simple, all the major framework are heavy duty things behind layers of magic abstraction and un-necessary complexity. Did you worked with Spring, Hibernate / random ORM and all the "enterprise" frameworks?
- bognition 5y agoYeah, Java can be bad, but thats more the old school enterprise frameworks. A lot of newer things in Java are much simpler and easier to use. You can be very successful building out your own framework using things like Guice, Guava, and Dropwizard. It lets you pull in what you want and leave out the things you don't need.
- vips7L 5y agoHelidon, Quarkus, Javalin etc. There's plenty of options if you want to build your framework yourself.
- deleted 5y ago[deleted]
- ohgodplsno 5y agoSo, the libraries that some developers have to use are complex. Not the language itself. Additionally, Spring Boot exists and is lightweight and super easy to understand, jooQ is an ORM/query builder that makes Hibernate look like a toy (and it super simple). Just because Java gets tainted by overengineering doesn't mean the language itself isn't simple.
- thinkharderdev 5y agoYeah, to me that's the most amazing thing about it. That the JVM has become an actual platform on which many languages are able run and get the amazing performance of the runtime. In the gRPC benchmarks the top spot is actually akka-grpc which is mostly written in Scala!
- The_rationalist 5y agoAnd Kotlin give the best of both worlds
- pjmlp 5y agoAnd .NET as well, given the value types and low level improvemetns done since 7.0.
- thinkharderdev 5y agoI was very much on the Java/JVM side of the Java v .NET wars of the early 2000s (mostly because of an instinctive distrust of MS and the imo better OSS ecosystem around the JVM) but still always though that C# was the better-designed language.
- pjmlp 5y agoSame here, but as things turned out, I keep jumping between both ecosystems. There are good things and bad ones across both of them. Both also provide enough rant material. :)
- Mikeb85 5y agoC# is a nice language but the JVM is the better VM. And you have other languages on the JVM like Kotlin and Scala. Plus Java is getting nicer as time goes on.
- pjmlp 5y agoF# is nothing to throw away as well, and the CLR has native support for C++. You know that thing, which WebAssembly is trying to clone.
- torginus 5y agoI really like .NET, but I feel like their GC implementation is really lacking in performance. Their codegen is great, that's why their focus was on trying to reduce the amount of allocations in the past few releases. I've recently written a pretty compute-heavy app in .NET 5 that generated some garbage (mostly nursery stuff), and I tried to run it on a 16-core CPU. The results were disappointing, even with the Server GC, mainly due to the fact that the GC still does a ton of stop-the-world pauses, and the amount of garbage basically scaled linearly with the number of threads. My benchmarking results indicated that adding more than 8 threads were basically pointless, since the increased garbage meant that more time was spent in STW GC mode. I 'fixed' the perf issue, by eliminating all GC allocations, which alone resulted in a 2x speedup per thread, and allowed basically perfect scaling across cores. In the day and age where you can rent 64 core CPU VMs for $2/hour, I wish they would spend more engineering effort on fixing this.
- wesnerm2 5y agoYou shouldn't read too much from the benchmarks. The gRPC libraries are primarily developed by Google. Google pours most of its development resources on its core languages: Java, Javascript, Go, C++, and Python. Google then allocates a developer to port the implementation to other languages and platforms. C++, unlike Java, is not typically used for cloud development, so I don't think a lot of resources were allocated for the language. You can see how the difference in implementation effort can impact performance by comparing dotnet_grpc (Microsoft's fork) against csharp_grpc (Google's original implementation). There's more than a sevenfold improvement in req/s in Microsoft's implementation in the 1 CPU server case (35070 vs 5337), outperforming nearly all the Java benchmarks. Also, many of those top performing JVM implementations are the same code running under a different garbage collector. .NET has two GCs each with a parallel option, but we only see one benchmark using likely the slower GC (Workstation GC instead of ServerGC).
- thinkharderdev 5y agoYeah, they are microbenchmarks so should definitely be taken with a grain of salt but the top performing one (on 3 CPUs) was akka-grpc which is definitely not built by Google and uses akka's native HTTP/2 stack. It's not even written in Java for the most part but mostly Scala.
- victor106 5y ago> It's not even written in Java for the most part but mostly Scala. Scala still runs on the JVM.
- Zababa 5y ago> C++, unlike Java, is not typically used for cloud development, so I don't think a lot of resources were allocated for the language. I though most of Google's infrastructure (such as Borg or things like that) was in C++.
- Matthias247 5y ago> C++, unlike Java, is not typically used for cloud development, so I don't think a lot of resources were allocated for the language. I think actually its the opposite, and the C++ implementation had seen most activity. Some other implementations (e.g. the node.js one, the initial version of .NET support, and also the rust_grpcio flavor) had been built on top of Googles C++ gRPC core library. I am not sure however if some of those now have moved to more native implementations recently, since I haven't followed the development closely.