thibaultcha / lua-cassandra

Pure Lua driver for Apache Cassandra
https://thibaultcha.github.io/lua-cassandra
Other
98 stars 35 forks source link

[kong + cassandra] High number of native clients on cassandra when password authentication is used on cassandra #86

Closed jammm closed 7 years ago

jammm commented 7 years ago

When I enable PasswordAuthenticator on cassandra and run a stress test on kong, cassandra will hit 100% CPU pretty easily. This is in contrast to when the password isn't used i.e AllowAllAuthenticator, where cassandra can easily handle 5x the QPS and still have room for more.

My guess is that cassandra starts taking some more time to authenticate the password in each new connection request, hence the cosockets on kong start to wait and in the mean time new cosockets are created to process the rest of the requests as the existing cosockets are busy. This is bad because cassandra now gets too many native clients and each client has to authenticate separately with cassandra, hence causing the CPU to reach 100% and eventually block native client reqests, causing kong to return 500's all around.

This could probably be similar/connected to https://github.com/thibaultcha/lua-cassandra/issues/20

thibaultcha commented 7 years ago

As discussed on other channels, this is inherent to OpenResty itself and out of scope for this library to solve, hence closing this issue.