You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Tony Anecito <ad...@yahoo.com> on 2013/06/21 22:29:44 UTC
Cassandra driver performance question...
Hi All,
I am using jdbc driver and noticed that if I run the same query twice the second time it is much faster.
I setup the row cache and column family cache and it not seem to make a difference.
I am wondering how to setup cassandra such that the first query is always as fast as the second one. The second one was 1.8msec and the first
28msec for the same exact paremeters. I am using preparestatement.
Thanks!
Re: Cassandra driver performance question...
Posted by Jabbar Azam <aj...@gmail.com>.
Hello Tony,
This came out recently
http://www.datastax.com/doc-source/developer/java-driver/index.html
I can't vouch for performance but the documentation is ok and it works. I'm
using it on a side project myself.
There is also astyanax by netflix and it also supports CQL 3
https://github.com/Netflix/astyanax/wiki/Getting-Started
Thanks
Jabbar Azam
On 24 June 2013 15:34, Tony Anecito <ad...@yahoo.com> wrote:
> Hi Jabbar,
>
> I am using JDBC driver because almost no examples exist about what you
> mention. Even most of the JDBC examples I find do not work because they are
> incomplete or out of date. If you have a good reference about what you
> mentioned I can try it.
>
> As I menioned I got selects to work now I am trying to get inserts to work
> via JDBC. Running into issues there also but I will work at it till I get
> them to work.
>
> Regards,
> -Tony
>
> *From:* Jabbar Azam <aj...@gmail.com>
> *To:* user@cassandra.apache.org
> *Cc:* Tony Anecito <ad...@yahoo.com>
> *Sent:* Monday, June 24, 2013 3:26 AM
>
> *Subject:* Re: Cassandra driver performance question...
>
> Hello tony,
> I couldnt reply earlier because I've been decorating over the weekend so
> have been a bit busy.
> Let me know what's happens.
> Out of couriosity why are you using and not a cql3 native driver?
> Thanks
> Jabbar Azam
> On 24 Jun 2013 00:32, "Tony Anecito" <ad...@yahoo.com> wrote:
>
> Hi Jabbar,
>
> I was able to get the performance issue resolved by reusing the
> connection object. It will be interesting to see what happens when I use a
> connection pool from a app server.
>
> I still think it would be a good idea to have a minimal mode for metadata.
> It is rare I use metadata.
>
> Regards,
> -Tony
>
> *From:* Tony Anecito <ad...@yahoo.com>
> *To:* "user@cassandra.apache.org" <us...@cassandra.apache.org>; Tony
> Anecito <ad...@yahoo.com>
> *Sent:* Friday, June 21, 2013 9:33 PM
> *Subject:* Re: Cassandra driver performance question...
>
> Hi Jabbar,
>
> I think I know what is going on. I happened accross a change mentioned by
> the jdbc driver developers regarding metadata caching. Seems the metadata
> caching was moved from the connection object to the preparedStatement
> object. So I am wondering if the time difference I am seeing on the second
> preparedStatement object is because of the Metadata is cached then.
>
> So my question is how to test this theory? Is there a way to stop the
> metadata from coming accross from Cassandra? A 20x performance improvement
> would be nice to have.
>
> Thanks,
> -Tony
>
> *From:* Tony Anecito <ad...@yahoo.com>
> *To:* "user@cassandra.apache.org" <us...@cassandra.apache.org>
> *Sent:* Friday, June 21, 2013 8:56 PM
> *Subject:* Re: Cassandra driver performance question...
>
> Thanks Jabbar,
>
> I ran nodetool as suggested and it 0 latency for the row count I have.
>
> I also ran cli list command for the table hit by my JDBC perparedStatement
> and it was slow like 121msecs the first time I ran it and second time I ran
> it it was 40msecs versus jdbc call of 38msecs to start with unless I run it
> twice also and get 1.5-2.5msecs for executeQuery the second time the
> preparedStatement is called.
>
> I ran describe from cli for the table and it said caching is "ALL" which
> is correct.
>
> A real mystery and I need to understand better what is going on.
>
> Regards,
> -Tony
>
> *From:* Jabbar Azam <aj...@gmail.com>
> *To:* user@cassandra.apache.org; Tony Anecito <ad...@yahoo.com>
> *Sent:* Friday, June 21, 2013 3:32 PM
> *Subject:* Re: Cassandra driver performance question...
>
> Hello Tony,
>
> I would guess that the first queries data is put into the row cache and
> the filesystem cache. The second query gets the data from the row cache and
> or the filesystem cache so it'll be faster.
>
> If you want to make it consistently faster having a key cache will
> definitely help. The following advice from Aaron Morton will also help
>
> "You can also see what it looks like from the server side.
>
> nodetool proxyhistograms will show you full request latency recorded by the coordinator.
> nodetool cfhistograms will show you the local read latency, this is just the time it takes
> to read data on a replica and does not include network or wait times.
>
> If the proxyhistograms is showing most requests running faster than your app says it's your
> app."
>
>
> http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
>
>
>
> Thanks
>
> Jabbar Azam
>
>
> On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
>
> Hi All,
> I am using jdbc driver and noticed that if I run the same query twice the
> second time it is much faster.
> I setup the row cache and column family cache and it not seem to make a
> difference.
>
> I am wondering how to setup cassandra such that the first query is always
> as fast as the second one. The second one was 1.8msec and the first 28msec
> for the same exact paremeters. I am using preparestatement.
>
> Thanks!
>
>
>
>
>
>
>
>
>
>
>
Re: Cassandra driver performance question...
Posted by Tony Anecito <ad...@yahoo.com>.
Hi Jabbar,
I am using JDBC driver because almost no examples exist about what you mention. Even most of the JDBC examples I find do not work because they are incomplete or out of date. If you have a good reference about what you mentioned I can try it.
As I menioned I got selects to work now I am trying to get inserts to work via JDBC. Running into issues there also but I will work at it till I get them to work.
Regards,
-Tony
From: Jabbar Azam <aj...@gmail.com>
To: user@cassandra.apache.org
Cc: Tony Anecito <ad...@yahoo.com>
Sent: Monday, June 24, 2013 3:26 AM
Subject: Re: Cassandra driver performance question...
Hello tony,
I couldnt reply earlier because I've been decorating over the weekend so have been a bit busy.
Let me know what's happens.
Out of couriosity why are you using and not a cql3 native driver?
Thanks
Jabbar Azam
On 24 Jun 2013 00:32, "Tony Anecito" <ad...@yahoo.com> wrote:
Hi Jabbar,
>
> I was able to get the performance issue resolved by reusing the connection object. It will be interesting to see what happens when I use a connection pool from a app server.
>
>I still think it would be a good idea to have a minimal mode for metadata. It is rare I use metadata.
>
>Regards,
>-Tony
>
>
>From: Tony Anecito <ad...@yahoo.com>
>To: "user@cassandra.apache.org" <us...@cassandra.apache.org>; Tony Anecito <ad...@yahoo.com>
>Sent: Friday, June 21, 2013 9:33 PM
>Subject: Re: Cassandra driver performance question...
>
>
>
>Hi Jabbar,
>
>I think I know what is going on. I happened accross a change mentioned by the jdbc driver developers regarding metadata caching. Seems the metadata caching was moved from the connection object to the preparedStatement object. So I am wondering if the time difference I am seeing on the second preparedStatement object is because of the Metadata is cached then.
>
>So my question is how to test this theory? Is there a way to stop the metadata from coming accross from Cassandra? A 20x performance improvement would be nice to have.
>
>Thanks,
>-Tony
>
>
>From: Tony Anecito <ad...@yahoo.com>
>To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
>Sent: Friday, June 21, 2013 8:56 PM
>Subject: Re: Cassandra driver performance question...
>
>
>
>Thanks Jabbar,
>
>I ran nodetool as suggested and it 0 latency for the row count I have.
>
>I also ran cli list command for the table hit by my JDBC perparedStatement and it was slow like 121msecs the first time I ran it and second time I ran it it was 40msecs versus jdbc call of 38msecs to start with unless I run it twice also and get 1.5-2.5msecs for executeQuery the second time the preparedStatement is called.
>
>I ran describe from cli for the table and it said caching is "ALL" which is correct.
>
>A real mystery and I need to understand better what is going on.
>
>Regards,
>-Tony
>
>
>From: Jabbar Azam <aj...@gmail.com>
>To: user@cassandra.apache.org; Tony Anecito <ad...@yahoo.com>
>Sent: Friday, June 21, 2013 3:32 PM
>Subject: Re: Cassandra driver performance question...
>
>
>
>Hello Tony,
>
>
>I would guess that the first queries data is put into the row cache and the filesystem cache. The second query gets the data from the row cache and or the filesystem cache so it'll be faster.
>
>
>If you want to make it consistently faster having a key cache will definitely help. The following advice from Aaron Morton will also help
>"You can also see what it looks like from the server side.
nodetool proxyhistograms will show you full request latency recorded by the coordinator.
nodetool cfhistograms will show you the local read latency, this is just the time it takes
to read data on a replica and does not include network or wait times.
If the proxyhistograms is showing most requests running faster than your app says it's your
app."
>
>
>http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
>
>
>
>
>Thanks
>
>Jabbar Azam
>
>
>
>On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
>
>Hi All,
>>I am using jdbc driver and noticed that if I run the same query twice the second time it is much faster.
>>I setup the row cache and column family cache and it not seem to make a difference.
>>
>>
>>I am wondering how to setup cassandra such that the first query is always as fast as the second one. The second one was 1.8msec and the first 28msec for the same exact paremeters. I am using preparestatement.
>>
>>
>>Thanks!
>
>
>
>
>
>
>
Re: Cassandra driver performance question...
Posted by Jabbar Azam <aj...@gmail.com>.
Hello tony,
I couldnt reply earlier because I've been decorating over the weekend so
have been a bit busy.
Let me know what's happens.
Out of couriosity why are you using and not a cql3 native driver?
Thanks
Jabbar Azam
On 24 Jun 2013 00:32, "Tony Anecito" <ad...@yahoo.com> wrote:
> Hi Jabbar,
>
> I was able to get the performance issue resolved by reusing the
> connection object. It will be interesting to see what happens when I use a
> connection pool from a app server.
>
> I still think it would be a good idea to have a minimal mode for metadata.
> It is rare I use metadata.
>
> Regards,
> -Tony
>
> *From:* Tony Anecito <ad...@yahoo.com>
> *To:* "user@cassandra.apache.org" <us...@cassandra.apache.org>; Tony
> Anecito <ad...@yahoo.com>
> *Sent:* Friday, June 21, 2013 9:33 PM
> *Subject:* Re: Cassandra driver performance question...
>
> Hi Jabbar,
>
> I think I know what is going on. I happened accross a change mentioned by
> the jdbc driver developers regarding metadata caching. Seems the metadata
> caching was moved from the connection object to the preparedStatement
> object. So I am wondering if the time difference I am seeing on the second
> preparedStatement object is because of the Metadata is cached then.
>
> So my question is how to test this theory? Is there a way to stop the
> metadata from coming accross from Cassandra? A 20x performance improvement
> would be nice to have.
>
> Thanks,
> -Tony
>
> *From:* Tony Anecito <ad...@yahoo.com>
> *To:* "user@cassandra.apache.org" <us...@cassandra.apache.org>
> *Sent:* Friday, June 21, 2013 8:56 PM
> *Subject:* Re: Cassandra driver performance question...
>
> Thanks Jabbar,
>
> I ran nodetool as suggested and it 0 latency for the row count I have.
>
> I also ran cli list command for the table hit by my JDBC perparedStatement
> and it was slow like 121msecs the first time I ran it and second time I ran
> it it was 40msecs versus jdbc call of 38msecs to start with unless I run it
> twice also and get 1.5-2.5msecs for executeQuery the second time the
> preparedStatement is called.
>
> I ran describe from cli for the table and it said caching is "ALL" which
> is correct.
>
> A real mystery and I need to understand better what is going on.
>
> Regards,
> -Tony
>
> *From:* Jabbar Azam <aj...@gmail.com>
> *To:* user@cassandra.apache.org; Tony Anecito <ad...@yahoo.com>
> *Sent:* Friday, June 21, 2013 3:32 PM
> *Subject:* Re: Cassandra driver performance question...
>
> Hello Tony,
>
> I would guess that the first queries data is put into the row cache and
> the filesystem cache. The second query gets the data from the row cache and
> or the filesystem cache so it'll be faster.
>
> If you want to make it consistently faster having a key cache will
> definitely help. The following advice from Aaron Morton will also help
>
> "You can also see what it looks like from the server side.
>
> nodetool proxyhistograms will show you full request latency recorded by the coordinator.
> nodetool cfhistograms will show you the local read latency, this is just the time it takes
> to read data on a replica and does not include network or wait times.
>
> If the proxyhistograms is showing most requests running faster than your app says it's your
> app."
>
>
> http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
>
>
>
> Thanks
>
> Jabbar Azam
>
>
> On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
>
> Hi All,
> I am using jdbc driver and noticed that if I run the same query twice the
> second time it is much faster.
> I setup the row cache and column family cache and it not seem to make a
> difference.
>
> I am wondering how to setup cassandra such that the first query is always
> as fast as the second one. The second one was 1.8msec and the first 28msec
> for the same exact paremeters. I am using preparestatement.
>
> Thanks!
>
>
>
>
>
>
>
>
>
Re: Cassandra driver performance question...
Posted by Tony Anecito <ad...@yahoo.com>.
Hi Jabbar,
I was able to get the performance issue resolved by reusing the connection object. It will be interesting to see what happens when I use a connection pool from a app server.
I still think it would be a good idea to have a minimal mode for metadata. It is rare I use metadata.
Regards,
-Tony
From: Tony Anecito <ad...@yahoo.com>
To: "user@cassandra.apache.org" <us...@cassandra.apache.org>; Tony Anecito <ad...@yahoo.com>
Sent: Friday, June 21, 2013 9:33 PM
Subject: Re: Cassandra driver performance question...
Hi Jabbar,
I think I know what is going on. I happened accross a change mentioned by the jdbc driver developers regarding metadata caching. Seems the metadata caching was moved from the connection object to the preparedStatement object. So I am wondering if the time difference I am seeing on the second preparedStatement object is because of the Metadata is cached then.
So my question is how to test this theory? Is there a way to stop the metadata from coming accross from Cassandra? A 20x performance improvement would be nice to have.
Thanks,
-Tony
From: Tony Anecito <ad...@yahoo.com>
To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
Sent: Friday, June 21, 2013 8:56 PM
Subject: Re: Cassandra driver performance question...
Thanks Jabbar,
I ran nodetool as suggested and it 0 latency for the row count I have.
I also ran cli list command for the table hit by my JDBC perparedStatement and it was slow like 121msecs the first time I ran it and second time I ran it it was 40msecs versus jdbc call of 38msecs to start with unless I run it twice also and get 1.5-2.5msecs for executeQuery the second time the preparedStatement is called.
I ran describe from cli for the table and it said caching is "ALL" which is correct.
A real mystery and I need to understand better what is going on.
Regards,
-Tony
From: Jabbar Azam <aj...@gmail.com>
To: user@cassandra.apache.org; Tony Anecito <ad...@yahoo.com>
Sent: Friday, June 21, 2013 3:32 PM
Subject: Re: Cassandra driver performance question...
Hello Tony,
I would guess that the first queries data is put into the row cache and the filesystem cache. The second query gets the data from the row cache and or the filesystem cache so it'll be faster.
If you want to make it consistently faster having a key cache will definitely help. The following advice from Aaron Morton will also help
"You can also see what it looks like from the server side.
nodetool proxyhistograms will show you full request latency recorded by the coordinator.
nodetool cfhistograms will show you the local read latency, this is just the time it takes
to read data on a replica and does not include network or wait times.
If the proxyhistograms is showing most requests running faster than your app says it's your
app."
http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
Thanks
Jabbar Azam
On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
Hi All,
>I am using jdbc driver and noticed that if I run the same query twice the second time it is much faster.
>I setup the row cache and column family cache and it not seem to make a difference.
>
>
>I am wondering how to setup cassandra such that the first query is always as fast as the second one. The second one was 1.8msec and the first 28msec for the same exact paremeters. I am using preparestatement.
>
>
>Thanks!
Re: Cassandra driver performance question...
Posted by Tony Anecito <ad...@yahoo.com>.
Hi Jabbar,
I think I know what is going on. I happened accross a change mentioned by the jdbc driver developers regarding metadata caching. Seems the metadata caching was moved from the connection object to the preparedStatement object. So I am wondering if the time difference I am seeing on the second preparedStatement object is because of the Metadata is cached then.
So my question is how to test this theory? Is there a way to stop the metadata from coming accross from Cassandra? A 20x performance improvement would be nice to have.
Thanks,
-Tony
From: Tony Anecito <ad...@yahoo.com>
To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
Sent: Friday, June 21, 2013 8:56 PM
Subject: Re: Cassandra driver performance question...
Thanks Jabbar,
I ran nodetool as suggested and it 0 latency for the row count I have.
I also ran cli list command for the table hit by my JDBC perparedStatement and it was slow like 121msecs the first time I ran it and second time I ran it it was 40msecs versus jdbc call of 38msecs to start with unless I run it twice also and get 1.5-2.5msecs for executeQuery the second time the preparedStatement is called.
I ran describe from cli for the table and it said caching is "ALL" which is correct.
A real mystery and I need to understand better what is going on.
Regards,
-Tony
From: Jabbar Azam <aj...@gmail.com>
To: user@cassandra.apache.org; Tony Anecito <ad...@yahoo.com>
Sent: Friday, June 21, 2013 3:32 PM
Subject: Re: Cassandra driver performance question...
Hello Tony,
I would guess that the first queries data is put into the row cache and the filesystem cache. The second query gets the data from the row cache and or the filesystem cache so it'll be faster.
If you want to make it consistently faster having a key cache will definitely help. The following advice from Aaron Morton will also help
"You can also see what it looks like from the server side.
nodetool proxyhistograms will show you full request latency recorded by the coordinator.
nodetool cfhistograms will show you the local read latency, this is just the time it takes
to read data on a replica and does not include network or wait times.
If the proxyhistograms is showing most requests running faster than your app says it's your
app."
http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
Thanks
Jabbar Azam
On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
Hi All,
>I am using jdbc driver and noticed that if I run the same query twice the second time it is much faster.
>I setup the row cache and column family cache and it not seem to make a difference.
>
>
>I am wondering how to setup cassandra such that the first query is always as fast as the second one. The second one was 1.8msec and the first 28msec for the same exact paremeters. I am using preparestatement.
>
>
>Thanks!
Re: Cassandra driver performance question...
Posted by Tony Anecito <ad...@yahoo.com>.
Thanks Jabbar,
I ran nodetool as suggested and it 0 latency for the row count I have.
I also ran cli list command for the table hit by my JDBC perparedStatement and it was slow like 121msecs the first time I ran it and second time I ran it it was 40msecs versus jdbc call of 38msecs to start with unless I run it twice also and get 1.5-2.5msecs for executeQuery the second time the preparedStatement is called.
I ran describe from cli for the table and it said caching is "ALL" which is correct.
A real mystery and I need to understand better what is going on.
Regards,
-Tony
From: Jabbar Azam <aj...@gmail.com>
To: user@cassandra.apache.org; Tony Anecito <ad...@yahoo.com>
Sent: Friday, June 21, 2013 3:32 PM
Subject: Re: Cassandra driver performance question...
Hello Tony,
I would guess that the first queries data is put into the row cache and the filesystem cache. The second query gets the data from the row cache and or the filesystem cache so it'll be faster.
If you want to make it consistently faster having a key cache will definitely help. The following advice from Aaron Morton will also help
"You can also see what it looks like from the server side.
nodetool proxyhistograms will show you full request latency recorded by the coordinator.
nodetool cfhistograms will show you the local read latency, this is just the time it takes
to read data on a replica and does not include network or wait times.
If the proxyhistograms is showing most requests running faster than your app says it's your
app."
http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
Thanks
Jabbar Azam
On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
Hi All,
>I am using jdbc driver and noticed that if I run the same query twice the second time it is much faster.
>I setup the row cache and column family cache and it not seem to make a difference.
>
>
>I am wondering how to setup cassandra such that the first query is always as fast as the second one. The second one was 1.8msec and the first 28msec for the same exact paremeters. I am using preparestatement.
>
>
>Thanks!
Re: Cassandra driver performance question...
Posted by Jabbar Azam <aj...@gmail.com>.
Hello Tony,
I would guess that the first queries data is put into the row cache and
the filesystem cache. The second query gets the data from the row cache and
or the filesystem cache so it'll be faster.
If you want to make it consistently faster having a key cache will
definitely help. The following advice from Aaron Morton will also help
"You can also see what it looks like from the server side.
nodetool proxyhistograms will show you full request latency recorded
by the coordinator.
nodetool cfhistograms will show you the local read latency, this is
just the time it takes
to read data on a replica and does not include network or wait times.
If the proxyhistograms is showing most requests running faster than
your app says it's your
app."
http://mail-archives.apache.org/mod_mbox/cassandra-user/201301.mbox/%3CE3741956-C47C-4B43-AD99-DAD8AFC3AE7C@thelastpickle.com%3E
Thanks
Jabbar Azam
On 21 June 2013 21:29, Tony Anecito <ad...@yahoo.com> wrote:
> Hi All,
> I am using jdbc driver and noticed that if I run the same query twice the
> second time it is much faster.
> I setup the row cache and column family cache and it not seem to make a
> difference.
>
> I am wondering how to setup cassandra such that the first query is always
> as fast as the second one. The second one was 1.8msec and the first 28msec
> for the same exact paremeters. I am using preparestatement.
>
> Thanks!
>