cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Sanda (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-5594) CassandraAuthorizer.authorize(AuthenticatedUser, IResource) should use prepared statement
Date Fri, 24 May 2013 20:51:22 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-5594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13666660#comment-13666660
] 

John Sanda commented on CASSANDRA-5594:
---------------------------------------

In fact, I would recommend switching over to use prepared statements for all of the queries
in CassandraAuthorizer. Some of the Antlr parser objects can consume a substantial amount
of heap. Even though those objects are short-lived I have found that it can have a big impact
on performance.
                
> CassandraAuthorizer.authorize(AuthenticatedUser, IResource) should use prepared statement
> -----------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5594
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5594
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2.4, 1.2.5
>            Reporter: John Sanda
>              Labels: authorization
>
> The query in the authorize method will be extensively, providing you have configured
Cassandra to use CassandraAuthorizer. Given the frequency of this query against the permissions
CF, a prepared statement should be used here. There is a non-trivial amount of overhead involved
with parsing a statement; so, this query would greatly benefit given how much it is run.
> While I was doing some testing recently, I eventually hit some timeout exceptions, but
the timeouts were from the query in the authorize method. Here is a recent stack trace from
one such exception,
> ERROR [Native-Transport-Requests:11] 2013-05-20 16:16:16,702 ErrorMessage.java (line
210) Unexpected exception during request
> com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException:
org.apache.cassandra.exceptions.ReadTimeoutException: Operation timed out - received only
0 responses.
>         at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2258)
>         at com.google.common.cache.LocalCache.get(LocalCache.java:3990)
>         at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3994)
>         at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4878)
>         at org.apache.cassandra.service.ClientState.authorize(ClientState.java:290)
>         at org.apache.cassandra.service.ClientState.ensureHasPermission(ClientState.java:170)
>         at org.apache.cassandra.service.ClientState.hasAccess(ClientState.java:163)
>         at org.apache.cassandra.service.ClientState.hasColumnFamilyAccess(ClientState.java:147)
>         at org.apache.cassandra.cql3.statements.ModificationStatement.checkAccess(ModificationStatement.java:69)
>         at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:131)
>         at org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:257)
>         at org.apache.cassandra.transport.messages.ExecuteMessage.execute(ExecuteMessage.java:121)
>         at org.apache.cassandra.transport.Message$Dispatcher.messageReceived(Message.java:287)
>         at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
>         at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
>         at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
>         at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:45)
>         at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:69)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: java.lang.RuntimeException: org.apache.cassandra.exceptions.ReadTimeoutException:
Operation timed out - received only 0 responses.
>         at org.apache.cassandra.auth.Auth.isSuperuser(Auth.java:95)
>         at org.apache.cassandra.auth.AuthenticatedUser.isSuper(AuthenticatedUser.java:50)
>         at org.apache.cassandra.auth.CassandraAuthorizer.authorize(CassandraAuthorizer.java:61)
>         at org.apache.cassandra.service.ClientState$1.load(ClientState.java:276)
>         at org.apache.cassandra.service.ClientState$1.load(ClientState.java:273)
>         at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3589)
>         at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2374)
>         at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2337)
>         at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2252)
>         ... 20 more
> Caused by: org.apache.cassandra.exceptions.ReadTimeoutException: Operation timed out
- received only 0 responses.
>         at org.apache.cassandra.service.ReadCallback.get(ReadCallback.java:99)
>         at org.apache.cassandra.service.StorageProxy.fetchRows(StorageProxy.java:941)
>         at org.apache.cassandra.service.StorageProxy.read(StorageProxy.java:829)
>         at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:124)
>         at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:56)
>         at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
>         at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:143)
>         at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:151)
>         at org.apache.cassandra.auth.Auth.isSuperuser(Auth.java:90)
>         ... 28 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message