Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cassandra "set_keyspace" fails #170

Closed
subnetmarco opened this issue Apr 28, 2015 · 4 comments
Closed

Cassandra "set_keyspace" fails #170

subnetmarco opened this issue Apr 28, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@subnetmarco
Copy link
Member

Under load, Kong returns a bunch occurrences of the following exception:

nginx: 2015/04/28 09:20:22 [error] 24637#0: *492903 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/cassandra.lua:243: Result expected
stack traceback:
coroutine 0:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/cassandra.lua:243: in function 'set_keyspace'

Does it need to try to set the keyspace every time? Can the operation be optimized?

@thibaultcha
Copy link
Member

Yes it does need to because we are starting a new socket on every operation.

@thibaultcha thibaultcha removed their assignment Apr 28, 2015
@subnetmarco
Copy link
Member Author

I don't exactly know the internals, but I think it should use the nginx connection pool without restarting a new connection every time. Are we using http://wiki.nginx.org/HttpLuaModule#tcpsock:connect and http://wiki.nginx.org/HttpLuaModule#tcpsock:setkeepalive ?

@thibaultcha
Copy link
Member

Yeah

@subnetmarco subnetmarco changed the title Cassandra "set_keyspace" fails under load Cassandra "set_keyspace" fails Apr 28, 2015
@thibaultcha thibaultcha self-assigned this Apr 29, 2015
@subnetmarco
Copy link
Member Author

This can be mitigated by having a larger connection pool (set to 100 maybe): http://wiki.nginx.org/HttpLuaModule#lua_socket_pool_size

And by decreasing the keepalive timeout to 30s: http://wiki.nginx.org/HttpLuaModule#lua_socket_keepalive_timeout

thibaultcha added a commit that referenced this issue Apr 30, 2015
DAO sockets now take advantage of the connection pool and if they are
coming from it (meaning they've been used before), they don't set their
keyspace anymore.
@subnetmarco subnetmarco added the dao label May 1, 2015
thibaultcha added a commit that referenced this issue May 1, 2015
fix: reused DAO sockets don't set the keyspace. fix #170
ctranxuan pushed a commit to streamdataio/kong that referenced this issue Aug 25, 2015
DAO sockets now take advantage of the connection pool and if they are
coming from it (meaning they've been used before), they don't set their
keyspace anymore.
ctranxuan pushed a commit to streamdataio/kong that referenced this issue Aug 25, 2015
fix: reused DAO sockets don't set the keyspace. fix Kong#170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants