René's URL Explorer Experiment


Title: Skip data loaders with no queued keys in ticker-mode dispatchAll by Meemaw · Pull Request #293 · graphql-java/java-dataloader · GitHub

Open Graph Title: Skip data loaders with no queued keys in ticker-mode dispatchAll by Meemaw · Pull Request #293 · graphql-java/java-dataloader

X Title: Skip data loaders with no queued keys in ticker-mode dispatchAll by Meemaw · Pull Request #293 · graphql-java/java-dataloader

Description: Fixes #292. In ticker mode, dispatchAll() ran a full dispatch() on every registered data loader, including loaders with nothing queued. A request's registry usually holds many more loaders than any one dispatchAll() has work for, and graphql-java calls dispatchAll() many times per request. Most of the work, and roughly 48 bytes of allocation per idle loader per call, went to loaders with empty queues. #292 has the profile data. Change In ticker mode, dispatchAllWithCount() now: re-arms the ticker once, before dispatching, so a throwing loader or predicate still can't stop it; then dispatches only loaders with dispatchDepth() > 0 whose predicate passes. dispatchDepth() is a single atomic read of the queue head. Non-ticker mode is unchanged. There, a loader whose predicate says no keeps its own reschedule chain, and that behaviour is left as is. Behaviour Preserved: after the first dispatchAll(), every loader whose predicate passes is dispatched at least every schedule until close(). A key queued after the depth check is dispatched by the next tick, the same window as a key queued just after a dispatch today. Preserved: the close() semantics from #291, and the ticker surviving a throwing predicate. Changed, idle loaders only: Predicates are no longer evaluated for loaders with nothing queued. beginDispatch instrumentation no longer fires for them. Their lastDispatchTime is no longer refreshed. The only built-in reader is DispatchPredicate.dispatchIfLongerThan. With it, the first key queued after an idle period now dispatches on the next dispatchAll(), rather than waiting duration after the last empty dispatch. "Time since dispatch" then means time since the last dispatch that did something. Benchmark This adds ScheduledDataLoaderRegistryDispatchPerformance (JMH). It builds a ticker-mode registry the way DGS does: DISPATCH_NEVER for the registry, DISPATCH_ALWAYS per loader, and an hour-long schedule so the ticker never fires during a measurement. Caching is off so every load is queued. Each operation queues one key on N loaders, then calls dispatchAllWithCount(). The runs were on JDK 21, Apple M-series, with -prof gc. Each variant ran twice (one fork, 3×2 s warmup, 5×2 s measurement), interleaving master and this branch. Another JMH workload was running on the machine at the same time, so treat the absolute numbers as indicative. The ranges below span both runs. Registered loaders Loaders with queued keys master (da59d1d) This PR Speed-up 20 0 853–881 ns, 960 B 59–60 ns, 0 B ~14× 200 0 9,199–9,468 ns, 9,600 B 677–688 ns, 0 B ~14× 20 5 1,129–1,199 ns, 3,920 B 575–610 ns, 2,840 B ~1.9× 200 5 9,766–10,069 ns, 16,600–16,880 B 1,560–1,588 ns, 2,840 B ~6.3× With this change, the cost of a dispatchAll() that has work no longer depends on how many loaders are registered: 2,840 B per call with 20 or 200 loaders. Run the benchmark with ./gradlew jmhJar, then java -jar build/libs/*-jmh.jar ScheduledDataLoaderRegistryDispatchPerformance -prof gc. End-to-end. We ran a graphql-java 25 workload with DGS-style ticker registries: 200 loaders, a query fanning out to 12 of them over three nested levels, 3 ms simulated I/O, and 48 concurrent requests. With this change applied: one idle dispatchAll() went from 32.3 µs to 2.5 µs; process CPU per request went from 25.1 to 23.4 ms (−7%, mean of 3 runs). We've applied the same change as a local patch to our service. Based on the profile in #292, we expect it to remove most of the ~3% of CPU that went to empty dispatches. Tests New: ticker_mode_dispatch_all_only_visits_data_loaders_with_queued_keys. It uses 20 loaders with one queued key, and asserts: only that loader's predicate runs; its load completes; the count is 1; one tick is pending. Without the dispatchDepth() check it fails, because the predicate runs for all 20 loaders. The existing ticker tests from #291 still pass: one pending task, rescheduleNow, ticking after a throwing predicate, and close. ./gradlew build on JDK 21 passes.

