Mark Takata (Adobe)
05/23/2024, 3:44 PMseancorfield
synchronized can cause virtual threads to "pin" to an O/S thread which can quickly choke your system.
A really bad example of this currently is MySQL's JDBC driver. In theory, virtual threads are great for I/O bound tasks because any I/O should cause a vthread the "park" and yield to another vthread, greatly increasing the potential concurrency in your application. Unfortunately, if you perform MySQL JDBC ops on vthreads, you're quickly going to tank your system...Mark Takata (Adobe)
05/23/2024, 4:37 PMbdw429s
05/23/2024, 4:44 PMseancorfield
synchronized code to using ReentrantLock (and semaphores to control concurrent access to resources if necessary) but a lot of Java libraries -- especially older ones -- use synchronized all over the place 😞
Clojure made changes to their compiler recently to make it friendlier to vthreads, which is why I brought it up here.Mark Takata (Adobe)
05/23/2024, 4:57 PMEvil Ware
05/23/2024, 5:10 PM