title: AWS API request rate limits
body: <p><em>Update</em>: Keep-alive wasn't set on the AWS client. My fix was</p>
  
  <pre><code>var aws = require('aws-sdk');
  aws.config.httpOptions.agent = new https.Agent({
    keepAlive: true
  });
  </code></pre>
  
  <p>I finally managed to debug it by using the Node <code>--prof</code> flag. Then using the <a href="https://www.npmjs.com/package/node-tick-processor" rel="nofollow">node-tick-processor</a> to analyze the output (it's a packaged version of a tool distributed in the Node/V8 source code). Most of the processing time was spent in SSL processing and that's when I thought to check whether or not is used keep-alive.</p>
  
  <hr>
  
  <p>TL;DR Getting throttled by AWS when the number of requests is less than the configured DynamoDB throughput. Is there a request rate limit for all APIs?</p>
  
  <hr>
  
  <p>I'm having a hard time finding documentation about the rate limiting of AWS APIs.</p>
  
  <p>An application that I'm testing now is making about 80 requests per second to DynamoDB. This is a mix of PUTs and GETs. My DynamoDB table is configured with a throughput of: 250 reads / 250 writes. In the table CloudWatch metrics, the reads peak at 24 and the writes at 59 during the test period.</p>
  
  <p>This is a sample of my response times. First, subsecond response times.</p>
  
  <pre><code>2015-10-07T15:28:55.422Z 200 in 20 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  2015-10-07T15:28:55.423Z 200 in 22 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  </code></pre>
  
  <p>A lot longer, but fine...</p>
  
  <pre><code>2015-10-07T15:29:33.907Z 200 in 244 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  2015-10-07T15:29:33.910Z 200 in 186 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  </code></pre>
  
  <p>The requests are piling up...</p>
  
  <pre><code>2015-10-07T15:32:41.103Z 200 in 1349 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  2015-10-07T15:32:41.104Z 200 in 1181 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  </code></pre>
  
  <p>...no...</p>
  
  <pre><code>2015-10-07T15:41:09.425Z 200 in 6596 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  2015-10-07T15:41:09.428Z 200 in 5902 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  </code></pre>
  
  <p>I went and got some tea...</p>
  
  <pre><code>2015-10-07T15:44:26.463Z 200 in 13900 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  2015-10-07T15:44:26.464Z 200 in 12912 milliseconds in request to dynamodb.us-east-1.amazonaws.com
  </code></pre>
  
  <p>Anyway, I stopped the test, but this is a Node.js application so a bunch of sockets were left open waiting for my requests to AWS to complete. I got response times > 60 seconds.</p>
  
  <p>My DynamoDB throughput wasn't used much, so I assume that the limit is in API requests but I can't find any information on it. What's interesting is that the <code>200</code> part of the log entries is the response code from AWS which I got by <a href="https://github.com/mqsoh/aws-sdk-js/commit/9887e69a213ded4dd50c6e3bd62c76b7d84d90df" rel="nofollow">hacking a bit of the SDK</a>. I think AWS is supposed to return 429s -- all their SDKs implement exponential backoff.</p>
  
  <p>Anyway -- I assumed that I could make as many requests to DynamoDB as configured throughput. Is that right? ...or what?</p>