René's URL Explorer Experiment


Title: Thread pool tuning best practice suggestions? · graphql-java/java-dataloader · Discussion #129 · GitHub

Open Graph Title: Thread pool tuning best practice suggestions? · graphql-java/java-dataloader · Discussion #129

X Title: Thread pool tuning best practice suggestions? · graphql-java/java-dataloader · Discussion #129

Description: Thread pool tuning best practice suggestions?

Open Graph Description: Are there suggestions for general best practices when configuring/choosing a thread pool(s) to be used by batch loaders? I understand that thread pool selection and tuning is very much project spec...

X Description: Are there suggestions for general best practices when configuring/choosing a thread pool(s) to be used by batch loaders? I understand that thread pool selection and tuning is very much project spec...

Opengraph URL: https://github.com/graphql-java/java-dataloader/discussions/129

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Thread pool tuning best practice suggestions?","text":"

Are there suggestions for general best practices when configuring/choosing a thread pool(s) to be used by batch loaders?

\n

I understand that thread pool selection and tuning is very much project specific, but knowing of any common gotchas or tips for common situations or common use cases would be very welcomed. In particular for scenarios where several batches (eg 100+ or 1000+) are expected to be run for a double data loader while running just as many for other data loaders that are running simultaneously.

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

I don't think thread pooling policies are batch loader specific really. It always depends on your load profile as you say.

\n

I think the style of your application architecture matters however. Will the calls during the batch load be reactive or imperative? eg will they block during batch loader call and hence use up the thread while it completes?

\n

If you are reactive then you should not have to worry about thread pools much as all. Use the \"Schedulers\" of you reactive framework (Spring Project Reactor / Quarkus Mutiny) and the event loop thread pools are set for you. Typically they end up with thread pools of cpu count * 2

\n

If you are using an imperative architecture and the thread blocks to get data then your need more threads. The number will be driven by the amount of work that needs to get done. You haven't outlined how many concurrent loads will be going on.

\n

Each threads in the JVM costs something like 1MB of memory - so as you add more threads to the pool to get more concurrency you incur a fixed memory cost. If you add 1000s of threads it will hurt you in memory terms even if you get better concurrency.

\n

So unfortunately this typically means a testing mechanism to discover the right balance... eg adding more threads increase your concurrency but it also increases the memory usage and switching overhead costs. You have to discover via testing the point that gives the best return for the least resources

\n

JDK 21 just came out and nominally this allows you to use virtual threads which are significantly cheaper to create and hence nominally each batch load could be a virtual thread. You would NOT use thread pooling in JDK 21 - you would use the new https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Executors.html#newVirtualThreadPerTaskExecutor()

","upvoteCount":1,"url":"https://github.com/graphql-java/java-dataloader/discussions/129#discussioncomment-7091668"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:da0fbf32-a4a6-a5a2-093e-9794c4de09d9
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-id9848:30A82E:481801:66709F:696FA7F4
html-safe-nonce242e6327a49de8c8a3d1b7813528efff99b6107d683fa255420fbe18341045b0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODQ4OjMwQTgyRTo0ODE4MDE6NjY3MDlGOjY5NkZBN0Y0IiwidmlzaXRvcl9pZCI6IjIyMTYyMDk4NjEwMTM2NDUzMDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac252128f50dec1f05ab1a71bb1f0898677679d2175e421c6e361abaeb8d6ca124
hovercard-subject-tagdiscussion:5661120
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/graphql-java/java-dataloader/129/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/f0ea25848cd1bd6e4cfcb136be0e81203ed80aed94a55c961166aa6f45f30b9d/graphql-java/java-dataloader/discussions/129
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f0ea25848cd1bd6e4cfcb136be0e81203ed80aed94a55c961166aa6f45f30b9d/graphql-java/java-dataloader/discussions/129
og:image:altAre there suggestions for general best practices when configuring/choosing a thread pool(s) to be used by batch loaders? I understand that thread pool selection and tuning is very much project spec...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0ca8d8c65612640b9a1a588b3eed68222ca723ed2d028b18fe81b28936d535eb
turbo-cache-controlno-preview
go-importgithub.com/graphql-java/java-dataloader git https://github.com/graphql-java/java-dataloader.git
octolytics-dimension-user_id14289921
octolytics-dimension-user_logingraphql-java
octolytics-dimension-repository_id97364654
octolytics-dimension-repository_nwographql-java/java-dataloader
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id97364654
octolytics-dimension-repository_network_root_nwographql-java/java-dataloader
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release95f60616ce2765d1114fe6da4af405a58c6d26d2
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fjava-dataloader%2Fdiscussions%2F129
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fjava-dataloader%2Fdiscussions%2F129
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=graphql-java%2Fjava-dataloader
Reloadhttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
Reloadhttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
Reloadhttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
graphql-java https://patch-diff.githubusercontent.com/graphql-java
java-dataloaderhttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fgraphql-java%2Fjava-dataloader
Fork 95 https://patch-diff.githubusercontent.com/login?return_to=%2Fgraphql-java%2Fjava-dataloader
Star 520 https://patch-diff.githubusercontent.com/login?return_to=%2Fgraphql-java%2Fjava-dataloader
Code https://patch-diff.githubusercontent.com/graphql-java/java-dataloader
Issues 1 https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/issues
Pull requests 10 https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/pulls
Discussions https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions
Actions https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/actions
Projects 0 https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/projects
Wiki https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/security
Please reload this pagehttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
Insights https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/pulse
Code https://patch-diff.githubusercontent.com/graphql-java/java-dataloader
Issues https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/issues
Pull requests https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/pulls
Discussions https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions
Actions https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/actions
Projects https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/projects
Wiki https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/wiki
Security https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/security
Insights https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/pulse
Answered https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#discussioncomment-7091668
bbakermanhttps://patch-diff.githubusercontent.com/bbakerman
bsara https://patch-diff.githubusercontent.com/bsara
Q&Ahttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/categories/q-a
Thread pool tuning best practice suggestions? https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#top
bsara https://patch-diff.githubusercontent.com/bsara
Answered https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#discussioncomment-7091668
bbakermanhttps://patch-diff.githubusercontent.com/bbakerman
Return to tophttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#top
Please reload this pagehttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
Please reload this pagehttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
bsara https://patch-diff.githubusercontent.com/bsara
Sep 23, 2023 https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#discussion-5661120
Give feedback.https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
bbakerman https://patch-diff.githubusercontent.com/bbakerman
Sep 24, 2023 https://github.com/graphql-java/java-dataloader/discussions/129#discussioncomment-7091668
View full answer https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#discussioncomment-7091668
Oldest https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129?sort=old
Newest https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129?sort=new
Top https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129?sort=top
Please reload this pagehttps://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
bbakerman https://patch-diff.githubusercontent.com/bbakerman
Sep 24, 2023 https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129#discussioncomment-7091668
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Executors.html#newVirtualThreadPerTaskExecutor()https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Executors.html#newVirtualThreadPerTaskExecutor()
Give feedback.https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
bbakermanhttps://patch-diff.githubusercontent.com/bbakerman
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fjava-dataloader%2Fdiscussions%2F129
🙏 Q&A https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/categories/q-a
https://patch-diff.githubusercontent.com/bsara
https://patch-diff.githubusercontent.com/bbakerman
https://patch-diff.githubusercontent.com/graphql-java/java-dataloader/discussions/129
https://patch-diff.githubusercontent.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.