Re: Time series data model and tombstones
Thanks for the update. Good to know that TWCS give you more stability On Wed, Feb 8, 2017 at 6:20 PM, John Sanda wrote: > I wanted to provide a quick update. I was able to patch one of the > environments that is hitting the tombstone problem. It has been running > TWCS for five days now, and things are stable so far. I also had a patch to > the application code to implement date partitioning ready to go, but I > wanted to see how things went with only making the compaction changes. > > On Sun, Jan 29, 2017 at 4:05 PM, DuyHai Doan wrote: > >> In theory, you're right and Cassandra should possibly skip reading cells >> having time < 50. But it's all theory, in practice Cassandra read chunks of >> xxx kilobytes worth of data (don't remember the exact value of xxx, maybe >> 64k or far less) so you may end up reading tombstones. >> >> On Sun, Jan 29, 2017 at 9:24 PM, John Sanda wrote: >> >>> Thanks for the clarification. Let's say I have a partition in an SSTable >>> where the values of time range from 100 to 10 and everything < 50 is >>> expired. If I do a query with time < 100 and time >= 50, are there >>> scenarios in which Cassandra will have to read cells where time < 50? In >>> particular I am wondering if compression might have any affect. >>> >>> On Sun, Jan 29, 2017 at 3:01 PM DuyHai Doan >>> wrote: >>> "Should the data be sorted by my time column regardless of the compaction strategy" --> It does What I mean is that an old "chunk" of expired data in SSTABLE-12 may be compacted together with a new chunk of SSTABLE-2 containing fresh data so in the new resulting SSTable will contain tombstones AND fresh data inside the same partition, but of course sorted by clustering column "time". On Sun, Jan 29, 2017 at 8:55 PM, John Sanda wrote: Since STCS does not sort data based on timestamp, your wide partition may span over multiple SSTables and inside each SSTable, old data (+ tombstones) may sit on the same partition as newer data. Should the data be sorted by my time column regardless of the compaction strategy? I didn't think that the column timestamp came into play with respect to sorting. I have been able to review some SSTables with sstablemetadata and I can see that old/expired data is definitely living with live data. On Sun, Jan 29, 2017 at 2:38 PM, DuyHai Doan wrote: Ok so give it a try with TWCS. Since STCS does not sort data based on timestamp, your wide partition may span over multiple SSTables and inside each SSTable, old data (+ tombstones) may sit on the same partition as newer data. When reading by slice, even if you request for fresh data, Cassandra has to scan over a lot tombstones to fetch the correct range of data thus your issue On Sun, Jan 29, 2017 at 8:19 PM, John Sanda wrote: It was with STCS. It was on a 2.x version before TWCS was available. On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan wrote: Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? If you're using DTCS, beware of its weird behavior and tricky configuration. On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: Your partitioning key is text. If you have multiple entries per id you are likely hitting older cells that have expired. Descending only affects how the data is stored on disk, if you have to read the whole partition to find whichever time you are querying for you could potentially hit tombstones in other SSTables that contain the same "id". As mentioned previously, you need to add a time bucket to your partitioning key and definitely use DTCS/TWCS. As I mentioned previously, the UI only queries recent data, e.g., the past hour, past two hours, past day, past week. The UI does not query for anything older than the TTL which is 7 days. My understanding and expectation was that Cassandra would only scan live cells. The UI is a separate application that I do not maintain, so I am not 100% certain about the queries. I have been told that it does not query for anything older than 7 days. On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves wrote: Your partitioning key is text. If you have multiple entries per id you are likely hitting older cells that have expired. Descending only affects how the data is stored on disk, if you have to read the whole partition to find whichever time you are querying for you could potentially hit tombstones in other SSTables that contain the same "id". As mentioned previously, you need to add a time bucket to your partitioning key and definitely use DTCS/TWCS. -- - John
Re: Time series data model and tombstones
I wanted to provide a quick update. I was able to patch one of the environments that is hitting the tombstone problem. It has been running TWCS for five days now, and things are stable so far. I also had a patch to the application code to implement date partitioning ready to go, but I wanted to see how things went with only making the compaction changes. On Sun, Jan 29, 2017 at 4:05 PM, DuyHai Doan wrote: > In theory, you're right and Cassandra should possibly skip reading cells > having time < 50. But it's all theory, in practice Cassandra read chunks of > xxx kilobytes worth of data (don't remember the exact value of xxx, maybe > 64k or far less) so you may end up reading tombstones. > > On Sun, Jan 29, 2017 at 9:24 PM, John Sanda wrote: > >> Thanks for the clarification. Let's say I have a partition in an SSTable >> where the values of time range from 100 to 10 and everything < 50 is >> expired. If I do a query with time < 100 and time >= 50, are there >> scenarios in which Cassandra will have to read cells where time < 50? In >> particular I am wondering if compression might have any affect. >> >> On Sun, Jan 29, 2017 at 3:01 PM DuyHai Doan wrote: >> >>> "Should the data be sorted by my time column regardless of the >>> compaction strategy" --> It does >>> >>> What I mean is that an old "chunk" of expired data in SSTABLE-12 may be >>> compacted together with a new chunk of SSTABLE-2 containing fresh data so >>> in the new resulting SSTable will contain tombstones AND fresh data inside >>> the same partition, but of course sorted by clustering column "time". >>> >>> On Sun, Jan 29, 2017 at 8:55 PM, John Sanda >>> wrote: >>> >>> Since STCS does not sort data based on timestamp, your wide partition >>> may span over multiple SSTables and inside each SSTable, old data (+ >>> tombstones) may sit on the same partition as newer data. >>> >>> >>> Should the data be sorted by my time column regardless of the compaction >>> strategy? I didn't think that the column timestamp came into play with >>> respect to sorting. I have been able to review some SSTables with >>> sstablemetadata and I can see that old/expired data is definitely living >>> with live data. >>> >>> >>> On Sun, Jan 29, 2017 at 2:38 PM, DuyHai Doan >>> wrote: >>> >>> Ok so give it a try with TWCS. Since STCS does not sort data based on >>> timestamp, your wide partition may span over multiple SSTables and inside >>> each SSTable, old data (+ tombstones) may sit on the same partition as >>> newer data. >>> >>> When reading by slice, even if you request for fresh data, Cassandra has >>> to scan over a lot tombstones to fetch the correct range of data thus your >>> issue >>> >>> On Sun, Jan 29, 2017 at 8:19 PM, John Sanda >>> wrote: >>> >>> It was with STCS. It was on a 2.x version before TWCS was available. >>> >>> On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan >>> wrote: >>> >>> Did you get this Overwhelming tombstonne behavior with STCS or with TWCS >>> ? >>> >>> If you're using DTCS, beware of its weird behavior and tricky >>> configuration. >>> >>> On Sun, Jan 29, 2017 at 3:52 PM, John Sanda >>> wrote: >>> >>> Your partitioning key is text. If you have multiple entries per id you >>> are likely hitting older cells that have expired. Descending only affects >>> how the data is stored on disk, if you have to read the whole partition to >>> find whichever time you are querying for you could potentially hit >>> tombstones in other SSTables that contain the same "id". As mentioned >>> previously, you need to add a time bucket to your partitioning key and >>> definitely use DTCS/TWCS. >>> >>> >>> As I mentioned previously, the UI only queries recent data, e.g., the >>> past hour, past two hours, past day, past week. The UI does not query for >>> anything older than the TTL which is 7 days. My understanding and >>> expectation was that Cassandra would only scan live cells. The UI is a >>> separate application that I do not maintain, so I am not 100% certain about >>> the queries. I have been told that it does not query for anything older >>> than 7 days. >>> >>> On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves >>> wrote: >>> >>> >>> Your partitioning key is text. If you have multiple entries per id you >>> are likely hitting older cells that have expired. Descending only affects >>> how the data is stored on disk, if you have to read the whole partition to >>> find whichever time you are querying for you could potentially hit >>> tombstones in other SSTables that contain the same "id". As mentioned >>> previously, you need to add a time bucket to your partitioning key and >>> definitely use DTCS/TWCS. >>> >>> >>> >>> >>> >>> -- >>> >>> - John >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> -- >>> >>> - John >>> >>> >>> >>> >>> >>> >>> >>> > -- - John
Re: Time series data model and tombstones
In theory, you're right and Cassandra should possibly skip reading cells having time < 50. But it's all theory, in practice Cassandra read chunks of xxx kilobytes worth of data (don't remember the exact value of xxx, maybe 64k or far less) so you may end up reading tombstones. On Sun, Jan 29, 2017 at 9:24 PM, John Sanda wrote: > Thanks for the clarification. Let's say I have a partition in an SSTable > where the values of time range from 100 to 10 and everything < 50 is > expired. If I do a query with time < 100 and time >= 50, are there > scenarios in which Cassandra will have to read cells where time < 50? In > particular I am wondering if compression might have any affect. > > On Sun, Jan 29, 2017 at 3:01 PM DuyHai Doan wrote: > >> "Should the data be sorted by my time column regardless of the >> compaction strategy" --> It does >> >> What I mean is that an old "chunk" of expired data in SSTABLE-12 may be >> compacted together with a new chunk of SSTABLE-2 containing fresh data so >> in the new resulting SSTable will contain tombstones AND fresh data inside >> the same partition, but of course sorted by clustering column "time". >> >> On Sun, Jan 29, 2017 at 8:55 PM, John Sanda wrote: >> >> Since STCS does not sort data based on timestamp, your wide partition may >> span over multiple SSTables and inside each SSTable, old data (+ >> tombstones) may sit on the same partition as newer data. >> >> >> Should the data be sorted by my time column regardless of the compaction >> strategy? I didn't think that the column timestamp came into play with >> respect to sorting. I have been able to review some SSTables with >> sstablemetadata and I can see that old/expired data is definitely living >> with live data. >> >> >> On Sun, Jan 29, 2017 at 2:38 PM, DuyHai Doan >> wrote: >> >> Ok so give it a try with TWCS. Since STCS does not sort data based on >> timestamp, your wide partition may span over multiple SSTables and inside >> each SSTable, old data (+ tombstones) may sit on the same partition as >> newer data. >> >> When reading by slice, even if you request for fresh data, Cassandra has >> to scan over a lot tombstones to fetch the correct range of data thus your >> issue >> >> On Sun, Jan 29, 2017 at 8:19 PM, John Sanda wrote: >> >> It was with STCS. It was on a 2.x version before TWCS was available. >> >> On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan >> wrote: >> >> Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? >> >> If you're using DTCS, beware of its weird behavior and tricky >> configuration. >> >> On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: >> >> Your partitioning key is text. If you have multiple entries per id you >> are likely hitting older cells that have expired. Descending only affects >> how the data is stored on disk, if you have to read the whole partition to >> find whichever time you are querying for you could potentially hit >> tombstones in other SSTables that contain the same "id". As mentioned >> previously, you need to add a time bucket to your partitioning key and >> definitely use DTCS/TWCS. >> >> >> As I mentioned previously, the UI only queries recent data, e.g., the >> past hour, past two hours, past day, past week. The UI does not query for >> anything older than the TTL which is 7 days. My understanding and >> expectation was that Cassandra would only scan live cells. The UI is a >> separate application that I do not maintain, so I am not 100% certain about >> the queries. I have been told that it does not query for anything older >> than 7 days. >> >> On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves >> wrote: >> >> >> Your partitioning key is text. If you have multiple entries per id you >> are likely hitting older cells that have expired. Descending only affects >> how the data is stored on disk, if you have to read the whole partition to >> find whichever time you are querying for you could potentially hit >> tombstones in other SSTables that contain the same "id". As mentioned >> previously, you need to add a time bucket to your partitioning key and >> definitely use DTCS/TWCS. >> >> >> >> >> >> -- >> >> - John >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> - John >> >> >> >> >> >> >> >>
Re: Time series data model and tombstones
Check out our post on how to use TWCS before 3.0. http://thelastpickle.com/blog/2017/01/10/twcs-part2.html On Sun, Jan 29, 2017 at 11:20 AM John Sanda wrote: > It was with STCS. It was on a 2.x version before TWCS was available. > > On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan wrote: > > Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? > > If you're using DTCS, beware of its weird behavior and tricky > configuration. > > On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > > > As I mentioned previously, the UI only queries recent data, e.g., the past > hour, past two hours, past day, past week. The UI does not query for > anything older than the TTL which is 7 days. My understanding and > expectation was that Cassandra would only scan live cells. The UI is a > separate application that I do not maintain, so I am not 100% certain about > the queries. I have been told that it does not query for anything older > than 7 days. > > On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves > wrote: > > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > > > > > > -- > > - John > > > > > > > >
Re: Time series data model and tombstones
Thanks for the clarification. Let's say I have a partition in an SSTable where the values of time range from 100 to 10 and everything < 50 is expired. If I do a query with time < 100 and time >= 50, are there scenarios in which Cassandra will have to read cells where time < 50? In particular I am wondering if compression might have any affect. On Sun, Jan 29, 2017 at 3:01 PM DuyHai Doan wrote: > "Should the data be sorted by my time column regardless of the compaction > strategy" --> It does > > What I mean is that an old "chunk" of expired data in SSTABLE-12 may be > compacted together with a new chunk of SSTABLE-2 containing fresh data so > in the new resulting SSTable will contain tombstones AND fresh data inside > the same partition, but of course sorted by clustering column "time". > > On Sun, Jan 29, 2017 at 8:55 PM, John Sanda wrote: > > Since STCS does not sort data based on timestamp, your wide partition may > span over multiple SSTables and inside each SSTable, old data (+ > tombstones) may sit on the same partition as newer data. > > > Should the data be sorted by my time column regardless of the compaction > strategy? I didn't think that the column timestamp came into play with > respect to sorting. I have been able to review some SSTables with > sstablemetadata and I can see that old/expired data is definitely living > with live data. > > > On Sun, Jan 29, 2017 at 2:38 PM, DuyHai Doan wrote: > > Ok so give it a try with TWCS. Since STCS does not sort data based on > timestamp, your wide partition may span over multiple SSTables and inside > each SSTable, old data (+ tombstones) may sit on the same partition as > newer data. > > When reading by slice, even if you request for fresh data, Cassandra has > to scan over a lot tombstones to fetch the correct range of data thus your > issue > > On Sun, Jan 29, 2017 at 8:19 PM, John Sanda wrote: > > It was with STCS. It was on a 2.x version before TWCS was available. > > On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan wrote: > > Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? > > If you're using DTCS, beware of its weird behavior and tricky > configuration. > > On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > > > As I mentioned previously, the UI only queries recent data, e.g., the past > hour, past two hours, past day, past week. The UI does not query for > anything older than the TTL which is 7 days. My understanding and > expectation was that Cassandra would only scan live cells. The UI is a > separate application that I do not maintain, so I am not 100% certain about > the queries. I have been told that it does not query for anything older > than 7 days. > > On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves > wrote: > > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > > > > > > -- > > - John > > > > > > > > > > > > > > > > -- > > - John > > > > > > > >
Re: Time series data model and tombstones
"Should the data be sorted by my time column regardless of the compaction strategy" --> It does What I mean is that an old "chunk" of expired data in SSTABLE-12 may be compacted together with a new chunk of SSTABLE-2 containing fresh data so in the new resulting SSTable will contain tombstones AND fresh data inside the same partition, but of course sorted by clustering column "time". On Sun, Jan 29, 2017 at 8:55 PM, John Sanda wrote: > Since STCS does not sort data based on timestamp, your wide partition may >> span over multiple SSTables and inside each SSTable, old data (+ >> tombstones) may sit on the same partition as newer data. > > > Should the data be sorted by my time column regardless of the compaction > strategy? I didn't think that the column timestamp came into play with > respect to sorting. I have been able to review some SSTables with > sstablemetadata and I can see that old/expired data is definitely living > with live data. > > > On Sun, Jan 29, 2017 at 2:38 PM, DuyHai Doan wrote: > >> Ok so give it a try with TWCS. Since STCS does not sort data based on >> timestamp, your wide partition may span over multiple SSTables and inside >> each SSTable, old data (+ tombstones) may sit on the same partition as >> newer data. >> >> When reading by slice, even if you request for fresh data, Cassandra has >> to scan over a lot tombstones to fetch the correct range of data thus your >> issue >> >> On Sun, Jan 29, 2017 at 8:19 PM, John Sanda wrote: >> >>> It was with STCS. It was on a 2.x version before TWCS was available. >>> >>> On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan >>> wrote: >>> Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? If you're using DTCS, beware of its weird behavior and tricky configuration. On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: Your partitioning key is text. If you have multiple entries per id you are likely hitting older cells that have expired. Descending only affects how the data is stored on disk, if you have to read the whole partition to find whichever time you are querying for you could potentially hit tombstones in other SSTables that contain the same "id". As mentioned previously, you need to add a time bucket to your partitioning key and definitely use DTCS/TWCS. As I mentioned previously, the UI only queries recent data, e.g., the past hour, past two hours, past day, past week. The UI does not query for anything older than the TTL which is 7 days. My understanding and expectation was that Cassandra would only scan live cells. The UI is a separate application that I do not maintain, so I am not 100% certain about the queries. I have been told that it does not query for anything older than 7 days. On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves wrote: Your partitioning key is text. If you have multiple entries per id you are likely hitting older cells that have expired. Descending only affects how the data is stored on disk, if you have to read the whole partition to find whichever time you are querying for you could potentially hit tombstones in other SSTables that contain the same "id". As mentioned previously, you need to add a time bucket to your partitioning key and definitely use DTCS/TWCS. -- - John >> > > > -- > > - John >
Re: Time series data model and tombstones
> > Since STCS does not sort data based on timestamp, your wide partition may > span over multiple SSTables and inside each SSTable, old data (+ > tombstones) may sit on the same partition as newer data. Should the data be sorted by my time column regardless of the compaction strategy? I didn't think that the column timestamp came into play with respect to sorting. I have been able to review some SSTables with sstablemetadata and I can see that old/expired data is definitely living with live data. On Sun, Jan 29, 2017 at 2:38 PM, DuyHai Doan wrote: > Ok so give it a try with TWCS. Since STCS does not sort data based on > timestamp, your wide partition may span over multiple SSTables and inside > each SSTable, old data (+ tombstones) may sit on the same partition as > newer data. > > When reading by slice, even if you request for fresh data, Cassandra has > to scan over a lot tombstones to fetch the correct range of data thus your > issue > > On Sun, Jan 29, 2017 at 8:19 PM, John Sanda wrote: > >> It was with STCS. It was on a 2.x version before TWCS was available. >> >> On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan >> wrote: >> >>> Did you get this Overwhelming tombstonne behavior with STCS or with TWCS >>> ? >>> >>> If you're using DTCS, beware of its weird behavior and tricky >>> configuration. >>> >>> On Sun, Jan 29, 2017 at 3:52 PM, John Sanda >>> wrote: >>> >>> Your partitioning key is text. If you have multiple entries per id you >>> are likely hitting older cells that have expired. Descending only affects >>> how the data is stored on disk, if you have to read the whole partition to >>> find whichever time you are querying for you could potentially hit >>> tombstones in other SSTables that contain the same "id". As mentioned >>> previously, you need to add a time bucket to your partitioning key and >>> definitely use DTCS/TWCS. >>> >>> >>> As I mentioned previously, the UI only queries recent data, e.g., the >>> past hour, past two hours, past day, past week. The UI does not query for >>> anything older than the TTL which is 7 days. My understanding and >>> expectation was that Cassandra would only scan live cells. The UI is a >>> separate application that I do not maintain, so I am not 100% certain about >>> the queries. I have been told that it does not query for anything older >>> than 7 days. >>> >>> On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves >>> wrote: >>> >>> >>> Your partitioning key is text. If you have multiple entries per id you >>> are likely hitting older cells that have expired. Descending only affects >>> how the data is stored on disk, if you have to read the whole partition to >>> find whichever time you are querying for you could potentially hit >>> tombstones in other SSTables that contain the same "id". As mentioned >>> previously, you need to add a time bucket to your partitioning key and >>> definitely use DTCS/TWCS. >>> >>> >>> >>> >>> >>> -- >>> >>> - John >>> >>> >>> >>> >>> >>> >>> >>> > -- - John
Re: Time series data model and tombstones
Ok so give it a try with TWCS. Since STCS does not sort data based on timestamp, your wide partition may span over multiple SSTables and inside each SSTable, old data (+ tombstones) may sit on the same partition as newer data. When reading by slice, even if you request for fresh data, Cassandra has to scan over a lot tombstones to fetch the correct range of data thus your issue On Sun, Jan 29, 2017 at 8:19 PM, John Sanda wrote: > It was with STCS. It was on a 2.x version before TWCS was available. > > On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan wrote: > >> Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? >> >> If you're using DTCS, beware of its weird behavior and tricky >> configuration. >> >> On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: >> >> Your partitioning key is text. If you have multiple entries per id you >> are likely hitting older cells that have expired. Descending only affects >> how the data is stored on disk, if you have to read the whole partition to >> find whichever time you are querying for you could potentially hit >> tombstones in other SSTables that contain the same "id". As mentioned >> previously, you need to add a time bucket to your partitioning key and >> definitely use DTCS/TWCS. >> >> >> As I mentioned previously, the UI only queries recent data, e.g., the >> past hour, past two hours, past day, past week. The UI does not query for >> anything older than the TTL which is 7 days. My understanding and >> expectation was that Cassandra would only scan live cells. The UI is a >> separate application that I do not maintain, so I am not 100% certain about >> the queries. I have been told that it does not query for anything older >> than 7 days. >> >> On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves >> wrote: >> >> >> Your partitioning key is text. If you have multiple entries per id you >> are likely hitting older cells that have expired. Descending only affects >> how the data is stored on disk, if you have to read the whole partition to >> find whichever time you are querying for you could potentially hit >> tombstones in other SSTables that contain the same "id". As mentioned >> previously, you need to add a time bucket to your partitioning key and >> definitely use DTCS/TWCS. >> >> >> >> >> >> -- >> >> - John >> >> >> >> >> >> >> >>
Re: Time series data model and tombstones
It was with STCS. It was on a 2.x version before TWCS was available. On Sun, Jan 29, 2017 at 10:58 AM DuyHai Doan wrote: > Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? > > If you're using DTCS, beware of its weird behavior and tricky > configuration. > > On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > > > As I mentioned previously, the UI only queries recent data, e.g., the past > hour, past two hours, past day, past week. The UI does not query for > anything older than the TTL which is 7 days. My understanding and > expectation was that Cassandra would only scan live cells. The UI is a > separate application that I do not maintain, so I am not 100% certain about > the queries. I have been told that it does not query for anything older > than 7 days. > > On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves > wrote: > > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > > > > > > -- > > - John > > > > > > > >
Re: Time series data model and tombstones
Did you get this Overwhelming tombstonne behavior with STCS or with TWCS ? If you're using DTCS, beware of its weird behavior and tricky configuration. On Sun, Jan 29, 2017 at 3:52 PM, John Sanda wrote: > Your partitioning key is text. If you have multiple entries per id you are >> likely hitting older cells that have expired. Descending only affects how >> the data is stored on disk, if you have to read the whole partition to find >> whichever time you are querying for you could potentially hit tombstones in >> other SSTables that contain the same "id". As mentioned previously, you >> need to add a time bucket to your partitioning key and definitely use >> DTCS/TWCS. > > > As I mentioned previously, the UI only queries recent data, e.g., the past > hour, past two hours, past day, past week. The UI does not query for > anything older than the TTL which is 7 days. My understanding and > expectation was that Cassandra would only scan live cells. The UI is a > separate application that I do not maintain, so I am not 100% certain about > the queries. I have been told that it does not query for anything older > than 7 days. > > On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves > wrote: > >> >> Your partitioning key is text. If you have multiple entries per id you >> are likely hitting older cells that have expired. Descending only affects >> how the data is stored on disk, if you have to read the whole partition to >> find whichever time you are querying for you could potentially hit >> tombstones in other SSTables that contain the same "id". As mentioned >> previously, you need to add a time bucket to your partitioning key and >> definitely use DTCS/TWCS. >> > > > > -- > > - John >
Re: Time series data model and tombstones
> > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. As I mentioned previously, the UI only queries recent data, e.g., the past hour, past two hours, past day, past week. The UI does not query for anything older than the TTL which is 7 days. My understanding and expectation was that Cassandra would only scan live cells. The UI is a separate application that I do not maintain, so I am not 100% certain about the queries. I have been told that it does not query for anything older than 7 days. On Sun, Jan 29, 2017 at 4:14 AM, kurt greaves wrote: > > Your partitioning key is text. If you have multiple entries per id you are > likely hitting older cells that have expired. Descending only affects how > the data is stored on disk, if you have to read the whole partition to find > whichever time you are querying for you could potentially hit tombstones in > other SSTables that contain the same "id". As mentioned previously, you > need to add a time bucket to your partitioning key and definitely use > DTCS/TWCS. > -- - John
Re: Time series data model and tombstones
Your partitioning key is text. If you have multiple entries per id you are likely hitting older cells that have expired. Descending only affects how the data is stored on disk, if you have to read the whole partition to find whichever time you are querying for you could potentially hit tombstones in other SSTables that contain the same "id". As mentioned previously, you need to add a time bucket to your partitioning key and definitely use DTCS/TWCS.
Re: Time series data model and tombstones
Maybe trace your queries to see what's happening in detail. Am 28.01.2017 21:32 schrieb "John Sanda" : Thanks for the response. This version of the code is using STCS. gc_grace_seconds was set to one day and then I changed it to zero since RF = 1. I understand that expired data will still generate tombstones and that STCS is not the best. More recent versions of the code use DTCS, and we'll be switching over to TWCS shortly. The suggestions raised are excellent ones, but I tend to think of them as optimizations that might not address my issue which I think may be 1) a problem with my data model, 2) problem with the queries used or 3) some misunderstanding of Cassandra performs range scans. I am doing append-only writes. There is no out of order data. There are no deletes, just TTLs. Data is stored on disk in descending order, and queries access recent data and never query past the TTL of seven days. Given this I would not except to be reading tombstones, certainly not the large numbers that I am seeing. On Sat, Jan 28, 2017 at 12:15 PM, Jonathan Haddad wrote: > Since you didn't specify a compaction strategy I'm guessing you're using > STCS. Your TTL'ed data is becoming a tombstone. TWCS is a better strategy > for this type of workload. > On Sat, Jan 28, 2017 at 8:30 AM John Sanda wrote: > >> I have a time series data model that is basically: >> >> CREATE TABLE metrics ( >> id text, >> time timeuuid, >> value double, >> PRIMARY KEY (id, time) >> ) WITH CLUSTERING ORDER BY (time DESC); >> >> I do append-only writes, no deletes, and use a TTL of seven days. Data >> points are written every seconds. The UI queries data for the past hour, >> two hours, day, or week. The UI refreshes and executes queries every 30 >> seconds. In one test environment I am seeing lots of tombstone threshold >> warnings and Cassandra has even OOME'd. Since I am storing data in >> descending order and always query for recent data, I do not understand why >> I am running into this problem. >> >> I know that it is recommended to do some date partitioning in part to >> ensure partitions do not grow too large. I already have some changes in >> place to partition by day.. Before I make those changes I want to >> understand why I am scanning so many tombstones so that I can be more >> confident that the date partitioning changes will help. >> >> Thanks >> >> - John >> > -- - John
Re: Time series data model and tombstones
Thanks for the response. This version of the code is using STCS. gc_grace_seconds was set to one day and then I changed it to zero since RF = 1. I understand that expired data will still generate tombstones and that STCS is not the best. More recent versions of the code use DTCS, and we'll be switching over to TWCS shortly. The suggestions raised are excellent ones, but I tend to think of them as optimizations that might not address my issue which I think may be 1) a problem with my data model, 2) problem with the queries used or 3) some misunderstanding of Cassandra performs range scans. I am doing append-only writes. There is no out of order data. There are no deletes, just TTLs. Data is stored on disk in descending order, and queries access recent data and never query past the TTL of seven days. Given this I would not except to be reading tombstones, certainly not the large numbers that I am seeing. On Sat, Jan 28, 2017 at 12:15 PM, Jonathan Haddad wrote: > Since you didn't specify a compaction strategy I'm guessing you're using > STCS. Your TTL'ed data is becoming a tombstone. TWCS is a better strategy > for this type of workload. > On Sat, Jan 28, 2017 at 8:30 AM John Sanda wrote: > >> I have a time series data model that is basically: >> >> CREATE TABLE metrics ( >> id text, >> time timeuuid, >> value double, >> PRIMARY KEY (id, time) >> ) WITH CLUSTERING ORDER BY (time DESC); >> >> I do append-only writes, no deletes, and use a TTL of seven days. Data >> points are written every seconds. The UI queries data for the past hour, >> two hours, day, or week. The UI refreshes and executes queries every 30 >> seconds. In one test environment I am seeing lots of tombstone threshold >> warnings and Cassandra has even OOME'd. Since I am storing data in >> descending order and always query for recent data, I do not understand why >> I am running into this problem. >> >> I know that it is recommended to do some date partitioning in part to >> ensure partitions do not grow too large. I already have some changes in >> place to partition by day.. Before I make those changes I want to >> understand why I am scanning so many tombstones so that I can be more >> confident that the date partitioning changes will help. >> >> Thanks >> >> - John >> > -- - John
Re: Time series data model and tombstones
Since you didn't specify a compaction strategy I'm guessing you're using STCS. Your TTL'ed data is becoming a tombstone. TWCS is a better strategy for this type of workload. On Sat, Jan 28, 2017 at 8:30 AM John Sanda wrote: > I have a time series data model that is basically: > > CREATE TABLE metrics ( > id text, > time timeuuid, > value double, > PRIMARY KEY (id, time) > ) WITH CLUSTERING ORDER BY (time DESC); > > I do append-only writes, no deletes, and use a TTL of seven days. Data > points are written every seconds. The UI queries data for the past hour, > two hours, day, or week. The UI refreshes and executes queries every 30 > seconds. In one test environment I am seeing lots of tombstone threshold > warnings and Cassandra has even OOME'd. Since I am storing data in > descending order and always query for recent data, I do not understand why > I am running into this problem. > > I know that it is recommended to do some date partitioning in part to > ensure partitions do not grow too large. I already have some changes in > place to partition by day.. Before I make those changes I want to > understand why I am scanning so many tombstones so that I can be more > confident that the date partitioning changes will help. > > Thanks > > - John >
Re: Time series data model and tombstones
When the data expired (after TTL of 7 days), at the next compaction they are transformed into tombstonnes and will still stay there during gc_grace_seconds. After that, they (the tombstonnes) will be completely removed at the next compaction, if there is any ... So doing some maths, supposing that you have let gc_grace_seconds to its default value of 10 days then you'll have tombstonnes for 10 days worth of data before they got eventually removed... What is your compaction strategy ? I strongly suggest 1) Setting TTL directly as the table property (ALTER TABLE) instead of setting it at query level (INSERT INTO ... USING TTL). When setting TTL at table level, Cassandra can perform some optimization and drop entirely some SSTable and don't even bother compact them 2) Use TimeWindowCompactionStrategy and tune it properly to accomodate your workload On Sat, Jan 28, 2017 at 5:30 PM, John Sanda wrote: > I have a time series data model that is basically: > > CREATE TABLE metrics ( > id text, > time timeuuid, > value double, > PRIMARY KEY (id, time) > ) WITH CLUSTERING ORDER BY (time DESC); > > I do append-only writes, no deletes, and use a TTL of seven days. Data > points are written every seconds. The UI queries data for the past hour, > two hours, day, or week. The UI refreshes and executes queries every 30 > seconds. In one test environment I am seeing lots of tombstone threshold > warnings and Cassandra has even OOME'd. Since I am storing data in > descending order and always query for recent data, I do not understand why > I am running into this problem. > > I know that it is recommended to do some date partitioning in part to > ensure partitions do not grow too large. I already have some changes in > place to partition by day.. Before I make those changes I want to > understand why I am scanning so many tombstones so that I can be more > confident that the date partitioning changes will help. > > Thanks > > - John >