Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rate Limiting AWS Elastic Beanstalk workers with SQS

Given an application that receives requests and uses an external messaging service to message users. The number of requests are usually non-linear and at times huge bulk requests come in to message users of the service. The external messaging service allows a throughput of say x/sec.

Using Elastic Beanstalk workers and SQS, is it possible to apply some rate limiting to how these messages are being processed?

like image 981
user1048839 Avatar asked Apr 21 '16 13:04

user1048839


People also ask

When should you not use Elastic Beanstalk?

Elastic Beanstalk isn't great if you need a lot of environment variables. The simple reason is that Elastic Beanstalk has a hard limit of 4KB to store all key-value pairs. The environment had accumulated 74 environment variables — a few of them had exceedingly verbose names.

Does Elastic Beanstalk automatically scale?

Your AWS Elastic Beanstalk environment includes an Auto Scaling group that manages the Amazon EC2 instances in your environment. In a single-instance environment, the Auto Scaling group ensures that there is always one instance running.

What is the worker environment used for in Elastic Beanstalk?

Worker environments run a daemon process provided by Elastic Beanstalk. This daemon is updated regularly to add features and fix bugs. To get the latest version of the daemon, update to the latest platform version.

Which is better Elastic Beanstalk or EC2?

Elastic Beanstalk is one layer of abstraction away from the EC2 layer. Elastic Beanstalk will setup an "environment" for you that can contain a number of EC2 instances, an optional database, as well as a few other AWS components such as a Elastic Load Balancer, Auto-Scaling Group, Security Group.


1 Answers

You can rate limit the number of messages pulled by the using the HTTP connections option setting in the aws:elasticbeanstalk:sqsd namespace.

HTTP connections – Specify the maximum number of concurrent connections that the daemon can make to any application(s) within an Amazon EC2 instance. The default is 50. You can specify a value between 1 and 100.

Read more about it here.

Remember to tweak the other parameters like Visibility Timeout, Max Retries, Retention Period accordingly. Also if you are tweaking Inactivity Timeout, remember to modify the nginx proxy timeout as well as shown here.

like image 171
Rohit Banga Avatar answered Oct 02 '22 17:10

Rohit Banga