Open danielduan opened 1 week ago
I see the problem, I think we should able to move that to when you initialize the SDK instead of on every session load. Will look into fixing this soon.
I see the problem, I think we should able to move that to when you initialize the SDK instead of on every session load. Will look into fixing this soon.
thanks for looking into this! would appreciate if you can prioritize this for us.
In the Ruby SDK,
WorkOS::UserManagement.load_sealed_session
seems to fetch the remote JWKS on every load, adding about 100ms to each authenticated request.We use Rails and for every authenticated request, we call
authorize_request
which does the following:After implementing WorkOS, we realized all of our authenticated endpoints now take 100ms longer on the backend. It took some digging through our Sentry profiles to find that
create_remote_jwk_set
was called repeatedly: https://github.com/workos/workos-ruby/blob/8c401c2774be8fb073ba8334222ca06edd52d7a0/lib/workos/session.rb#L26We host our services on Render.com on GCP's
oregon-1
region.Please advise if there is a better way to authenticate the token or if improvements can be made to the SDK. Thanks!