-
Notifications
You must be signed in to change notification settings - Fork 17
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inefficiency of jwk to pem conversion causes performance issues #297
Comments
Thanks for reporting, what were you using in your previous flow to do the verification and which didn't exhibit any performance issues? |
jwks-rsa, and we stay with it for now (after realising that the |
I might not have the full context here, out of curiosity why do you think the package takes 6s to do this task? It's not related to cold starts on Lambda I assume, and the package running locally would also take that long to process? I've used jose before for all related JWT stuff, and have also used the web crypto API to do parsing / reading. What's the proposed solution for now if we want to get rid of |
@imdavidmin it seems @marcin-iwanow is suggesting to switch to |
well, |
I see, so the proposal is to deprecate There's a good comparison of JWT libraries here from jwt.io |
Adding in performance tests. Results so far show the normal success path (tests from |
@marcin-iwanow To diagnose this issue further, did you already test both RSA and EC keys on your local machine with good performance, but the same keys on your Lambda instance was taking very long, with 128MB memory? I'd like to be able to reproduce the issue to debug this further. Thanks |
on my local machine I haven't seen any significant differences, but also haven't profiled it carefully. (btw note that in your tests you use only RSA keys if I am not mistaken, maybe makes sense to add other ones also, but it's at your discretion ofc :) ) |
@marcin-iwanow can you provide a repro please? |
@marcin-iwanow I did a test myself deploying it on Lambda, also with 128MB memory. I've set up a dummy domain at
This request was responded to in 291ms, in my first request, so no caching should have been there. I didn't configure anything on the Lambda function differing from default. So without further information / repo from you, I'm not able to diagnose further. I can put in further test scenarios processing EC keys as well as RSA keys, but this is unlikely to yield significantly different results to the deployed test run. |
Closing as we're missing a repro and we're unable to reproduce. Feel free to reopen in case you can reproduce the issue. Thanks @imdavidmin for looking into it. |
In our setup, we verify our jwt tokens on an authoriser, which we deploy on AWS as a lambda. We tried to switch to
get-jwks
but with the config we used till now (128MB of memory) we observed that it's extremely slow: verifying a jwt signed with a EC key was taking 6s on average (!!!) if the key hasn't yet been cached. We traced it back to inefficient performance of thejwk-to-pem
package, which was responsible for almost the entire processing time.I'd suggest to change it, maybe just getting rid of the dependency at all (like
jwks-rsa
does)? Anyways it's stale for like 2 years now.The text was updated successfully, but these errors were encountered: