-
Notifications
You must be signed in to change notification settings - Fork 6k
Slow AWS SDK requests in Deno compared to Node.js/Bun #29676
Copy link
Copy link
Closed
Labels
bugSomething isn't working correctlySomething isn't working correctlyneeds investigationrequires further investigation before determining if it is an issue or notrequires further investigation before determining if it is an issue or notperfperformance relatedperformance related
Description
Version:
deno 2.3.5 (stable, release, x86_64-unknown-linux-gnu)
v8 13.7.152.6-rusty
typescript 5.8.3
We’re experiencing performance issues when using the AWS SDK in Deno, specifically with DynamoDB operations. We noticed that:
- Initial connections to AWS can take up to 1.5 seconds
- A basic operation like
ListTablesCommandtakes around 130 ms
While these numbers may seem reasonable, they are approximately 3× slower than the same operations in Node.js or Bun. This has a measurable impact on infrastructure costs, as we need to scale more aggressively when under load.
We used Vegeta to benchmark this setup with the following command:
echo 'GET http://localhost:8080' | ./vegeta attack -rate=50/1s -duration=5s -timeout=5s | tee results.bin | ./vegeta reportMinimal reproduction code:
import { DynamoDBClient, ListTablesCommand } from "@aws-sdk/client-dynamodb";
const client = new DynamoDBClient({
region: "us-east-1", // Adjust this to your AWS region
// requestHandler: new NodeHttpHandler({
// httpsAgent: new Agent({
// keepAlive: true,
// maxSockets: 100,
// }),
// }),
});
Deno.serve({
port: 8080,
}, async (req) => {
try {
await client.send(new ListTablesCommand({}));
return new Response("ok");
} catch (error) {
console.error("Failed to query:", error);
return new Response("Error querying DynamoDB", { status: 500 });
}
});
- Tried using a custom requestHandler with keepAlive settings with no noticeable improvement.
- Similar latency was observed when using the EC2 SDK to list available regions.
- The issue seems related to the networking stack or HTTP client layer used by Deno.
Question
Is this expected behaviour, or is there something we could do to improve performance when using the AWS SDK in Deno? Happy to provide more details or run additional diagnostics if helpful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't working correctlySomething isn't working correctlyneeds investigationrequires further investigation before determining if it is an issue or notrequires further investigation before determining if it is an issue or notperfperformance relatedperformance related
