Skip to content
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

Document that task executor pool size properties are ignored when using virtual threads #39529

Closed
peacemaker123456 opened this issue Feb 12, 2024 · 2 comments
Labels
status: superseded An issue that has been superseded by another

Comments

@peacemaker123456
Copy link

peacemaker123456 commented Feb 12, 2024

Hello dear team,

I noticed, that setting spring.threads.virtual.enabled to true, will always lead to the usage of SimpleAsyncTaskExecutor, therefore ignoring the config settings affecting the pool size. Likely you chose to do that because pooling with virtual threads makes no sense, given the low overhead of virtual thread creation. Yet it's not clear enough without looking at the source code TaskExecutorConfiguration. So maybe docs could be clearer here.

The only possibility to limit the amount of parallel tasks is therefore the spring.task.execution.simple.concurrency-limit property, which essentially behaves like a max pool size. The issue I see here, is that ConcurrencyThrottleSupport, which is being used under the hood, uses the synchronized blocks which leads to thread pinning and might cause several issues with virtual threads. Maybe switching to ReentrantLock would mitigate that?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 12, 2024
@philwebb philwebb changed the title Virtual threads implicitly being used with synchronized, when limitting concurrency Document that task executor pool size properties are ignored when using virtual threads. Feb 12, 2024
@philwebb philwebb added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 12, 2024
@philwebb philwebb added this to the 3.2.x milestone Feb 12, 2024
@philwebb
Copy link
Member

Thanks @peacemaker123456. We'll use this issue for the documentation updates and I've opened spring-projects/spring-framework#32251 to see if Framework want to make changes to ConcurrencyThrottleSupport

wanger26 added a commit to wanger26/spring-boot that referenced this issue Feb 20, 2024
wanger26 added a commit to wanger26/spring-boot that referenced this issue Feb 20, 2024
@mhalbritter mhalbritter changed the title Document that task executor pool size properties are ignored when using virtual threads. Document that task executor pool size properties are ignored when using virtual threads Feb 20, 2024
@mhalbritter
Copy link
Contributor

Superseded by #39629.

@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@mhalbritter mhalbritter added status: superseded An issue that has been superseded by another and removed type: documentation A documentation update labels Feb 20, 2024
@mhalbritter mhalbritter removed this from the 3.2.x milestone Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

No branches or pull requests

4 participants