0

So I have a Neptune (db.r5.large) on AWS, If I make more than 250 requests/second. I will get the error HTTP 429: Too Many Requests.

What should I do here? I was expecting db.r5.large instance type should able handle this kind of work load, and I don't have budget to move up another instance type.

enter image description here

user1187968
  • 7,154
  • 16
  • 81
  • 152
  • How are you sending the queries to Neptune? – Kelvin Lawrence Jan 20 '22 at 21:15
  • A couple of additional questions. What does the `MainRequestQueuePendingRequests` Cloud Watch Metric show? The maximum number of queries that can be queued is 8192 so it is possible to be filling the queue. Also, what is your Neptune engine version. The instance type you are using has 2 vCPU, which means there are 4 worker threads handling queries. It's quite possible that those workers cannot keep up depending on the complexity of the queries. – Kelvin Lawrence Jan 20 '22 at 21:40

1 Answers1

1

I'm adding an answer based on the comments above and some additional points.

  1. The instance type in use is one of the smaller ones and has four worker threads. That means, at most, four queries can be running at one time.
  2. If IAM authentication is enabled, each query has to be verified before being executed. The Too many requests exception is likely being thrown because IAM is enabled. You can test this by temporarily turning IAM authentication off and re-running your tests.
  3. In general, if there are more queries inbound than can be allocated to an available worker thread, they will be queued up, to a maximum of 8192.
  4. If the query queue fills up you will see a Throttling exception.

The likely reason for the Too many requests exception in your case is that you are using one of the smallest instance types and sending more work than can be handled by that instance type with IAM authentication enabled,

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38