The video on-demand of this session is available to logged in QCon attendees only. Please login to your QCon account to watch the session.

Session + Live Q&A

Project Loom: Revolution in Java Concurrency or Obscure Implementation Detail?

Loom’s promise: simplify concurrency the way garbage collection simplified memory management. It became transparent and almost forgettable. It's an effort to bring lightweight threads to the JVM. Such threads have low memory and scheduling footprint so that you can create millions of them. Start new threads per each request or connection. Without worrying about memory footprint or context switching. Literally millions. Problems that Loom tries to address:

  • obscure non-blocking APIs
  • mysterious stack traces coming from reactive frameworks
  • pooling threads altogether

That's right; you may no longer need any ExecutorServices. To be honest, it's a leaky abstraction anyway that needs to be fine-tuned and monitored. What if you could simply spawn a new thread whenever it makes sense? Start thinking about tasks to perform, not physical threads that you must manage. Come and see how this radical shift can simplify your concurrent code.

In this talk, we'll explore:

  • what is Loom?
  • How it's implemented?
  • What problems does it solve?
  • What are the shortcomings?
  • Will it make reactive programming obsolete?

And finally, we'll learn that it's not a silver bullet, and it comes with its own set of issues.

Main Takeaways

1 Hear about Project Loom, how it helps in writing concurrent code.

2 Learn what are the pros and cons of using Project Loom to see if it’s desirable to incorporate it in a project.


What is the focus of your work these days?

I'm the CTO at DevSkiller. It's a company that specializes in recruiting, screening and managing talents in the tech industry. Our tagline is that we would test real skills as opposed to making sure you can invert a binary tree or do all sorts of algorithmic or very artificial questions, as many big companies are known for. How many balls you can fit into a jumbo jet and so on. We are on the opposite side of that spectrum. We are delivering a platform where candidates who wish to be hired in some nice company are actually doing real programming assignments with code repository with unit and integration tests. And our system makes sure that the homework of the assignment was correct. My role in the company as a CTO is two ways. It's a small company, I'm still doing a lot of development and a lot of code reviews and a lot of making design decisions plus recruiting on our own, dogfooding our own platform and trying to get the ball rolling, so to speak. I still love programming and I try to spend as much time as I can doing software development. I actually put slots in my calendar saying: “Here I'm doing software development, don't put any events here”. That's what I do on a daily basis.

What is the motivation for your talk?

I will be talking about Project Loom, which is not yet available. It's something that will be published with Java. We don't really know. Hopefully within a year or so. It's a project that allows us developers to write concurrent code in a much, much different way, in a much simpler way. Going into details, it will allow us to create millions of threads on the Java platform, which is right now absolutely impossible. This is somewhat similar to, for example, coroutines or goroutines that you can find in Kotlin and Go, respectively. It's built into the actual virtual machine, it's very performant, and this will enable developers as you and me to write very scalable code without worrying that much about memory consumption, without worrying about pulling threads and without fine tuning all this stuff. Hopefully, the reason I'm really excited about this talk is that it will enable developers and library designers to write concurrent code in a much simpler manner and to avoid unnecessary obstructions of pulling threads and paying attention to how much memory you consume. Because idle threats do not really do anything, they are just sitting there consuming memory. This is the main target of this project, and that's why I'm excited about.

How would you describe the persona and level of your target audience?

This is quite interesting because the way we are taught concurrency, in like, let's say, universities or when we are juniors, it's actually very similar to what product Loom offers. Because once you start off, you are taught that you can create a new thread per connection or new thread per request or whatever. And then after you gain some experience you are being taught that this is actually a very poor idea. That once you become a mid-level developer or definitely a senior, you know that creating threads over and over again is a poor idea. And now Project Loom says that what you can actually do that, this is actually a good pattern. We should definitely start with senior developers and architects who can now build solutions in a much more different way. However, if you go back to your team and describe this feature, then your junior developers will actually realize: hey, this is very simple. This is what we were taught in chapter one of concurrency. And that's saying you can forget about all the other chapters. It's just like, this will simplify things greatly.

What would you these personas to walk away with after watching your presentation?

Two takeaways, I would say. First of all, I would like people to get really excited because the project Loom may make your concurrent code much, much more readable, much easier to maintain, because you no longer have to deal with these low level details, pooling threads, making sure your queues are long enough. Tuning, monitoring, and so on. You just create treads as if it was a very native, very low footprint abstraction, which is not the case right now. The first takeaway is that this may revolutionize the way you work with concurrent code. That's why I'm excited about it. On the other hand, we can already see that even though the feature wasn't yet released, you have to be aware of the shortcomings. For example, now the garbage collector has to do much more work because the virtual threads that you can create in millions are actually subject to garbage collection, which means you will have a much harder time fine tuning garbage collectors. There's always a tradeoff. And also, there are a few other disadvantages or limitations of Project Loom that you must be aware of. Otherwise, you will just shoot yourself in the foot. There's no free lunch. I want people to get the best idea, what they can get and what are the best use cases for this new project and whether they should use it from day one, the moment it's released. Or maybe it's just a very specialized tool that they should never really look at because it's a matter of framework developers.


Speaker

Tomasz Nurkiewicz

Java Champion and CTO @DevSkiller

Spent half of his life on programming, for the last decade professionally in Java land. Loves back-end and data visualization. Passionate about alternative JVM languages. Disappointed with the quality of software written these days (so often by himself!), hates long methods and hidden side...

Read more
Find Tomasz Nurkiewicz at:

Date

Wednesday May 11 / 10:10AM EDT (50 minutes)

Track

Modern Java

Topics

JavaConcurrencyJVMGarbageCollection

Add to Calendar

Add to calendar

Share

From the same track

Session + Live Q&A Java

Deterministic, Reproducible, Unsurprising Releases in the Serverless Era

Wednesday May 11 / 09:00AM EDT

Serverless has many advantages, to reap the benefits from this recent paradigm your application must tackle new challenges. Testing and traceability introduce some new  considerations that may take by surprise even the most seasoned Java developer.In this session we will explore...

Ix-chel Ruiz

DA, Senior Software Developer @jFrog

Session + Live Q&A Java

Staying JDK: Current in Production

Wednesday May 11 / 11:20AM EDT

At the time of Qcon London, Java will have been on a fast release cadence for almost 5 years. This talk addresses the less often mentioned aspect: adopting JDK upgrades.  I will discuss different perspectives towards Java upgrades and possible migration paths. How to plan and execute an...

Andrzej Grzesik

Platform @RevolutApp

Session Java

Securing Java Applications in the Age of Log4Shell

Wednesday May 11 / 12:30PM EDT

Due to unforseen circumstances, the speaker is no longer available for a Q&A. Please post any questions you have in the Announcement Slack channel.On December 10th 2021, a new critical vulnerability, Log4Shell, was publicly disclosed and make global headlines. It impacted a wide number of...

Simon Maple

Field CTO @snyksec

View full Schedule