osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does cassandra achieve Linearizability?


I think the answer to that question will depend on your specific use case and requirements.

If you're only doing a small number of updates but need to be sure they are applied in order you may be able to use lightweight transactions (keep in mind there's a performance hit here, so it's not an answer for high-volume mutations).

For high-volume updates you could look at using an append-only time-series style data model, using a default TTL to drop old data. 

If your data isn't time-series in nature and has a high-volume of updates then you really just need to make sure either your clients or Cassandra nodes (preferably both) are in sync.

Justin

On Thu, 9 Feb 2017 at 16:47 Kant Kodali <kant@xxxxxxxxxxxx> wrote:
Hi Justin,

There are bunch of issues w.r.t to synchronization of clocks when we used ntpd. Also the time it took to sync the clocks was approx 140ms (don't quote me on it though because it is reported by our devops :) 

we have multiple clients (for example bunch of micro services are reading from Cassandra) I am not sure how one can achieve Linearizability by setting timestamps on the clients ? since there is no total ordering across multiple clients.

Thanks!


On Thu, Feb 9, 2017 at 4:16 PM, Justin Cameron <justin@xxxxxxxxxxxxxxx> wrote:
Hi Kant,

Clock synchronization is important - you should ensure that ntpd is properly configured on all nodes. If your particular use case is especially sensitive to out-of-order mutations it is possible to set timestamps on the client side using the drivers. https://docs.datastax.com/en/developer/java-driver/3.1/manual/query_timestamps/

We use our own NTP cluster to reduce clock drift as much as possible, but public NTP servers are good enough for most uses. https://www.instaclustr.com/blog/2015/11/05/apache-cassandra-synchronization/

Cheers,
Justin

On Thu, 9 Feb 2017 at 16:09 Kant Kodali <kant@xxxxxxxxxxxx> wrote:
How does Cassandra achieve Linearizability with “Last write wins” (conflict resolution methods based on time-of-day clocks) ?

Relying on synchronized clocks are almost certainly non-linearizable, because clock timestamps cannot be guaranteed to be consistent with actual event ordering due to clock skew. isn't it?

Thanks!
--

Justin Cameron

Senior Software Engineer | Instaclustr




This email has been sent on behalf of Instaclustr Pty Ltd (Australia) and Instaclustr Inc (USA).

This email and any attachments may contain confidential and legally privileged information.  If you are not the intended recipient, do not copy or disclose its content, but please reply to this email immediately and highlight the error to the sender and then immediately delete the message.


--

Justin Cameron

Senior Software Engineer | Instaclustr




This email has been sent on behalf of Instaclustr Pty Ltd (Australia) and Instaclustr Inc (USA).

This email and any attachments may contain confidential and legally privileged information.  If you are not the intended recipient, do not copy or disclose its content, but please reply to this email immediately and highlight the error to the sender and then immediately delete the message.