-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] Is caffeine virtual thread / loom friendly? #1468
Comments
Yes and no |
Currently in Java, Caffeine uses In the meantime, you can use AsyncCache which decouples the computation from the map operation. Then the map's synchronized blocks are short cpu work and the I/O is performed by a |
Or maybe just set a larger pool size。 |
@ben-manes |
I think we may better follow Hotspot team's lead . |
@He-Pin what do you mean by follow? |
Since A few years ago I did chat with Doug Lea who was pondering what a change to ConcurrentHashMap might look like. He had mused using "separate bitwise-trie-like structure of AQS objects that serve as the inflated forms. One TBD is how/when to kill them off", where AQS is the synchronization primitive underlying ReentrantLock. I haven't seen any progress there whereas the Loom github shows steady progress on mutex support. You might follow loom-dev and the github branches to keep an eye on progress. |
I just upgrade my system to jdk21 and use both virtual thread, and removed some old guava code , swith to locksupport etc and switch to caffeine, after I trace the pin. I was trying to submit pr to cchm too , but seems not much good way, otherwise it will wast memory. I also asked on Loom dev, they are working on it , but no timeline,and cchm will not be rewritten. I see 10% cpu reduce and 5% mem reduce on 16core 32gb memory box, and at the workload 60% and where with VT is 50% on the same workload. This is a mission critical system of taobao live. That's what I can share and I think you can just follow author's advice, that what we can best do for now. |
FYI - The new EA builds no longer pin on synchronization (announcement) and they are asking for usage feedback. |
hi, quick question |
Per the link above, the Java team's work should resolve this in an upcoming release. You can try their early access build to provide feedback. For the time being, virtual threads should be used judiciously in limited scenarios until many of the show stopper problems have been resolved by the JDK. Likely the next LTS (25) will be a good time to consider using it. |
I wonder if caffeine is loom-friendly - e.g. does not pin the platform threads?
The text was updated successfully, but these errors were encountered: