Home / Companies / Ory / Blog / Post Details
Content Deep Dive

Scaling Ory Hydra to ~2bn monthly OAuth2 flows on a single PostgreSQL DB

Blog post from Ory

Post Details
Company
Ory
Date Published
Author
Henning Perl
Word Count
1,227
Language
English
Hacker News Points
-
Summary

Ory Hydra, an open-source OAuth2 and OpenID Connect server, has undergone significant performance optimization to handle high authorization loads, as evidenced by a popular service provider's experience. The enhancements focused on re-engineering Hydra's persistence layer by adopting a transient OAuth2 flow, thus reducing database write traffic by passing AEAD-encoded state between parties instead of storing it in the database. This shift, alongside the introduction of improved database indices, resulted in a dramatic decrease in CPU usage and a reduction in database interactions by 4-5 times while halving database writes. Benchmarks on Microsoft Azure demonstrated that these changes enable Hydra to handle up to 1090 logins per second at peak times, showcasing the server's increased scalability and responsiveness. The Ory team plans to continue optimizing the software to further boost throughput on single PostgreSQL nodes, making Ory Hydra an attractive option for building scalable OAuth2 servers.