Can you tolerate the value being “close, but not perfectly accurate”? If not, 
don’t use a counter.

 

 

From: <burtonator2...@gmail.com> on behalf of Kevin Burton <bur...@spinn3r.com>
Reply-To: "user@cassandra.apache.org" <user@cassandra.apache.org>
Date: Wednesday, July 20, 2016 at 11:48 AM
To: "user@cassandra.apache.org" <user@cassandra.apache.org>
Subject: Are counters faster than CAS or vice versa?

 

We ended up implementing a task/queue system which uses a global pointer. 

 

Basically the pointer just increments ... so we have thousands of tasks that 
just increment this one pointer.

 

The problem is that we're seeing contention on it and not being able to write 
this record properly.

 

We're just doing a CAS operation now to read the existing value, then increment 
it.

 

I think it might have been better to implement this as a counter.  Would that 
be inherently faster or would a CAS be about the same?

 

I can't really test it without deploying it so I figured I would just ask here 
first.

 

Kevin

 

-- 

We’re hiring if you know of any awesome Java Devops or Linux Operations 
Engineers!

 

Founder/CEO Spinn3r.com

Location: San Francisco, CA

blog: http://burtonator.wordpress.com

… or check out my Google+ profile

Error! Filename not specified.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to