0

I'm trying to implement some limits on the database requests made to the Neptune Server. The problem is:

  • Multiple scheduled jobs that do analytics, logs, updates, deletions
  • User activity, anything related to users: read, write, update, delete

All of these request depending on when they occur can impact the performance of the database and the availability, so we get sudden spikes in traffic which can happen at any given time. Scaling is not an option here, so i want to limit the request/jobs made to the database server. So my question is what would be the preferred way to implement this in Spring Boot and Java, since i have not found a suitable solution so far?

rollercoaster
  • 15
  • 1
  • 2

1 Answers1

0

Amazon Neptune gives you some help here. Queries are handled by worker threads. The number of worker threads on an instance is typically twice the number of vCPU on that instance. If all the workers are busy, requests will get placed in a queue. The queue can hold up to 8K requests. If the queue fills up, Neptune will send a throttling exception back to the caller. There are several CloudWatch metrics you can monitor including how backed up the queue is and how busy the CPUs are. This may help in monitoring load on the instance.

As to client side throttling it sounds like you may want to put a queue or stream in front of Neptune that all requests go via. You could have multiple queues if you want to separate requests from different classes of users and decide which to prioritize. Your app can then pull from the queues and throttle as deemed appropriate.

Without knowing more about your precise use case it's hard to give better guidance.

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • sorry i did not specify it precisely. What we basically want is to throttle the scheduled jobs, meaning that whenever we get more user activity ( so client based requests) we cant to prioritize them. So if any scheduled job is started or is preparing to start we want it to stop or at least do the work slower so it does not interfere with the client/user requests/operations. I can elaborate more if needed. – rollercoaster Oct 21 '21 at 14:48
  • Perhaps this thread is helpful? https://stackoverflow.com/questions/19819837/java-executor-with-throttling-throughput-control – Kelvin Lawrence Oct 21 '21 at 14:59
  • it partially does, so i'll guess this answers my question. Thank you! – rollercoaster Oct 25 '21 at 19:11