How to get micro-second latency with DAX for DynamoDB?

0

I am adding DAX for DynamoDB with a simple CDK stack as below, but not able to get micro-second latency, it is still around 2 millisecond. Without DAX, the latency is around 8 millisecond. Any suggestion?

// parameter group
    const parameterGroup = new aws_dax.CfnParameterGroup(
      this,
      "ParameterGroupDaxDemo",
      {
        parameterGroupName: "ParameterGroupDaxDemo",
        description: "parameter gropu for dax cluster demo",
        // default 5 minutes 300000 milisesconds
        parameterNameValues: {
          "query-ttl-millis": "300000",
          "record-ttl-millis": "180000",
        },
      }
    );

    // role for dax cluster
    const role = new aws_iam.Role(
      this,
      "RoleForDaxClusterDmoe",
      {
        roleName: "RoleForDaxClusterDemo",
        assumedBy: new aws_iam.ServicePrincipal(
          "dax.amazonaws.com"
        ),
      }
    );

    role.attachInlinePolicy(
      new aws_iam.Policy(this, "PolicyForDaxClusterDmoe", {
        policyName: "PolicyForDaxClusterDmoe",
        statements: [
          new aws_iam.PolicyStatement({
            effect: aws_iam.Effect.ALLOW,
            actions: ["dynamodb:*"],
            resources: ["*"],
          }),
        ],
      })
    );

    // security group 
    const securityGroup = new aws_ec2.SecurityGroup(
      this,
      "SecurityGroupForDaxCluster",
      {
        securityGroupName: "SecurityGroupForDaxCluster",
        vpc: vpc
      }
    )

    securityGroup.addIngressRule(
      // production SG peer 
      aws_ec2.Peer.anyIpv4(),
      // unencrypted 8111
      aws_ec2.Port.tcp(8111),
    )

    // create a dax cluster
    new aws_dax.CfnCluster(this, "DaxClusterDemo", {
      clusterName: "DaxClusterDemo",
      // role to access ddb
      iamRoleArn: role.roleArn,
      // mem optimized node type
      nodeType: "dax.r4.large",
      // 3: 1 primary and 2 read replics
      replicationFactor: 3,
      // automatically into az
      // availabilityZones: [''],
      // encryption TSL or NONE as default
      clusterEndpointEncryptionType: "NONE",
      // notificationTopicArn: "",
      parameterGroupName: parameterGroup.parameterGroupName,
      // range of time maintenance of DAX software performed
      // preferredMaintenanceWindow: "",
      securityGroupIds: [
        securityGroup.securityGroupId
      ],
      subnetGroupName: subnetGroup.subnetGroupName,
    });
hai
asked 2 years ago337 views
1 Answer
1

You will always be accessing a separate service with DynamoDB, even with DynamoDB Accelerator (DAX) enabled. The accelerator removes the need to compute the results of the query, which is where the 75% faster response time is realized. Microsecond response time is highly unlikely to be achievable, with the possible exception of small data responses and persistent connections to DAX.

If you need microsecond access to the data, then the only architecture option I can think of is to cache it locally on the host, so you would have to implement that yourself and use correspondingly large memory instances.

profile pictureAWS
answered 2 years ago
  • But the aws document mentions that "Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for Amazon DynamoDB that delivers up to a 10 times performance improvement—from milliseconds to microseconds—even at millions of requests per second." https://aws.amazon.com/dynamodb/dax/

    I watched a re-invent 2017 video "AWS re:Invent 2017: Cache Me If You Can: Minimizing Latency While Optimizing Cost" at the 41:05 th minute, there is a chart/graph shows that average latency 400-500 micro-second with DAX

    So far, I can't re-produce the performance. It is around 1 - 2 millisecond, sometimes 0.7 millisecond

  • How are you measuring it? Time to first byte? Or complete response (which is how I was interpreting this)?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions