Testing performance impact using tracing

Tracing records all activity related to a request. These steps use tracing to show queries on a keyspace with a replication factor of 3 using different consistency levels (CL):

  • ONE processes responses from one of three replicas

  • QUORUM from two of three replicas

  • ALL from three of three replicas

    1. On the cqlsh command line, create a keyspace that specifies using three replicas for data distribution in the cluster.

      CREATE KEYSPACE IF NOT EXISTS cycling_alt 
      WITH REPLICATION = {
        'class': 'SimpleStrategy', 
        'replication_factor': 3
      };
    2. Create a table and insert a row.

      USE cycling_alt;
      CREATE TABLE IF NOT EXISTS cycling_alt.cyclist_name (
        id int PRIMARY KEY,
        lastname text,
        firstname text
      );
    3. Turn on tracing and use the CONSISTENCY command to ensure the consistency level is ONE, the default.

      TRACING ON;
      CONSISTENCY;

      The output is:

      Current consistency level is ONE.
    4. Query the table to read the row.

      SELECT * FROM cycling_alt.cyclist_name WHERE id = 1;
WARNING: cqlsh was built against 5.0-beta1, but this server is 5.0.  All features may not work!

 id | firstname | lastname
----+-----------+----------
  1 |   Melissa |  HOSKINS

(1 rows)

+ The tracing results list all the actions taken to complete the SELECT statement.

  1. Change the consistency level to QUORUM to trace what happens during a read with a QUORUM consistency level.

    CONSISTENCY QUORUM;
    SELECT * FROM cycling_alt.cyclist_name WHERE id = 1;
WARNING: cqlsh was built against 5.0-beta1, but this server is 5.0.  All features may not work!
Consistency level set to QUORUM.
  1. Change the consistency level to ALL and run the SELECT statement again.

    CONSISTENCY ALL;
    SELECT * FROM cycling_alt.cyclist_name WHERE id = 1;
WARNING: cqlsh was built against 5.0-beta1, but this server is 5.0.  All features may not work!
Consistency level set to ALL.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com