TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Optimising for Concurrency: Comparing the BEAM and JVM virtual machines

185 pointsby francescocabout 5 years ago

9 comments

eggsnbacon1about 5 years ago
the author leaves out Kotlin which adds support for coroutines on the language level and still compiles to java bytecode. These are not classic continuations because they cannot be cancelled, but they&#x27;re still very useful and true fibers.<p>There&#x27;s also the Quasar library that adds fiber support to existing Java projects, but its mostly unmaintained since the maintainers were pulled in to work on Project Loom.<p>Then there&#x27;s Project Loom, an active branch of of OpenJDK with language support for continuations and a fiber threading model. The prototype is done and they&#x27;re in the optimization phase. I expect fibers to land in the Java spec somewhere around JDK 17.<p>I figure its fair to mention these as the authors criticisms are somewhat valid but will not be for very long (few years max?)<p>In summary: Java will have true fiber support &quot;soon&quot;. This will invalidate the arguments for Erlang concurrency model. They are already outdated if you are okay using mixed java&#x2F;kotlin coroutines or Quasar library<p>The newer Java GC&#x27;s Shenandoah and ZGC address authors criticisms of pause times. They already exist, are free, and are in stable releases. Dare I say they are almost certainly better than Erlang&#x27;s GC. They are truly state of the art, arguably far superior to the GC&#x27;s used in Go, .NET, etc. Pause times are ~10 milliseconds at 99.5%ile latency for multi terabyte heaps, with average pause times well below 1 millisecond. No other GC&#x27;ed language comes close to my knowledge. His points 1 and 2 no longer exist with these collectors. You don&#x27;t need 2X memory for the copy phase and the collectors quickly return unused memory to the OS. This has been the case for several years.<p>Hot code reloading. JVM supports this extensively and its used all the time. Look into ByteBuddy, CGLIB, ASM, Spring AOP if you want to know more. Java also supports code generation at build time using Annotation Processors. This is also extensively used&#x2F;abused to get rid of language cruft
评论 #23174745 未加载
评论 #23176147 未加载
评论 #23176596 未加载
评论 #23176078 未加载
评论 #23176739 未加载
评论 #23173240 未加载
评论 #23173044 未加载
Traubenfuchsabout 5 years ago
&gt; Programming with concurrency primitives is a difficult task because of the challenges created by its shared memory model.<p>I never understood this often repeated point. As junior &#x2F; mid-level developer I had the privilege to run self written .jar files on government scale systems with more than 50 cores. I used Java thread pools and concurrent data structures to do heavy cross thread caching.<p>It was all pretty simple and concurrency &amp; parallelism were never an issue but simply a necessity to make things run fast enough.<p>Am I a concurrent programming genius? Were the types of problems&#x2F;challenges I was solving too simple? When is concurrency in Java ever hard+?<p>+ I know about Java masterpieces like the LMAX Disruptor that are mostly beyond my skill level, but those are low level writte-once libraries you wouldn&#x27;t write yourself.
评论 #23171198 未加载
评论 #23174139 未加载
评论 #23171642 未加载
评论 #23171418 未加载
评论 #23170835 未加载
评论 #23170580 未加载
评论 #23171536 未加载
评论 #23174846 未加载
评论 #23172416 未加载
jphabout 5 years ago
BEAM is amazing and IMHO there&#x27;s one very sweet spot ready for optimization: math functions. I know I can escape out to C&#x2F;Rust&#x2F;etc. yet the majority of what I do is simple float math such as stddev and vector normalization.<p>The article states benchmark of 5000% speedup on floats when switching from BEAM to the JVM. I would like to offer $100 as a gift incentive to anyone here who wants to work on optimizing BEAM math.
评论 #23170122 未加载
评论 #23171630 未加载
评论 #23172309 未加载
评论 #23172056 未加载
hinkleyabout 5 years ago
Can someone steer me to some good benchmarks, discussions of perf characteristics and gotchas of the BEAM? My search-fu is weak and I&#x27;m not finding the sort of content I&#x27;m after.<p>I&#x27;m trying to learn Elixir and being a systems thinker so before I (can) get too comfortable I&#x27;m gonna want to dive into origin stories to build up my holistic map of why things are the way they are, what can be done and what can&#x27;t be done, and understanding bottlenecks in the BEAM seems like it&#x27;s gonna have to be part of that (the way I studied JVM tech documentation when I did perf and architecture work in Java)
评论 #23170206 未加载
评论 #23170519 未加载
shawnzabout 5 years ago
The JVM supports hot code loading, although this article seems to imply only BEAM supports it.
评论 #23172709 未加载
评论 #23170797 未加载
exabrialabout 5 years ago
They mentioned this for the beam virtual machine but not for the JVM, the JVM actually can also do hot code loading as long as call site signatures are not changed or added. In some cases you you can make major changes to the current stack and restart the frame which is a pretty handy feature for developer. Some commercial extensions to the JVM get around all of these limitations.
alfanerdabout 5 years ago
Of interest might also be Erjang, Kresten Krab&#x27;s port of BEAM to JVM. <a href="https:&#x2F;&#x2F;github.com&#x2F;trifork&#x2F;erjang" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;trifork&#x2F;erjang</a><p>As I understand it, it is feature complete and actually runs Erlang pretty well. Could be interesting to see some benchmark testing.
ForHackernewsabout 5 years ago
Apparently this is an Erlang BEAM, not Apache BEAM <a href="https:&#x2F;&#x2F;beam.apache.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;beam.apache.org&#x2F;</a>?
评论 #23171531 未加载
jeffrallenabout 5 years ago
Tl,dr. The point seems to be, &quot;shared nothing makes concurrency and GC easy&quot;. Congrats. But also lots of big fast systems use shared memory, so just relax, STFU, and understand that tradeoffs exist.