René's URL Explorer Experiment


Title: ScheduledDataLoaderRegistry ticker mode dispatches every registered data loader on each dispatchAll(), even when nothing is queued · Issue #292 · graphql-java/java-dataloader · GitHub

Open Graph Title: ScheduledDataLoaderRegistry ticker mode dispatches every registered data loader on each dispatchAll(), even when nothing is queued · Issue #292 · graphql-java/java-dataloader

X Title: ScheduledDataLoaderRegistry ticker mode dispatches every registered data loader on each dispatchAll(), even when nothing is queued · Issue #292 · graphql-java/java-dataloader

Description: Summary In ticker mode, ScheduledDataLoaderRegistry.dispatchAll() runs a full dispatch() on every registered data loader, including loaders with nothing queued. Each empty dispatch still: does a CAS on the loader queue; reads the clock a...

Open Graph Description: Summary In ticker mode, ScheduledDataLoaderRegistry.dispatchAll() runs a full dispatch() on every registered data loader, including loaders with nothing queued. Each empty dispatch still: does a CA...

X Description: Summary In ticker mode, ScheduledDataLoaderRegistry.dispatchAll() runs a full dispatch() on every registered data loader, including loaders with nothing queued. Each empty dispatch still: does a CA...

Opengraph URL: https://github.com/graphql-java/java-dataloader/issues/292

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ScheduledDataLoaderRegistry ticker mode dispatches every registered data loader on each dispatchAll(), even when nothing is queued","articleBody":"## Summary\n\nIn ticker mode, `ScheduledDataLoaderRegistry.dispatchAll()` runs a full `dispatch()` on **every** registered data loader, including loaders with nothing queued. Each empty dispatch still:\n- does a CAS on the loader queue;\n- reads the clock and writes `lastDispatchTime`;\n- calls `instrumentation().beginDispatch(...)`;\n- attaches the end-of-dispatch callback to an empty result, allocating about 48 bytes per loader per call.\n\nThe registry also evaluates the predicate and re-arms the ticker once per loader.\n\nGraphQL servers typically register every loader the application defines in each request's registry, but a request queues keys on only a few of them. graphql-java's per-level dispatch then calls `dispatchAll()` many times per request, and the ticker calls it again every `schedule`. Nearly all of that work goes to loaders with nothing to dispatch, so the cost grows with registered loaders × `dispatchAll()` calls rather than with actual batches.\n\nVersion: `master` at da59d1d, which includes #291, and 6.0.0. We hit this through Netflix DGS 12 in ticker mode with graphql-java 25.\n\n## Where\n\n`ScheduledDataLoaderRegistry` (`master`):\n\n```java\npublic int dispatchAllWithCount() {\n    int sum = 0;\n    for (Map.Entry\u003cString, DataLoader\u003c?, ?>> entry : dataLoaders.entrySet()) {\n        ...\n        sum += dispatchOrReschedule(key, dataLoader);   // shouldDispatch + dispatchWithCounts() for every loader\n    }\n    return sum;\n}\n```\n\nand `DataLoaderHelper.dispatch()`, which runs in full even when the queue is empty:\n\n```java\nDataLoaderInstrumentationContext\u003cDispatchResult\u003c?>> instrCtx = ctxOrNoopCtx(instrumentation().beginDispatch(dataLoader));\n...\nif (loaderQueueEntryHead == null) {\n    lastDispatchTime.set(now());\n    instrCtx.onDispatched();\n    return endDispatchCtx(instrCtx, emptyDispatchResult());\n}\n```\n\n## Measurements\n\n**JMH, in-repo.** The proposed PR adds `ScheduledDataLoaderRegistryDispatchPerformance`. It builds a ticker-mode registry the way DGS does: `DISPATCH_NEVER` for the registry, `DISPATCH_ALWAYS` per loader, a schedule long enough that the ticker never fires during a measurement, and caching disabled so every load is queued. Each operation queues one key on N loaders, then calls `dispatchAllWithCount()`.\n\nRuns were on JDK 21, Apple M-series, `-prof gc`, two interleaved runs per variant. The figures below are from master at da59d1d:\n\n| Registered loaders | Loaders with queued keys | Time / `dispatchAll` | Allocated / `dispatchAll` |\n|---|---|---|---|\n| 20 | 0 | 853–881 ns | 960 B |\n| 200 | 0 | 9,199–9,468 ns | 9,600 B |\n| 20 | 5 | 1,129–1,199 ns | 3,920 B |\n| 200 | 5 | 9,766–10,069 ns | 16,600–16,880 B |\n\nWith 5 loaders doing real work, the 195 idle loaders account for about 85% of the time and 83% of the allocation.\n\n**Production.** In a GraphQL service with about 190 registered loaders, CPU profiles across 12 instances (154k samples) showed `dispatchAll()` visiting loaders with empty queues at **about 3.2% of total CPU**:\n\n| Where the empty-dispatch cost went | Share of total CPU |\n|---|---|\n| Empty `DataLoaderHelper.dispatch()`: CAS, `clock.instant()`, `lastDispatchTime`, instrumentation, `endDispatchCtx` | ~1.6% |\n| Iterating the `ConcurrentHashMap` of loaders | ~1.1% |\n| `shouldDispatch` predicate-map lookups | ~0.35% |\n\nAbout 62% of those calls came from graphql-java's per-level dispatch and 38% from the ticker. Code that only runs for a non-empty queue took about 0.03% of CPU, against about 0.87% for the empty path. So fewer than 3% of loader visits had anything to dispatch.\n\n## Proposal\n\nIn ticker mode, skip loaders whose `dispatchDepth()` is 0, and re-arm the ticker once per `dispatchAll()` instead of once per loader. `dispatchDepth()` is a single atomic read of the queue head.\n\nA key queued after the check is dispatched by the next tick, which is the same window as a key queued just after a dispatch today. The ticker contract is unchanged: after the first `dispatchAll()`, every loader whose predicate passes is dispatched at least every `schedule` until `close()`.\n\nThe observable differences, both on idle loaders only:\n- `lastDispatchTime` is no longer refreshed, which matters only for time-based predicates such as `DispatchPredicate.dispatchIfLongerThan`;\n- `beginDispatch` no longer fires for loaders with nothing to dispatch.\n\nNon-ticker mode would stay as it is: there, a not-yet-dispatched loader relies on its per-loader reschedule chain.\n\nI have a PR ready with a test and the JMH benchmark.\n","author":{"url":"https://github.com/Meemaw","@type":"Person","name":"Meemaw"},"datePublished":"2026-10-19T09:09:09Z","url":"https://github.com/graphql-java/java-dataloader/issues/292"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:dd6d597d-2ef5-3254-af8e-e5c4fac2df6a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDE52:14ECB:248B47C:2E6AA39:6B01883B
html-safe-noncef6ce1b9a52257cb4e80eaf6ffda9b5e821d6f5254bd292ebd785f9df8341caff
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTUyOjE0RUNCOjI0OEI0N0M6MkU2QUEzOTo2QjAxODgzQiIsInZpc2l0b3JfaWQiOiI1Nzk0ODkyOTM2OTYxNDI3NTE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac086f2ddb66863a4e629418bb653afe41ae1203179318618f5ac634a840774d6d
hovercard-subject-tagissue:5921029380
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/java-dataloader/292/issue_layout
twitter:imagehttps://opengraph.githubassets.com/20f069c4ab89734e0a911d320ea5aaf3f1401b13a8095ac8b53dcbc812d9a82e/graphql-java/java-dataloader/issues/292
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/20f069c4ab89734e0a911d320ea5aaf3f1401b13a8095ac8b53dcbc812d9a82e/graphql-java/java-dataloader/issues/292
og:image:altSummary In ticker mode, ScheduledDataLoaderRegistry.dispatchAll() runs a full dispatch() on every registered data loader, including loaders with nothing queued. Each empty dispatch still: does a CA...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameMeemaw
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/graphql-java/java-dataloader/issues/292#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fjava-dataloader%2Fissues%2F292
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%2Fissues%2F292
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=graphql-java%2Fjava-dataloader
Reloadhttps://github.com/graphql-java/java-dataloader/issues/292
Reloadhttps://github.com/graphql-java/java-dataloader/issues/292
Reloadhttps://github.com/graphql-java/java-dataloader/issues/292
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
https://github.com/graphql-java/java-dataloader
New issuehttps://github.com/login?return_to=https://github.com/graphql-java/java-dataloader/issues/292
New issuehttps://github.com/login?return_to=https://github.com/graphql-java/java-dataloader/issues/292
#293https://github.com/graphql-java/java-dataloader/pull/293
ScheduledDataLoaderRegistry ticker mode dispatches every registered data loader on each dispatchAll(), even when nothing is queuedhttps://github.com/graphql-java/java-dataloader/issues/292#top
#293https://github.com/graphql-java/java-dataloader/pull/293
https://github.com/Meemaw
Meemawhttps://github.com/Meemaw
on Oct 19, 2026https://github.com/graphql-java/java-dataloader/issues/292#issue-5921029380
da59d1dhttps://github.com/graphql-java/java-dataloader/commit/da59d1d42e383c3b53c7699adf5a9609460470dc
#291https://github.com/graphql-java/java-dataloader/pull/291
da59d1dhttps://github.com/graphql-java/java-dataloader/commit/da59d1d42e383c3b53c7699adf5a9609460470dc
bbakermanhttps://github.com/bbakerman
completedhttps://github.com/graphql-java/java-dataloader/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#293https://github.com/graphql-java/java-dataloader/pull/293
on Oct 22, 2026https://github.com/graphql-java/java-dataloader/issues/292#event-33911282960
Sign up for freehttps://github.com/signup?return_to=https://github.com/graphql-java/java-dataloader/issues/292
Sign in to commenthttps://github.com/login?return_to=https://github.com/graphql-java/java-dataloader/issues/292
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.