## TL;DR

Upgrade to a Hydra build that includes that fix. _Source: https://github.com/ory/hydra/issues/3863 (Ory)_ If Hydra's response times balloon under high login volume (reporters saw up to ~20s at ~3k session requests in 10s), the cause is locking in GetOrGenerateKeys.

## Steps

1. If Hydra's response times balloon under high login volume (reporters saw up to ~20s at ~3k session requests in 10s), the cause is locking in GetOrGenerateKeys. The fix the maintainer approved is the SELECT / INSERT ON CONFLICT approach (ory/hydra commit 5b0481b2a214a0c0471038c5b8480db018571e9c), which held response times under 100ms. Upgrade to a Hydra build that includes that fix.

2. _Source: https://github.com/ory/hydra/issues/3863 (Ory)_

## When to use

Use this skill when you run into "Service degradation under high load from GetOrGenerateKeys locking".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/ory/hydra/issues/3863
