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,
});
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)?