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?
Advertisement
Answer
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.