funky-eyes commented on issue #7734:
URL:
https://github.com/apache/incubator-seata/issues/7734#issuecomment-3450373542
The primary impact of ThreadLocal on virtual threads is increased memory
usage and a small performance cost. By default, virtual threads are not pooled,
so ThreadLocals are reinitialized every time a virtual thread is created and
then discarded when that virtual thread ends. If this is a concern for your
workload, consider using a pool of virtual threads. Because virtual threads are
not platform threads and are extremely lightweight, pooling them uses very
little memory and avoids the large memory overhead associated with the -Xss
(stack size) parameter.
```
return new ThreadPoolExecutor(200, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS,
new SynchronousQueue<>(),
Thread.ofVirtual().factory());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]