clojure-uk

seancorfield 2025-10-21T12:34:40.155079Z

Morn'... having some not-fun with the latest core.async alpha and vthread targeting 😐

dharrigan 2025-10-21T12:57:27.546279Z

Do you think it's ready for prime-time?

seancorfield 2025-10-21T13:07:28.302719Z

Well, I've had problems with vthreads several times so I'm still skeptical...

dharrigan 2025-10-21T13:11:06.830209Z

I'm in a wait-and-see pattern

seancorfield 2025-10-21T13:13:23.019859Z

Updating to the new alpha2 version on its own seems to work -- but has elevated CPU time but less TIMED_WAITING threads. Enabling the vthreads=target option caused heap to fill up and the server went into a 100% CPU GC tailspin. Still trying to track down exactly where things are breaking down.

dharrigan 2025-10-21T13:23:05.322499Z

Do you see a potential in being able to serve more users with less overhead (using vthreads)?

seancorfield 2025-10-21T13:44:27.653419Z

Since vthreads have less overhead, I would expect core.async-heavy code to potentially run faster -- since it's doing less work to context-switch. That said, I'd also expect it to use more heap (vthreads put their stack on the heap). With just the upgrade to core.async -- without explicitly turning on vthreads -- we do see better throughput, with more CPU usage, and fewer TIMED_WAITING as noted above.

dharrigan 2025-10-21T13:45:23.107919Z

I'm not sure yet, of where to use it (if at all). Wouldn't the webserver (e.g., jetty) have to know about this too?

seancorfield 2025-10-21T13:45:37.074279Z

When we first started trying vthreads, we saw all sorts of lock-ups and weird behavior -- I think that was back on JDK 19? On JDK 24, so far, they have been much more stable but we're only slowly rolling them out across our code.

dharrigan 2025-10-21T13:45:53.102629Z

Still not 100% of how it works on normal, end-to-end http request processing (not some abstract spin up 100000 threads to do some basic calculations)

seancorfield 2025-10-21T13:45:55.520509Z

Jetty can still use O/S threads and then your code can use vthreads.

seancorfield 2025-10-21T13:46:14.651429Z

Or you can switch Jetty to use vthreads if you want.

dharrigan 2025-10-21T13:46:15.394779Z

We're running with 25 at work

seancorfield 2025-10-21T13:46:34.088769Z

We can't use 25 until New Relic supports it (later this month).

dharrigan 2025-10-21T13:47:10.351609Z

How about when a request comes in, and jetty parks a thread, then your code uses vthreads, but then has to call to a db (or some external service, like, maybe S3 or Redis or summat)

seancorfield 2025-10-21T13:50:30.411399Z

I/O -- like DB access -- auto-parks vthreads and switches to another (depending on the JDBC driver).

dharrigan 2025-10-21T13:56:00.369909Z

interesting.

dharrigan 2025-10-21T13:56:08.762809Z

I'll watch this space with great interest

thomas 2025-10-21T06:46:15.422259Z

mogge