-
-
Notifications
You must be signed in to change notification settings - Fork 510
Slowness #740
Comments
I decided to implement the logic for user login using the same forms, db lookup and password verification. Surprisingly the form validation and password hashing both take ~10 seconds. ('before validation', '2017-12-31 23:52:13.046964') |
#731 ? |
I see that the hashing is done in the form validation, I'll have to take a look to see what else is happening to add ~20 seconds to the standard Flask-Security login. Even 9 seconds is too slow. ('before validation', '2018-01-01 00:07:56.931346') |
So this is interesting, if I don't use the Flask-Security LoginForm and call verify_password like I was previously the issue is resolved? The same function call took 10 seconds previously. ('before validation', '2018-01-01 00:51:16.683555') |
Not sure why but verify_password is slowed down significantly by running the forms verify_and_update_password prior to calling verify_password, verify_update_and_password is still ~10 seconds with the custom form. |
verify_and_update timings: ('verify_and_update initial', '2018-01-01 01:04:22.480948') |
This chunk of code in hash_password is the culprit:
I'm not sure what is even happening at this point, are we not hashing the current password during verification? What's the point of this? Why not just use the get_hmac and be done? |
After modifying my code to use entirely custom functions and Argon2, I had an idea. Why not offload token generation and update hashing to celery tasks as well? |
The verify function without update is very fast, it's the updates that take forever and for registration the confirmation token hashing makes the request take a very long time when we could just be generating that in the background. |
Please follow #731 |
We were checking if the Login/Register form already had a username attribute - if user wants 2 apps and 2 security instances - it would fail. closes pallets-eco#740
All Flask-Security related functions take ~20-30 seconds to complete. It did not use to be so slow. I thought maybe it was the emails but I moved those to a celery task, the slowness persists. I implemented other logic that uses email and it is instant.
Not sure why but this library has a huge delay for some reason.
The text was updated successfully, but these errors were encountered: