It looks more closer to go routines, which to me begs the question - where are the channels that I could use to communicate between these virtual threads?
Achieving 5M persistent connections with Project Loom virtual threads
81–90 of 150 posts
Re: Achieving 5M persistent connections with Project Loom virtual threads
#82Earlier quoted context omitted.
No, it doesn't. The reason the tweaks are at the OS level is because, apparently, Loom-enabled JVMs already scale up to that level without needing any tuning. But if you try that in C++ you're going to die very quickly.
There have been userspace thread libraries for c++ for decades.
Re: Achieving 5M persistent connections with Project Loom virtual threads
#83The experiment is about Java app, but the tweaks are at the O/S level. Does it mean any app (Java/not, Loom/not) can achieve target given correct tweak? Also, why are these not default for the O/S? What are we compromising by setting those values?
For application level, it's going to depend on how you handle concurrency. This post is interesting, because it's a benchmark of a different way to do it in Java. You could probably do 5M connections in regular Java through some explicit event loop structure; but with the Loom preview, you can do it connection per Thread. You would be unlikely to do it with connection per Thread without Loom, since Linux threads are very unlikely to scale so high (but I'd be happy to read a report showing 5M Linux threads)
Re: Achieving 5M persistent connections with Project Loom virtual threads
#84It looks more closer to go routines, which to me begs the question - where are the channels that I could use to communicate between these virtual threads?
Re: Achieving 5M persistent connections with Project Loom virtual threads
#85It looks more closer to go routines, which to me begs the question - where are the channels that I could use to communicate between these virtual threads?
Re: Achieving 5M persistent connections with Project Loom virtual threads
#86Earlier quoted context omitted.
A couple of points to consider. 1. Demanding scalability for inappropriate projects and at any cost is something I've seen too, and on investigation it was usually related to former battle scars. A software system that stops scaling at the wrong time can be horrific for the business. Some of them never recover, the canonical example being MySpace, but I've heard of other examples that were less public. In finance ent…
One additional - as noted, it's been 26 years since Java's founding. Project Loom has been around since at least 2018 and still has no release date. It'll be cool for Java projects whenever it comes out, but I just...have a hard time caring right now. I can't use it for old codebases currently, and new codebases I'm not using one request per Java thread anyway (tbh - when it's my choice I'm not choosing the JVM at al…
Re: Achieving 5M persistent connections with Project Loom virtual threads
#87A bit of a digression, but I’d love to see how much further one could go with a memory-optimized userland TCP stack, and storing the send and receive buffers on disk. A TCP connection state machine consists of a few variables to keep track of sequence numbers and congestion control parameters (no more than 100-200 bytes total), plus the space for send/receive buffers. A 4 TB SSD would fit ~125 million 16-KB buffer pa…
Moving 100M connections for maintenance will be a giant pain though. You would want to spend a good amount of time on a test suite so you can have confidence in the new deploys when you make them. Also, the client side of testing will probably be harder to scale than the server side... but you can do things like run 1000 test clients with 100k outgoing connections each to help with that.
Re: Achieving 5M persistent connections with Project Loom virtual threads
#88It looks more closer to go routines, which to me begs the question - where are the channels that I could use to communicate between these virtual threads?
Go's channels are simplistically a mutex in front of a queue. Java has many existing objects that can do the same, it's just that's not idiomatic best choice to do the same. Since green threads should wake up from Object.notify(), any threads blocking on the monitor should wake/consume. I'm curious how scalable/performance a green thread ConcurrentDequeue would stand up to go's channel.
Re: Achieving 5M persistent connections with Project Loom virtual threads
#89Earlier quoted context omitted.
> I'm not using one request per Java thread anyway The point is with Loom you can, and you can stop putting everything into a continuation and go back to straight-line code.
>> The point is with Loom you can The point I was making is that Loom isn't released, stable, production ready, supported, etc, and there's no still no date when it's supposed to be, so what you can do with Loom in no way affects what I can do with a production codebase, either new or legacy. I'm not sure how you missed that from my post. I'm not defending reactive programming on the JVM. I'm also not defending threa…
September 20 (in Preview)
> I'm saying I can get the benefits of Project Loom -right now-, in production ready languages/libraries, outside of the JVM
Only sort-of. The only languages offering something similar in terms of programming model are Erlang (/Elixir) and Go — both inspired virtual threads. But Erlang doesn't offer similar performance, and Go doesn't offer similar observbility. Neither offers the same popularity.
Re: Achieving 5M persistent connections with Project Loom virtual threads
#90Earlier quoted context omitted.
There's always trade-offs. It would be very rare for any server to reach even 100K concurrent connections, let alone 5M. Optimising for that would be optimising for the 0.000001% case at the expense of the common case. Some back of the envelope maths: https://www.wolframalpha.com/input?i=100+Gbps+%2F+5+million If the server had a 100 Gbps Ethernet NIC, this would leave just 20 kbps for each TCP connection. I could im…
Open, idle websockets can be a use case for a large amount of tcp connections with a small data footprint.