Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed #36439: Optimizeacheck_password CPU heavy internal hashing process by using a ThreadPoolExecutor#19611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
roelzkie15 wants to merge1 commit intodjango:main
base:main
Choose a base branch
Loading
fromroelzkie15:fix-36439-auth-hashing-performance

Conversation

roelzkie15
Copy link

@roelzkie15roelzkie15 commentedJun 30, 2025
edited
Loading

Trac ticket number

ticket-36439

Branch description

Conducted severalexperiments/benchmarks on the performance of theacheck_password that blocks asyncio's event-loop, which is causing a performance bottleneck. Adding aThreadPoolExecutor significantly improved the performance gap compared to the test without using it.

Also, introduced theCHECK_PASSWORD_EXECUTOR_MAX_WORKERS for allowing developers to provide a configurable setting for theThreadPoolExecutor instance. See the updated document on this PR.

This PR targets a patch for v5.2 as mentioned in the ticket.

Note: The idea was not mine but byRobert Aistleitner who proposed it which was later on picked up by me since it has no owner for 4 weeks.

Checklist

  • This PR targets themain branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@roelzkie15roelzkie15force-pushed thefix-36439-auth-hashing-performance branch from3750296 to1bb5279CompareJuly 1, 2025 10:35
@roelzkie15roelzkie15 changed the titleFixed #36439: Optimizeacheck_password CPU heavy internal hashing process by using a ThreadPoolExecutorPerf #36439: Optimizeacheck_password CPU heavy internal hashing process by using a ThreadPoolExecutorJul 1, 2025
@roelzkie15roelzkie15force-pushed thefix-36439-auth-hashing-performance branch fromb984047 toc9eec27CompareJuly 1, 2025 17:01
@roelzkie15roelzkie15 marked this pull request as draftJuly 1, 2025 18:14
@roelzkie15roelzkie15force-pushed thefix-36439-auth-hashing-performance branch fromc9eec27 tod1a1ef1CompareJuly 1, 2025 18:16
@roelzkie15roelzkie15 marked this pull request as ready for reviewJuly 1, 2025 18:17
@roelzkie15roelzkie15force-pushed thefix-36439-auth-hashing-performance branch fromd1a1ef1 to50a6d87CompareJuly 1, 2025 18:19
@roelzkie15
Copy link
Author

Based on theticket, a test may not be needed for this patch.

@roelzkie15roelzkie15force-pushed thefix-36439-auth-hashing-performance branch from50a6d87 tob5354b5CompareJuly 5, 2025 15:57
@roelzkie15roelzkie15 changed the titlePerf #36439: Optimizeacheck_password CPU heavy internal hashing process by using a ThreadPoolExecutorFixed #36439: Optimizeacheck_password CPU heavy internal hashing process by using a ThreadPoolExecutorJul 5, 2025
@@ -546,6 +546,8 @@ def gettext_noop(s):

AUTH_PASSWORD_VALIDATORS = []

CHECK_PASSWORD_EXECUTOR_MAX_WORKERS = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We shouldn't add a global setting for something niche within a contrib app
In general adding settings is quite controversial and needs to be discussed and agreed with the wider community

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for checking. If we don't want to control any of theThreadPoolExecutor options, we can also rely on its basic instance or maybe create a ThreadPoolExecutor everyacheck_password call, depending on the performance.

sarahboyce reacted with thumbs up emoji
@@ -282,6 +282,18 @@ The default integer number of seconds to cache a page for the

See :doc:`/topics/cache`.

.. setting:: CHECK_PASSWORD_EXECUTOR_MAX_WORKERS

``CHECK_PASSWORD_EXECUTOR_MAX_WORKERS``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think we should add a setting, but if we were, this would need the "versionadded" annotation and a release note in 6.0

roelzkie15 reacted with eyes emoji
@roelzkie15roelzkie15 marked this pull request as draftJuly 16, 2025 07:07
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sarahboycesarahboycesarahboyce left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@roelzkie15@sarahboyce

[8]ページ先頭

©2009-2025 Movatter.jp