Counters are good for things like page views, bad for money.  Yes they can
under or overcount in certain situations.  If your cluster is stable,
you'll see very little of it in practice.

I've done quite a bit of tuning of counters.  Here's the main takeaways:

* They do a read before a write, so use low latency disks (SSD)
* Dial back read ahead to 4KB, this is a big deal (in fact, always do this
even if you're not using counters and you are using SSDs)
* Use 4KB compression chunk length
* Bump up you counter cache
* Some basic JVM tuning (ParNew + CMS, 16GB heap 10GB new, max tenuring
threshold 4, survivor ratio 6)

The last 3 will give you a 10-20x perf improvement over stock Cassandra if
you've got a lot of counters.

Jon



On Wed, Oct 30, 2019 at 7:01 AM <advicerywo...@pm.me.invalid> wrote:

> Hi,
>
> I would like to use counters but I am not sure I should.
>
> I read a lot of articles on the Internet how counters are bad / wrong /
> inaccurate etc etc ...
>
> Let's be honest, counters in Cassandra have quite a bad reputation.
>
> But all stuff I read about that was quite old, I know there was
> significant improvements in that area especially around 2.1 / 2.2 releases
> but I can not make my head around so I can definitely be sure if I should
> use them or not.
>
> The literature I read were:
>
> 1) That one elaborates about counters from node-lifecycle perspective and
> there are still some problems of over / undercounting.
>
> 2) This one explains the differences between pre and post 2.1
> implementations and suggests that once counter caches are removed, the
> implementation will be even better and simplified - but I am not sure what
> is the outcome of this article? It says that all "wrong" implementation of
> counters (as we knew them in pre 2.x era) was corrected and we should be
> all good to use it?
>
> 3) These guys said that they have not found any bugs ... huh.
>
> So, what is the overall state of counters in 3.11.4 ? (hence 3.11.5)?
> Would you recommend to use them in production?
>
> My usecase is that I have 2 DCs with 3 nodes each and I have a table where
> I want to track number number of page visits.
>
> My perception is that "they will be inconsistent and you can not repair it
> and it is idempotent" but from what I have tested, when I put 1 node down
> and I brought it back and read it, it was just fine and numbers were good.
>
> So I am not sure if my testing is very naive but the whole mystery about
> counters and the lack of the authoritative advice what the general status
> is and where it can go wrong is imho lacking.
>
> Are the links below obsolete? Do I have strong guarantee that counters
> will "just work"? What are the downsides and why would not you use them?
> Honestly, after reading a lot about that, I am not trusting counters too
> much but I am not sure if my opinion is biased based on what I read so far.
>
> Thanks
>
> Links
>
> 1) http://datastrophic.io/evaluating-cassandra-2-1-counters-consistency/
>
> 2)
> https://www.datastax.com/blog/2014/05/whats-new-cassandra-21-better-implementation-counters
>
> 3) https://www.datastax.com/blog/2016/01/testing-apache-cassandra-jepsen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org
> For additional commands, e-mail: user-h...@cassandra.apache.org
>
>

Reply via email to