how to improve performance while parsing tokens

Issue #108 closed
Raj Singh created an issue

Hi, We are using JwtConsumer to parse JWT in our application. But we are facing performance issues in our application when there are multiple requests. I tried using JsonWebSignature also so that there will be no expiry date validation but still there was no improvement. Please find below code snippet and let me know if there is any way to improve performance

issue.PNG

Comments (6)

  1. Brian Campbell repo owner

    Most of the processing is likely consumed by the signature validation on the token. Things like expiry date validation and other claims validation should have a very negligible impact on performance. I don't see any obvious way to improve performance. JwksVerificationKeyResolver does iterate over all the keys so if you have a very large number of keys that could be an area of improvement.

  2. Raj Singh reporter

    You are saying most of the time is consumed by signature validation. But there was a significant difference when I am profiling verifySignature and processToClaims. Time consumed by JsonWebSignature's verfiySignature method was somewhere between 3000-4000 ms while JwtConsumer processToClaims took 12000 ms - 20000 ms.

  3. Brian Campbell repo owner

    That's different than what I would have expected and I'm afraid I don't have any suggestions.

  4. Log in to comment