Slow cold-start validation when used in AWS Lambda #308
Replies: 2 comments 4 replies
-
I don't have a good answer for you unfortunately. I've suspected that there's a performance issue somewhere, but I've never sat down to try and figure out how to profile execution of the library to see where the bottlenecks are. The best I've been able to do thus far is to create a TODO for myself in a couple of places that I think might be bottlenecks, but I haven't measured anything to know for sure. For example, there's a bit of certificate chain signature verification in I think this might be related to why the I'm wondering, as a consumer of this library, if there's anything you can do to help with this investigation... |
Beta Was this translation helpful? Give feedback.
-
I just wanted to report back on some test results. Your changes definitely improved the situation. Where before I was seeing about 1000ms for the verifyAuthenticationResponse call on a cold start, now it's running around 70-120ms. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I've been experimenting with using @simplewebauthn/server in AWS Lambda as part of an AWS Cognito custom challenge setup to add WebAuthn to a normal Cognito user pool. I've gotten it working without too much trouble, due to good documentation and example code. This is a really nice project!
The one issue I've found is that after a lambda cold-start, the
verifyAuthenticationResponse
method can be slow. I'm timing this method call exclusively. With Node 12.x, it could take over 5 seconds the first time. AWS now recommends using Node 18.x. The results are better, but still slower than I'd expect at about 1-1.2 seconds for the first execution by a particular runtime. In the case of a warm-start, the method takes between 80-100ms.This seems to be one of the most actively maintained WebAuthn projects, and the combination of the client and server library is fantastic. The 1s time isn't a show stopper, but I'd love to figure out a way to make it faster.
Beta Was this translation helpful? Give feedback.
All reactions