René's URL Explorer Experiment


Title: performance issues due to breadth first execution of grapqhl queries in case of async resolvers during calls burst · Issue #200 · graphql-python/graphql-core · GitHub

Open Graph Title: performance issues due to breadth first execution of grapqhl queries in case of async resolvers during calls burst · Issue #200 · graphql-python/graphql-core

X Title: performance issues due to breadth first execution of grapqhl queries in case of async resolvers during calls burst · Issue #200 · graphql-python/graphql-core

Description: When we receive calls burst we found that the calls "wait each other" (i.e. the first call of the burst waits the last one). This result in degradation of performances in both time of execution and memory consumption in the server becaus...

Open Graph Description: When we receive calls burst we found that the calls "wait each other" (i.e. the first call of the burst waits the last one). This result in degradation of performances in both time of execution and...

X Description: When we receive calls burst we found that the calls "wait each other" (i.e. the first call of the burst waits the last one). This result in degradation of performances in both time of exe...

Opengraph URL: https://github.com/graphql-python/graphql-core/issues/200

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"performance issues due to breadth first execution of grapqhl queries in case of async resolvers during calls burst","articleBody":"When we receive calls burst we found that the calls \"wait each other\" (i.e. the first call of the burst waits the last one).\r\nThis result in degradation of performances in both time of execution and memory consumption in the server because we have to keep many calls in fly.\r\n\r\nThis is particularly evident in big graphql queries where the users request many fields and we have several depth in the queries where each level has many async fields.\r\n\r\nJust to be TLDR, looking the implementations of graphql and asyncio we understood that this is due to the following:\r\n- graphql breadth first way to schedule and resolve the fields\r\n- asyncio internal FIFO queue of tasks to be executed\r\n\r\n\r\nAs an example lets have queries like that, where data may be like beer vendors and we want for each beer vendor many fields that describes that vendor, a1...a100, b1...b100, ...:\r\n\r\n```\r\nquery {\r\n  data {\r\n    a1 {\r\n      b1 {\r\n        c1\r\n        ...\r\n        c100\r\n      }\r\n      ...\r\n      b100 {\r\n        c1\r\n        ...\r\n        c100\r\n      }\r\n    }\r\n    ...\r\n    a100 { ... }\r\n  }\r\n}\r\n``` \r\n\r\nIf we have n of this calls coming in burst when we arrive to the depth of the c fields we have many many task scheduled in the asyncio queue. \r\n\r\nIf we check the of order of execution we have that the first query, on each level, \"waits\" the other queries, because all the queries schedules a lot of tasks.\r\n\r\nIn the proof of concept, that you may find at the end of the post, you can verify the order of execution of the resolvers.\r\n\r\nIt could be very nice to have some sort of priority in the order to let the first query not wait the scheduling and resolve of all the queries before ending.\r\nI understand that this is something between graphql and asyncio but i think it could affect the use of graphql in environments receiving many calls.\r\nFixes, helps and hints in how to improve this would be very appreciated.\r\n\r\n```python\r\nimport asyncio\r\n\r\nfrom graphene import ObjectType, Schema, String, Field\r\n\r\nFIELD_NUMBER = 2\r\nCONCURRENT_QUERIES = 10\r\n\r\n\r\ndef make_resolver(i, j=None):\r\n    async def resolver(self, info):\r\n        print(f\"START query {info.context['query_number']} | a{i} | b{j}\")\r\n        await asyncio.sleep(0.001)\r\n        print(f\"END query {info.context['query_number']} | a{i} | b{j}\")\r\n        return i\r\n\r\n    return resolver\r\n\r\n\r\ndef create_fields():\r\n    fields = {}\r\n    for i in range(FIELD_NUMBER):\r\n        inner_fields = {}\r\n        for j in range(FIELD_NUMBER):\r\n            inner_fields[f\"b{j}\"] = String()\r\n            inner_fields[f\"resolve_b{j}\"] = make_resolver(i, j)\r\n\r\n        MyType = type(\r\n            f\"MyType\",\r\n            (ObjectType,),\r\n            inner_fields,\r\n        )\r\n\r\n        fields[f\"a{i}\"] = Field(MyType)\r\n        fields[f\"resolve_a{i}\"] = make_resolver(i)\r\n\r\n    return fields\r\n\r\n\r\nasync def make_query(schema, query_number):\r\n    inner_query_values = [f\"b{i}\" for i in range(FIELD_NUMBER)]\r\n    query_values = [\r\n        \"a%s {%s}\" % (i, \" \".join(inner_query_values)) for i in range(FIELD_NUMBER)\r\n    ]\r\n    query_string = \"{ %s }\" % (\" \".join(query_values),)\r\n\r\n    await schema.execute_async(\r\n        query_string, context_value=dict(query_number=query_number)\r\n    )\r\n\r\n\r\nasync def main():\r\n    Query = type(\"Query\", (ObjectType,), create_fields())\r\n    schema = Schema(query=Query)\r\n\r\n    await asyncio.gather(*[make_query(schema, i) for i in range(CONCURRENT_QUERIES)])\r\n\r\n\r\nasyncio.run(main())\r\n\r\n``` ","author":{"url":"https://github.com/alessandrolulli","@type":"Person","name":"alessandrolulli"},"datePublished":"2023-05-12T10:05:36Z","url":"https://github.com/graphql-python/graphql-core/issues/200"}

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:f87a1c2c-cdc2-e739-1d70-f906a4c3bbff
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8402:3022B5:246A4B:2F25FF:6AFFC41D
html-safe-nonceafcea0a3255281129d9b2b9d6a15d1dfcf567b30a089b336ae67bcf982cc4341
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDAyOjMwMjJCNToyNDZBNEI6MkYyNUZGOjZBRkZDNDFEIiwidmlzaXRvcl9pZCI6IjEwNDg3MjY3NTk0NDIyMDM2NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2af4e5b5d0cc5b5d1bd41c49a1b65350d01604f7a52a2d30055852614f8f6059
hovercard-subject-tagissue:1707342207
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-python/graphql-core/200/issue_layout
twitter:imagehttps://opengraph.githubassets.com/804e068321d8be8f299fc7fc4c7822719114038a22fe36700594e63a27497604/graphql-python/graphql-core/issues/200
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/804e068321d8be8f299fc7fc4c7822719114038a22fe36700594e63a27497604/graphql-python/graphql-core/issues/200
og:image:altWhen we receive calls burst we found that the calls "wait each other" (i.e. the first call of the burst waits the last one). This result in degradation of performances in both time of execution and...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamealessandrolulli
hostnamegithub.com
expected-hostnamegithub.com
None1e805b832df235bb21305db712c3b6432920019dfc12cb25b9cb8d3b0c9403cf
turbo-cache-controlno-preview
go-importgithub.com/graphql-python/graphql-core git https://github.com/graphql-python/graphql-core.git
octolytics-dimension-user_id15002022
octolytics-dimension-user_logingraphql-python
octolytics-dimension-repository_id143207933
octolytics-dimension-repository_nwographql-python/graphql-core
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id143207933
octolytics-dimension-repository_network_root_nwographql-python/graphql-core
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
release8fa4a54e6871c7908eda1c246ad5972982c0b59d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/graphql-python/graphql-core/issues/200#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-python%2Fgraphql-core%2Fissues%2F200
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-python%2Fgraphql-core%2Fissues%2F200
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-python%2Fgraphql-core
Reloadhttps://github.com/graphql-python/graphql-core/issues/200
Reloadhttps://github.com/graphql-python/graphql-core/issues/200
Reloadhttps://github.com/graphql-python/graphql-core/issues/200
graphql-pythonhttps://github.com/graphql-python
graphql-corehttps://github.com/graphql-python/graphql-core
Codehttps://github.com/graphql-python/graphql-core
Issues24 (24)https://github.com/graphql-python/graphql-core/issues
Pull requests3 (3)https://github.com/graphql-python/graphql-core/pulls
Actionshttps://github.com/graphql-python/graphql-core/actions
Projectshttps://github.com/graphql-python/graphql-core/projects
Security and quality3 (3)https://github.com/graphql-python/graphql-core/security
Insightshttps://github.com/graphql-python/graphql-core/insights
https://github.com/graphql-python/graphql-core
New issuehttps://github.com/login?return_to=https://github.com/graphql-python/graphql-core/issues/200
New issuehttps://github.com/login?return_to=https://github.com/graphql-python/graphql-core/issues/200
performance issues due to breadth first execution of grapqhl queries in case of async resolvers during calls bursthttps://github.com/graphql-python/graphql-core/issues/200#top
https://github.com/alessandrolulli
alessandrolullihttps://github.com/alessandrolulli
on May 12, 2023https://github.com/graphql-python/graphql-core/issues/200#issue-1707342207
https://github.com/Cito
Citohttps://github.com/Cito
on May 29, 2023https://github.com/graphql-python/graphql-core/issues/200#issuecomment-1567032563
@alessandrolullihttps://github.com/alessandrolulli
@defer/@streamhttps://github.com/graphql/graphql-js/blob/main/website/docs/tutorials/defer-stream.md
https://github.com/Cito
Citohttps://github.com/Cito
on Jun 4, 2023https://github.com/graphql-python/graphql-core/issues/200#issuecomment-1575706450
@defer/@streamhttps://github.com/graphql/graphql-js/blob/main/website/docs/tutorials/defer-stream.md
https://github.com/alessandrolulli
alessandrolullihttps://github.com/alessandrolulli
on Mar 1, 2024https://github.com/graphql-python/graphql-core/issues/200#issuecomment-1972750691
https://github.com/alessandrolulli
alessandrolullihttps://github.com/alessandrolulli
on Mar 1, 2024https://github.com/graphql-python/graphql-core/issues/200#issuecomment-1973297394
Sign up for freehttps://github.com/signup?return_to=https://github.com/graphql-python/graphql-core/issues/200
Sign in to commenthttps://github.com/login?return_to=https://github.com/graphql-python/graphql-core/issues/200
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.