apache / fury

A blazingly fast multi-language serialization framework powered by JIT and zero-copy.
https://fury.apache.org/
Apache License 2.0
2.81k stars 196 forks source link

[java]ThreadLocalFury has performance issues under virtual threads in jdk21 #1570

Open gongziyiyi opened 3 months ago

gongziyiyi commented 3 months ago

Is your feature request related to a problem? Please describe.

ThreadLocal has performance issues under virtual threads in jdk21

Describe the solution you'd like

maybe use CarrierThreadLocal ??

chaokunyang commented 3 months ago

Will It create lots of Fury objects? For example, if we have million of virtual threads, will we have millions of Fury object?

gongziyiyi commented 3 months ago

@chaokunyang Yes. CarrierThreadLocal can fix it, but unfortunately, it has not been leaked for external use and can only be opened with "--add-opens" at the moment

chaokunyang commented 3 months ago

We may need to add a new maven module to fury/java.

And I'm wondering whether can we use ThreadPoolFury, which use an object pool. This may be more friently to virtual thread