sql

seancorfield 2024-03-16T01:21:45.091839Z

(in case you're not in #announcements 🙂 )

2024-03-16T18:13:08.109269Z

Hi, I see many clojurians using HikariCP and with the advent of virtual threads. Are you using VT in production with HikariCP withou issues ? I'm asking because of https://github.com/brettwooldridge/HikariCP/issues/2151 . It seems this pull request with a long discussion about it https://github.com/brettwooldridge/HikariCP/pull/2055

seancorfield 2024-03-17T22:09:47.218849Z

Virtual threads are intended to be pretty much unlimited. Spawning thousands or even a million, and then having those start to pin on O/S threads, and you'll quickly run out of system resources...

valerauko 2024-03-18T12:30:15.681159Z

I meant to ask, is the pinning the problem? Or in general, load-planning with freely-spawnable vthreads?

seancorfield 2024-03-18T15:15:55.112979Z

Pinning. If vthreads do not pin, they will be able to park and collaborate just fine into the millions.

valerauko 2024-03-19T01:36:47.338589Z

Thanks for the insight! In your opinion is there anything a user of a library that uses synchronized blocks can do to circumvent this? Wrapping library calls in some way?

seancorfield 2024-03-19T03:18:35.667499Z

The recommendation from the Java folks is to switch from synchronized to reentrant locks. Which is what Clojure has done in 1.12 in the most critical pathways.

seancorfield 2024-03-16T18:55:48.983709Z

We are not using vthreads because we're on MySQL and that driver is very unfriendly to vthreads right now. I ran a test with Jetty 12 using vthreads and the JVM flag to identify pinning and it reported a huge amount of pinning even without much load. If you're using a JDBC driver that is more friendly to vthreads, you're still potentially going to overwhelm the connection pools and/or your database -- that's my reading of the discussion there (and it makes sense, based on my experience of tuning connection pools over the years).

👍 1
valerauko 2024-03-17T05:34:04.096299Z

Is pinning an issue? Isn't the worst case scenario "back to where we were with OS threads"?