3

We have partially moved some of our tables from AWS RDS to AWS Keyspaces to see if we could get better performance on KeySpaces. We have put a lot of work to migrate from MySQL to Keyspaces and also we have been monitoring the system to avoid exploding inconsistency. Through our monitoring period, we have observed the following warnings that result in High CPU and memory usage.

- DefaultTokenFactoryRegistry - [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner, token map will be empty.

-DefaultTopologyMonitor - [s0] Control node IPx/IPy:9142 has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster(IPx and IPy are cassandra node IPs) - Control node cassandra.{REGION}.amazonaws.com/{IP_1}:9142 has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster.

Even though these warnings does not appear immediately after we deployed our code and the following hours, it somehow appears after 24-72 hours after the deployment.

What we have done so far?

Even though it's possible to suppress warnings by setting the log level to error, The Driver says there's a misconfiguration in cassandra.yml which we do not have permission to edit or view. Is there a way to avoid this warning or any solution suggested to solve this issue?

datastax-java-driver {
        basic {
            contact-points = ["cassandra.eu-west-1.amazonaws.com:9142"]
            load-balancing-policy {
                class = DefaultLoadBalancingPolicy
                local-datacenter = eu-west-1
            }
            request {
                timeout = 10 seconds
                default-idempotence = true
            }
        }

        advanced {
            auth-provider = {
                class = software.aws.mcs.auth.SigV4AuthProvider
                aws-region = eu-west-1
            }

            ssl-engine-factory {
                class = DefaultSslEngineFactory
                truststore-path = "./cassandra_truststore.jks"
                truststore-password = "XXX"
                keystore-path = "./cassandra_truststore.jks"
                keystore-password = "XXX"
            }

            retry-policy {
                class =  com.ABC.DEF.config.cassandra.AmazonKeyspacesRetryPolicy
                max-attempts = 5
            }

            connection {
                pool {
                    local {
                        size = 9
                    }
                    remote {
                        size = 1
                    }
                }

                init-query-timeout = 5 seconds

                max-requests-per-connection = 1024
            }

            reconnect-on-init = true

            heartbeat {
                timeout = 1 seconds
            }

            metadata {
                schema {
                    enabled = false
                }
                token-map {
                    enabled = false
                }
            }

            control-connection {
                timeout = 1 seconds
            }

        }
    }


----------


xywz
  • 45
  • 1
  • 5

2 Answers2

7

This is indeed a non-standard, unsupported partitioner: com.amazonaws.cassandra.DefaultPartitioner. Token-aware routing won't work with AWS Keyspaces unless you write your own TopologyMonitor and TokenFactory.

I suggest that you disable token-aware routing completely, see here for instructions.

adutra
  • 4,231
  • 1
  • 20
  • 18
  • 2
    I have disabled token-aware routing completely as you suggested, however it did not solve my issue. I have updated my question to add my cassandra driver config file. And then I enabled token-aware routing, implemented custom TopologyMonitor and TokenFactory using the datastax guide below. https://docs.datastax.com/en/developer/java-driver/4.4/manual/developer/common/context/#overriding-a-context-component However I could not make any progress, is there any java implementation you can share? – xywz Jan 27 '22 at 16:47
  • Sorry, I know nothing about AWS keyspaces, I don't think I can help you any further. You should ask AWS support team for help. – adutra Feb 08 '22 at 18:59
  • https://docs.aws.amazon.com/keyspaces/latest/devguide/working-with-partitioners.html – MikeJPR May 11 '22 at 22:07
3

The warning is just letting you know that the ip will be filtered out. See the line of code here on github. In cassandra the system.peers table contains a list of nodes minus the ip of the control node. In Amazon Keyspaces, the system.peers table also contains the control node ip. You will see this warning when driver initiates a connection or when the driver metadata is updated. When using keyspaces this warning is expected and will not impact performance. There is a patch that will resolve the warning, but I do not have an ETA to share.

I suggest upgrading the java driver to see if your issue is resolved. You can also download the lastest sigv4 plugin which brings in java driver 4.13 as a dependency.

<dependency>
    <groupId>software.aws.mcs</groupId>
    <artifactId>aws-sigv4-auth-cassandra-java-driver-plugin</artifactId>
    <version>4.0.5</version>
</dependency>

Here is a sample driver config for reference.

datastax-java-driver {
        basic.contact-points = ["cassandra.us-east-2.amazonaws.com:9142"]
        basic.load-balancing-policy {
            class = DefaultLoadBalancingPolicy
            local-datacenter = us-east-2
        }
        advanced {
            auth-provider = {
                class = software.aws.mcs.auth.SigV4AuthProvider
                aws-region = us-east-2
            }
            ssl-engine-factory {
                class = DefaultSslEngineFactory
                truststore-path = "./src/main/resources/cassandra_truststore.jks"
                truststore-password = "my_password"
                hostname-validation = false
            }
        }
        advanced.metadata.token-map.enabled = false
        advanced.metadata.schema.enabled = false
        advanced.reconnect-on-init = true
        
        advanced.connection {
           pool {
              local.size = 3
              remote.size = 1
           }
         }
    }

MikeJPR
  • 764
  • 3
  • 14
  • Support for partitioners https://docs.aws.amazon.com/keyspaces/latest/devguide/working-with-partitioners.html – MikeJPR May 11 '22 at 22:07
  • Support for Murmur3 https://aws.amazon.com/about-aws/whats-new/2022/11/amazon-keyspaces-supports-murmur3partioner/ – MikeJPR Nov 17 '22 at 19:31