René's URL Explorer Experiment


Title: Very slow performance with firebase_admin.auth.list_users().iterate_all() · Issue #571 · firebase/firebase-admin-python · GitHub

Open Graph Title: Very slow performance with firebase_admin.auth.list_users().iterate_all() · Issue #571 · firebase/firebase-admin-python

X Title: Very slow performance with firebase_admin.auth.list_users().iterate_all() · Issue #571 · firebase/firebase-admin-python

Description: Operating System version: n/a Firebase SDK version: firebase-admin==5.0.2 Firebase Product: auth, user management Python version: 3.8 Pip version: n/a [REQUIRED] Step 3: Describe the problem When fetching all user accounts using the fire...

Open Graph Description: Operating System version: n/a Firebase SDK version: firebase-admin==5.0.2 Firebase Product: auth, user management Python version: 3.8 Pip version: n/a [REQUIRED] Step 3: Describe the problem When f...

X Description: Operating System version: n/a Firebase SDK version: firebase-admin==5.0.2 Firebase Product: auth, user management Python version: 3.8 Pip version: n/a [REQUIRED] Step 3: Describe the problem When f...

Opengraph URL: https://github.com/firebase/firebase-admin-python/issues/571

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Very slow performance with firebase_admin.auth.list_users().iterate_all()","articleBody":"  * Operating System version: n/a\r\n  * Firebase SDK version: firebase-admin==5.0.2 \r\n  * Firebase Product: auth, user management\r\n  * Python version: 3.8\r\n  * Pip version: n/a\r\n\r\n### [REQUIRED] Step 3: Describe the problem\r\n\r\nWhen fetching all user accounts using the firebase_admin.auth.list_users().iterate_all() helper, performance is very poor, taking about 5 seconds to fetch 1000 users.\r\n\r\nI have a project which has several million users. There is a scheduled task that fetches all the users for processing, but the task takes way too long and runs into problems with App Engine request timeouts.\r\n\r\n#### Steps to reproduce:\r\n\r\nHere is an App Engine standard + Python 3.8 project which has 2 routes to show the difference between iterating through all users using the iterate all helper, versus fetching each page directly:\r\n\r\nhttps://gist.github.com/davidwtbuxton/c6bbdc1e93f686cae931d1e38b5bd555\r\n\r\nThe code logs a message for every 1000 users. In my testing it takes about 5 seconds for every 1000 users on the slow path (using iterate_all) and about 1 second for every 1000 users on the fast path (not using iterate_all).\r\n\r\n\r\n#### Relevant Code:\r\n\r\n\r\nI've got a WIP patch here https://github.com/davidwtbuxton/firebase-admin-python/commit/20991aafcb007a9d4c7fc4bd8589ebff5de1ab16\r\n\r\nI need to test that WIP patch some more, but would this be useful? Suggestions for improving the patch?\r\n\r\nI think the cause of the poor performance is the [PageIterator class][1] and how next() is implemented. In the next() method, the code evaluates `self.items` 3 times. For the [_UserIterator class][2] the items list is actually a computed property, which accesses [ListUsersPage.users][3], which is also a computed property that builds a new list of user records.\r\n\r\nSo for each user in the list of users, the iterator ends up triggering a list of all users in the current page to be constructed 3 times, just to access 1 user. When a page has 1000 users, this ends up being much slower (1000 x 3) than the ideal case of constructing the list just 1 time for each page.\r\n\r\n[1]: https://github.com/firebase/firebase-admin-python/blob/01db7eb8da6094e09fc0311930718deec5ccd4ad/firebase_admin/_auth_utils.py#L35\r\n[2]: https://github.com/firebase/firebase-admin-python/blob/01db7eb8da6094e09fc0311930718deec5ccd4ad/firebase_admin/_user_mgt.py#L845\r\n[3]: https://github.com/firebase/firebase-admin-python/blob/01db7eb8da6094e09fc0311930718deec5ccd4ad/firebase_admin/_user_mgt.py#L357","author":{"url":"https://github.com/davidwtbuxton","@type":"Person","name":"davidwtbuxton"},"datePublished":"2021-09-08T11:04:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/571/firebase-admin-python/issues/571"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a3564682-9ed1-d2a2-7f92-70bfd200e9e0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9F70:201A54:148B6C2:1A95AB2:69924A8B
html-safe-nonce23d8be8fa080841fb87a9590f6faf6f53d52c98ce27902a6fcc2ac4bd2252bc7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjcwOjIwMUE1NDoxNDhCNkMyOjFBOTVBQjI6Njk5MjRBOEIiLCJ2aXNpdG9yX2lkIjoiMjUyNjg2MTg1NjIzODM1NzEzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2350eb6a50fd3ed5d1f72bfa3ac5f7fce5cf6d7cea7a94d138baa20c02541048
hovercard-subject-tagissue:991012838
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/firebase/firebase-admin-python/571/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0f12484a300256275acc6df880cdff51d994824c78681f9462e28c3240780534/firebase/firebase-admin-python/issues/571
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0f12484a300256275acc6df880cdff51d994824c78681f9462e28c3240780534/firebase/firebase-admin-python/issues/571
og:image:altOperating System version: n/a Firebase SDK version: firebase-admin==5.0.2 Firebase Product: auth, user management Python version: 3.8 Pip version: n/a [REQUIRED] Step 3: Describe the problem When f...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedavidwtbuxton
hostnamegithub.com
expected-hostnamegithub.com
None42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b
turbo-cache-controlno-preview
go-importgithub.com/firebase/firebase-admin-python git https://github.com/firebase/firebase-admin-python.git
octolytics-dimension-user_id1335026
octolytics-dimension-user_loginfirebase
octolytics-dimension-repository_id84979152
octolytics-dimension-repository_nwofirebase/firebase-admin-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id84979152
octolytics-dimension-repository_network_root_nwofirebase/firebase-admin-python
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
release848bc6032dcc93a9a7301dcc3f379a72ba13b96e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/firebase/firebase-admin-python/issues/571#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffirebase%2Ffirebase-admin-python%2Fissues%2F571
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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffirebase%2Ffirebase-admin-python%2Fissues%2F571
Sign up https://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=firebase%2Ffirebase-admin-python
Reloadhttps://github.com/firebase/firebase-admin-python/issues/571
Reloadhttps://github.com/firebase/firebase-admin-python/issues/571
Reloadhttps://github.com/firebase/firebase-admin-python/issues/571
firebase https://github.com/firebase
firebase-admin-pythonhttps://github.com/firebase/firebase-admin-python
Notifications https://github.com/login?return_to=%2Ffirebase%2Ffirebase-admin-python
Fork 347 https://github.com/login?return_to=%2Ffirebase%2Ffirebase-admin-python
Star 1.1k https://github.com/login?return_to=%2Ffirebase%2Ffirebase-admin-python
Code https://github.com/firebase/firebase-admin-python
Issues 79 https://github.com/firebase/firebase-admin-python/issues
Pull requests 38 https://github.com/firebase/firebase-admin-python/pulls
Actions https://github.com/firebase/firebase-admin-python/actions
Projects 0 https://github.com/firebase/firebase-admin-python/projects
Security 0 https://github.com/firebase/firebase-admin-python/security
Insights https://github.com/firebase/firebase-admin-python/pulse
Code https://github.com/firebase/firebase-admin-python
Issues https://github.com/firebase/firebase-admin-python/issues
Pull requests https://github.com/firebase/firebase-admin-python/pulls
Actions https://github.com/firebase/firebase-admin-python/actions
Projects https://github.com/firebase/firebase-admin-python/projects
Security https://github.com/firebase/firebase-admin-python/security
Insights https://github.com/firebase/firebase-admin-python/pulse
New issuehttps://github.com/login?return_to=https://github.com/firebase/firebase-admin-python/issues/571
New issuehttps://github.com/login?return_to=https://github.com/firebase/firebase-admin-python/issues/571
#572https://github.com/firebase/firebase-admin-python/pull/572
Very slow performance with firebase_admin.auth.list_users().iterate_all()https://github.com/firebase/firebase-admin-python/issues/571#top
#572https://github.com/firebase/firebase-admin-python/pull/572
api: authhttps://github.com/firebase/firebase-admin-python/issues?q=state%3Aopen%20label%3A%22api%3A%20auth%22
https://github.com/davidwtbuxton
https://github.com/davidwtbuxton
davidwtbuxtonhttps://github.com/davidwtbuxton
on Sep 8, 2021https://github.com/firebase/firebase-admin-python/issues/571#issue-991012838
https://gist.github.com/davidwtbuxton/c6bbdc1e93f686cae931d1e38b5bd555https://gist.github.com/davidwtbuxton/c6bbdc1e93f686cae931d1e38b5bd555
davidwtbuxton@20991aahttps://github.com/davidwtbuxton/firebase-admin-python/commit/20991aafcb007a9d4c7fc4bd8589ebff5de1ab16
PageIterator classhttps://github.com/firebase/firebase-admin-python/blob/01db7eb8da6094e09fc0311930718deec5ccd4ad/firebase_admin/_auth_utils.py#L35
_UserIterator classhttps://github.com/firebase/firebase-admin-python/blob/01db7eb8da6094e09fc0311930718deec5ccd4ad/firebase_admin/_user_mgt.py#L845
ListUsersPage.usershttps://github.com/firebase/firebase-admin-python/blob/01db7eb8da6094e09fc0311930718deec5ccd4ad/firebase_admin/_user_mgt.py#L357
api: authhttps://github.com/firebase/firebase-admin-python/issues?q=state%3Aopen%20label%3A%22api%3A%20auth%22
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.