Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Benjamin Roth
This is the reason why One would like to use an mv for it. An mv Handels this. It adds a clustering Key while preserving uniqueness of the original pk. Am 11.11.2016 02:33 schrieb "Gang Liu" : > I guess orignal design is keep one record for one video per user. maybe >

Re: failure node rejoin

2016-11-10 Thread Ben Slater
>From a quick look I couldn’t find any defects other than the ones you’ve found that seem potentially relevant to your issue (if any one else on the list knows of one please chime in). Maybe the next step, if you haven’t done so already, is to check your Cassandra logs for any signs of issues (ie

Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Gang Liu
I guess orignal design is keep one record for one video per user. maybe their app will report many play records when user watching one video. So there will be many records when change primary key to (user_name, last_time). Also SELECT * FROM user_views WHERE user_name = ? LIMIT 10 without group by

Re: failure node rejoin

2016-11-10 Thread Yuji Ito
Thanks Ben, I tried 2.2.8 and could reproduce the problem. So, I'm investigating some bug fixes of repair and commitlog between 2.2.8 and 3.0.9. - CASSANDRA-12508: "nodetool repair returns status code 0 for some errors" - CASSANDRA-12436: "Under some races commit log may incorrectly think it

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Alexander Dejanovski
Shalom, you may have a high trace probability which could explain what you're observing : https://docs.datastax.com/en/cassandra/2.0/cassandra/tools/toolsSetTraceProbability.html On Thu, Nov 10, 2016 at 3:37 PM Chris Lohfink wrote: > count(*) actually pages through all

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Alexander Dejanovski
Could you check the write count on a per table basis in order to check which specific table is actually receiving writes ? Check the OneMinuteRate metric in org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*keyspace1*,scope= *standard1*,name=WriteLatency (Make sure you replace keyspace and

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Chris Lohfink
count(*) actually pages through all the data. So a select count(*) without a limit would be expected to cause a lot of load on the system. The hit is more than just IO load and CPU, it also creates a lot of garbage that can cause pauses slowing down the entire JVM. Some details here:

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Shalom Sagges
Hi Alexander, I'm referring to Writes Count generated from JMX: [image: Inline image 1] The higher curve shows the total write count per second for all nodes in the cluster and the lower curve is the average write count per second per node. The drop in the end is the result of shutting down one

Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Benjamin Roth
Yes sorry. Was irritated by the fact that Video id wasn't. Anyway probably an mv could be a way to go. Am 10.11.2016 13:38 schrieb "Carlos Alonso" : Hi Ben, you're right, but in my example the last_time timestamp field is actually part of the primary key. Regards Carlos

Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Carlos Alonso
Hi Ben, you're right, but in my example the last_time timestamp field is actually part of the primary key. Regards Carlos Alonso | Software Engineer | @calonso On 10 November 2016 at 11:50, Benjamin Roth wrote: > I pretty much guess the

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Alexander Dejanovski
Hi Shalom, Cassandra writes (mutations) are INSERTs, UPDATEs or DELETEs, it actually has nothing to do with flushes. A flush is the operation of moving data from memory (memtable) to disk (SSTable). The Cassandra write path and read path are two different things and, as far as I know, I see no

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Shalom Sagges
Yes, I know it's obsolete, but unfortunately this takes time. We're in the process of upgrading to 2.2.8 and 3.0.9 in our clusters. Thanks! Shalom Sagges DBA T: +972-74-700-4035 We

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Vladimir Yudovin
As I said I'm not sure about it, but it will be interesting to check memory heap state with any JMX tool, e.g. https://github.com/patric-r/jvmtop By a way, why Cassandra 2.0.14? It's quit old and unsupported version. Even in 2.0 branch there is 2.0.17 available. Best regards, Vladimir

Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Benjamin Roth
I pretty much guess the CQL you posted is invalid. You cannot set a clustering column that is not part of the primary key. But you can use a materialized view to append the last_time to the primary key and still preserver uniqueness of username + vedio_id (guess it is a typo in vedio). 2016-11-10

Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Carlos Alonso
What about having something like CREATE TABLE user_views ( user_name text, video_id text, position int, last_time timestamp, PRIMARY KEY(user_name, last_time) ) WITH CLUSTERING ORDER BY (last_time DESC); Where you insert a record everytime a user watches a video and then having a batch

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Shalom Sagges
Thanks for the quick reply Vladimir. Is it really possible that ~12,500 writes per second (per node in a 12 nodes DC) are caused by memory flushes? Shalom Sagges DBA T: +972-74-700-4035

Re: large number of pending compactions, sstables steadily increasing

2016-11-10 Thread Eiti Kimura
Ben, Benjamin thanks for reply, What your doing here is to change from LeveledCompactions to SizeTieredCompaction. This task is in progress and we are going to measure the results just for some column families. Ben, thanks for the procedure, will try it later again. When the problem happened

Re: Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Vladimir Yudovin
Hi Shalom, so not sure, but probably excessive memory consumption by this SELECT causes C* to flush tables to free memory. Best regards, Vladimir Yudovin, Winguzone - Hosted Cloud Cassandra Launch your cluster in minutes. On Thu, 10 Nov 2016 03:36:59 -0500Shalom Sagges

Can a Select Count(*) Affect Writes in Cassandra?

2016-11-10 Thread Shalom Sagges
Hi There! I'm using C* 2.0.14. I experienced a scenario where a "select count(*)" that ran every minute on a table with practically no results limit (yes, this should definitely be avoided), caused a huge increase in Cassandra writes to around 150 thousand writes per second for that particular

Re: 答复: 答复: A difficult data model with C*

2016-11-10 Thread Vladimir Yudovin
Do you mean the oldest one should be removed when a new play is added? Sure. As you described the issue "the last ten items may be adequate for the business" Best regards, Vladimir Yudovin, Winguzone - Hosted Cloud Cassandra Launch your cluster in minutes. On Wed, 09 Nov 2016