Open Graph Description: Fixes #292. In ticker mode, dispatchAll() ran a full dispatch() on every registered data loader, including loaders with nothing queued. A request's registry usually holds many more loaders than...

X Description: Fixes #292. In ticker mode, dispatchAll() ran a full dispatch() on every registered data loader, including loaders with nothing queued. A request's registry usually holds many more loaders ...

Opengraph URL: https://github.com/graphql-java/java-dataloader/pull/293

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c87e53d8-e3e9-bd7e-4688-eb8d09549f2f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC8B4:2A5566:1CE351:25F880:6B01885D
html-safe-noncef69ca7eb0eaef7787f224b0a7dfa97f3e198ad717c8bd9ab32f916e680d5061b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEI0OjJBNTU2NjoxQ0UzNTE6MjVGODgwOjZCMDE4ODVEIiwidmlzaXRvcl9pZCI6Ijg4NDUwNDc2Njg0NzA3OTMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf8d30fdf6206b5bc5076edee8ab2e7cc01812d3b9fbbb472aef7980d994cd7a8
hovercard-subject-tagpull_request:4918544604
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/graphql-java/java-dataloader/pull/293/files
twitter:imagehttps://avatars.githubusercontent.com/u/8524109?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/8524109?s=400&v=4
og:image:altFixes #292. In ticker mode, dispatchAll() ran a full dispatch() on every registered data loader, including loaders with nothing queued. A request's registry usually holds many more loaders than...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/graphql-java/java-dataloader/pull/293/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fjava-dataloader%2Fpull%2F293%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fjava-dataloader%2Fpull%2F293%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=graphql-java%2Fjava-dataloader
Reloadhttps://github.com/graphql-java/java-dataloader/pull/293/files
Reloadhttps://github.com/graphql-java/java-dataloader/pull/293/files
Reloadhttps://github.com/graphql-java/java-dataloader/pull/293/files
graphql-javahttps://github.com/graphql-java
java-dataloaderhttps://github.com/graphql-java/java-dataloader
Codehttps://github.com/graphql-java/java-dataloader
Issues2 (2)https://github.com/graphql-java/java-dataloader/issues
Pull requests18 (18)https://github.com/graphql-java/java-dataloader/pulls
Discussionshttps://github.com/graphql-java/java-dataloader/discussions
Actionshttps://github.com/graphql-java/java-dataloader/actions
Projectshttps://github.com/graphql-java/java-dataloader/projects
Wikihttps://github.com/graphql-java/java-dataloader/wiki
Security and qualityhttps://github.com/graphql-java/java-dataloader/security
Insightshttps://github.com/graphql-java/java-dataloader/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgraphql-java%2Fjava-dataloader%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgraphql-java%2Fjava-dataloader%2Fissues%2Fnew%2Fchoose
bbakermanhttps://github.com/bbakerman
graphql-java:masterhttps://github.com/graphql-java/java-dataloader/tree/master
Meemaw:ticker-mode-skip-idle-loadershttps://github.com/Meemaw/java-dataloader/tree/ticker-mode-skip-idle-loaders
Conversation 1 https://github.com/graphql-java/java-dataloader/pull/293
Commits 1 https://github.com/graphql-java/java-dataloader/pull/293/commits
Checks 1 https://github.com/graphql-java/java-dataloader/pull/293/checks
Files changed https://github.com/graphql-java/java-dataloader/pull/293/files
Please reload this pagehttps://github.com/graphql-java/java-dataloader/pull/293/files
Skip data loaders with no queued keys in ticker-mode dispatchAll https://github.com/graphql-java/java-dataloader/pull/293/files#top
Show all changes 1 commit https://github.com/graphql-java/java-dataloader/pull/293/files
2659816 Skip data loaders with no queued keys in ticker-mode dispatchAll Meemaw Oct 19, 2026 https://github.com/graphql-java/java-dataloader/pull/293/commits/2659816f8c2a21aa63725ca22a637810ab34791e
Clear filters https://github.com/graphql-java/java-dataloader/pull/293/files
Please reload this pagehttps://github.com/graphql-java/java-dataloader/pull/293/files
Please reload this pagehttps://github.com/graphql-java/java-dataloader/pull/293/files
ScheduledDataLoaderRegistryDispatchPerformance.java https://github.com/graphql-java/java-dataloader/pull/293/files#diff-b073c4bd489b00a56bac4d5dc55273a22ab6f8b65f0cb6902a063acbb3d25870
ScheduledDataLoaderRegistry.java https://github.com/graphql-java/java-dataloader/pull/293/files#diff-80b84eb93b557ef760c8d07f70cc14f607381d095fb5ba1e9dd96465446fce31
ScheduledDataLoaderRegistryTest.java https://github.com/graphql-java/java-dataloader/pull/293/files#diff-e99c2733e4dd81edb1e1f555da5553e6e58c735d7c1b4ee14f120fab682daf6d
src/jmh/java/performance/ScheduledDataLoaderRegistryDispatchPerformance.javahttps://github.com/graphql-java/java-dataloader/pull/293/files#diff-b073c4bd489b00a56bac4d5dc55273a22ab6f8b65f0cb6902a063acbb3d25870
View file https://github.com/Meemaw/java-dataloader/blob/2659816f8c2a21aa63725ca22a637810ab34791e/src/jmh/java/performance/ScheduledDataLoaderRegistryDispatchPerformance.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/java-dataloader/pull/293/{{ revealButtonHref }}
src/main/java/org/dataloader/registries/ScheduledDataLoaderRegistry.javahttps://github.com/graphql-java/java-dataloader/pull/293/files#diff-80b84eb93b557ef760c8d07f70cc14f607381d095fb5ba1e9dd96465446fce31
View file https://github.com/Meemaw/java-dataloader/blob/2659816f8c2a21aa63725ca22a637810ab34791e/src/main/java/org/dataloader/registries/ScheduledDataLoaderRegistry.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/java-dataloader/pull/293/{{ revealButtonHref }}
https://github.com/graphql-java/java-dataloader/pull/293/files#diff-80b84eb93b557ef760c8d07f70cc14f607381d095fb5ba1e9dd96465446fce31
https://github.com/graphql-java/java-dataloader/pull/293/files#diff-80b84eb93b557ef760c8d07f70cc14f607381d095fb5ba1e9dd96465446fce31
https://github.com/graphql-java/java-dataloader/pull/293/files#diff-80b84eb93b557ef760c8d07f70cc14f607381d095fb5ba1e9dd96465446fce31
src/test/java/org/dataloader/registries/ScheduledDataLoaderRegistryTest.javahttps://github.com/graphql-java/java-dataloader/pull/293/files#diff-e99c2733e4dd81edb1e1f555da5553e6e58c735d7c1b4ee14f120fab682daf6d
View file https://github.com/Meemaw/java-dataloader/blob/2659816f8c2a21aa63725ca22a637810ab34791e/src/test/java/org/dataloader/registries/ScheduledDataLoaderRegistryTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/java-dataloader/pull/293/{{ revealButtonHref }}
https://github.com/graphql-java/java-dataloader/pull/293/files#diff-e99c2733e4dd81edb1e1f555da5553e6e58c735d7c1b4ee14f120fab682daf6d
https://github.com/graphql-java/java-dataloader/pull/293/files#diff-e99c2733e4dd81edb1e1f555da5553e6e58c735d7c1b4ee14f120fab682daf6d
Please reload this pagehttps://github.com/graphql-java/java-dataloader/pull/293/files
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.