By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Amazon DynamoDB Accelerator (DAX)

Sort by most recent
  • 1
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

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

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? ```tsx // 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, }); ```
1
answers
0
votes
86
views
asked 3 months ago

NodeJS DAX client doesn't support Update item having same field name with the condition expression.

Hello team, So recently, I was trying to enable DAX instead of using the normal DynamoDB client. And I found this issue. When I'm issuing a Update with this: ``` "Update": { "Key": { "id": { "S": "de26b619-d3e1-4de9-a338-12f95780538f" } }, "ConditionExpression": "#a0 = :v0 AND #a1 = :v1", "ExpressionAttributeNames": { "#a0": "tenantId", "#a1": "_version", "#a2": "updatedAt", "#a3": "_version", "#a4": "totalAmountOutstanding", "#a5": "items" }, "ExpressionAttributeValues": { ":v0": { "S": "HelmTest" }, ":v1": { "N": "1" }, ":v2": { "N": "1650900411690" }, ":v3": { "N": "2" }, ... ``` So basically, I'm using the field `_version` to implement optimistic locking. When using DAX to run this update, I got the error: ``` { "errorType": "Error", "errorMessage": "ValidationException: Two document paths overlap with each other; must remove or rewrite one of these paths _version", "code": "ValidationException", "time": 1650900411978, "retryable": false, "requestId": null, "statusCode": -1, "_tubeInvalid": false, "waitForRecoveryBeforeRetrying": false, "stack": [ "Error: ValidationException: Two document paths overlap with each other; must remove or rewrite one of these paths _version", " at Function.newValidationException (/node_modules/amazon-dax-client/src/RequestValidator.js:383:12)", " at /node_modules/amazon-dax-client/src/RequestValidator.js:84:34", " at Array.forEach (<anonymous>)", " at Function.validateExprAttrNames (/node_modules/amazon-dax-client/src/RequestValidator.js:78:30)", " at Function.validateExpression (/node_modules/amazon-dax-client/src/RequestValidator.js:217:42)", " at /node_modules/amazon-dax-client/src/BaseOperations.js:603:26", " at processTicksAndRejections (internal/process/task_queues.js:95:5)", " at p2 (/node_modules/dynamoose/lib/aws/ddb/internal.ts:30:17)", " at /node_modules/dynamoose/lib/Transaction.ts:99:23", ``` The library complains that it won't allow me to use `_version` many times. I looked into the source code, and this is confirmed: ``` let attrs = new Set(); Object.keys(attrNames).forEach((k) => { let v = attrNames[k]; if(k == null) { throw new AmazonClientException('ExpressionAttributeNames contains invalid key: null'); } if(attrs.has(v)) { throw RequestValidator.newValidationException('Two document paths overlap with each other; must remove or rewrite one of these paths ' + v); } attrs.add(v); ``` I believe this is a bug in the library, as this is a normal use case and it should be allowed. For now, I've turned off the DAX and gone back to the normal DynamoDB client, where things are working.
2
answers
0
votes
55
views
asked 5 months ago
1
answers
0
votes
27
views
asked 8 months ago
  • 1
  • 12 / page