Repository navigation
Keycloak 26.0.7 Performance Challenges for High-Volume IoT Logins #36154
|
I am using Keycloak 26.0.7 for a use case that requires handling around 500,000 logins per second from IoT devices. After testing various configurations, I found that the fastest login method is using direct access with username and password. According to the Keycloak Concepts for Sizing CPU and Memory Resources, the recommended ratio is 1 vCPU for every 15 logins per second. However, this performance is significantly slower than needed for my use case. At this rate, I would require approximately 1,700 servers, each with 20 vCPUs, to meet the required throughput. To further investigate, I performed tests by reducing hash iterations to 1 and observed a login rate of only 50 logins per second per vCPU. By completely disabling password checking, the performance improved to approximately 125 logins per second per vCPU. Which means i still would need 500 servers with 20 vCPUs each. I cannot find what I'm missing. PS: tests are done on a local 10GB network and a jmeter server so network isn't the problem |
Replies: 3 comments 1 reply
|
@ahus1 @mhajas @ryanemerson Do you have any recommendations or possible approaches? |
|
Do you actually require Keycloak integration, or even password-based authentication? 500 000 authentications per second feels like a very large number for just about any authentication system, not just Keycloak. If you simply need password authentication, you could look into other systems, like RADIUS or LDAP / AD, that don't handle as many things as Keycloak does. But even with these, password-based authentication may not be a good approach for such a high throughput requirement, as it requires a lot of resources. In fact, password authentications cannot be fast, since this would mean that an attacker could also brute force the passwords faster. If all you need is authenticating the devices, and not actual users, you could use a form of mTLS authentication, where a private key / certificate pair is loaded on the device, and then all connections from the device are authenticated using the private key. This could increase throughput by quite a bit, since it's done at TLS level, instead of application level, and you may even be able to reuse the secure channel for further messages, instead of having to perform the authentication steps every time. For improved security you could also add a certificate rotation mechanism, where the IoT devices periodically get new certificates from the central servers after authentication. |
|
Thank you for your time. I switched to x.509 for this authentication based on you're recommendations. I'm in benchmarking step and will report the results. |
Do you actually require Keycloak integration, or even password-based authentication? 500 000 authentications per second feels like a very large number for just about any authentication system, not just Keycloak. If you simply need password authentication, you could look into other systems, like RADIUS or LDAP / AD, that don't handle as many things as Keycloak does. But even with these, password-based authentication may not be a good approach for such a high throughput requirement, as it requires a lot of resources. In fact, password authentications cannot be fast, since this would mean that an attacker could also brute force the passwords faster.
If all you need is authenticating the devi…