Live data from Hacker News

We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

blog.ydb.tech

81–90 of 253 posts

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#81

Totally off topic but I am getting tired of the AI generated images used on nearly all blog posts nowadays. They are instantly recognisable, it just seems low effort and lowers the feeling of quality one might otherwise have

At least you now know which of your peers have no taste and strange beauty standards. Some images posted by my colleagues for everyone to see on LinkedIn look like sexist propaganda cartoons.

Stock images used to hide this "quality" better than I thought.

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#82

Earlier quoted context omitted.

I prefer AI generated images over stock photos though. You can tell that both are phony, but at least the AI can be a bit more creative.

I prefer no images over IA stolen/generated images.

> ...the Taft Test:

> Does your page design improve when you replace every image with William Howard Taft?

> If so, then, maybe all those images aren’t adding a lot to your article. At the very least, leave Taft there! You just admitted it looks better.

https://idlewords.com/talks/website_obesity.htm

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#83
post #40
post #14

Concurrency, parallelism. These are among the most misunderstood concepts in programming/software development. TLS (especially mutual TLS) and Oauth also join this club.

Interestingly enough, I love both mutual-TLS and OAUTH (especially OIDC).

Why is that interesting?

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#84

Erlang is based on virtual threads (confusingly called processes). The Erlang virtual machine schedules them on OS threads. Erlang processes communicate using message passing, preventing deadlocks. You can use millions of Erlang processes without problems, e.g., to handle millions of Elixir LiveView sessions.

This feels like something I could read on Wikipedia about Erlang, how does this add anything to the topic?

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#85
post #52

I am extremely confused. > There are two scenarios in which a virtual thread cannot be unmounted during blocking operations because it is pinned to its carrier: > When it executes code inside a synchronized block or method Isn't 'synchronized' effectively sugar for taking a kind of lock? Why can't it be treated uniformly by the scheduler?

No, synchronized is a very primitive lock implementation compared to what's available in java.util.concurrent.Locks. However, it's built directly into the JVM specification, so it's difficult to change while keeping compatibility, while j.u.c.Locks is just a library. In other words, they can't change synchronized schematic, so they created j.u.c.Locks as a replacement.

> it's difficult to change while keeping compatibility

Actually, it is trivial to change. Just embed a ReentrantLock into every object and rewrite all calls to "synchronized"/"Object.wait" to use that lock.

Unfortunately, this would result in a bit of performance regression (increasing per-object memory footprint). To solve that would require turning ReentrantLock into a magical intrinsic, fully integrated with lock bytes in the object header. Which is actually not that hard either — other runtimes like Golang or Android VM solve problems like this on daily basis. Oracle, however…

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#86
post #59

Earlier quoted context omitted.

Not really. I wish the trend of giant generic hero images on every blog post would go away, they almost never add any value. I think it was Medium that started the trend.

Unfortunately all social media sharing requires a thumbnail for easy clicking, no real way around it. (with Hacker News as the lone exception of course) The default thumbnails in lieu of your own aren't good.

I’ll honestly take the “put some text in the thumbnail” trend that GitHub, Nuxt Content, etc all do, over a low-quality image.

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#87
The warning shots across the bow where heard with this statement from the devs:

"Don't replace platform/native threads with virtual ones, replace tasks (without further explanation) instead"?!

Combine that with the fact that they chose to implement the scheduler in Java instead of C(++) and you're set for performance problems.

Remember that NIO took from 1.5 to 1.7 to be usable/performant and that was native!

Edit: Finally figured out why: https://news.ycombinator.com/item?id=39010648

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#88

Totally off topic but I am getting tired of the AI generated images used on nearly all blog posts nowadays. They are instantly recognisable, it just seems low effort and lowers the feeling of quality one might otherwise have

Whole Medium thing seems low effort. I hardly remember reading a well written article there.

Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres

#90
post #39

Earlier quoted context omitted.

Is that all that's happening here? There's an implicit limit on real threads, where before it was unlimited by virtue of not using the virtual thread's limited pool? If it doesn't spawn threads when all of them are blocked, that seems kinda dumb. And a severe change in semantics. It can be conservative and try running unpinned ones on fewer threads and shuffle them around and slowly spawn more to ensure eventual prog…

My long held belief: green/user-level/M:N threading schemes never work at first, and only work reliably after extreme effort has been put into fixing all the cases where blocking code gets called underneath. afaik there are only two modern working implementations: golang and erlang. This article is consistent with that belief.

Go suffers the same issue when calling into native code, that is why it has APIs to deal with it.

For example, https://pkg.go.dev/runtime#LockOSThread

Post reply on HN