AWS Lambda - Dealing with very high concurrent requests

Viewed 660

This is a two part question.

We are migrating a on-premises structure to AWS cloud. The platform connects Instagram influencers with brands interested in marketing their products.
Influencers receive trademark links to display on their Instagram accounts.

There is one functionality, where we need to count how many followers swipe up a particular link for an influencer. Our first implementation was to create a lambda that receives the request through an API gateway, containing the data identifying the influencer and brand, send to SQS the relevant data and send a redirect to the brand URL.

The problem though, is that the customer has asked that our solution should be able to deal with at least 20 thousand simultaneous requests, since in the past, a few of their influencers who had millions of followers, were able to generate that kind of instantaneous "swipe ups" when they posted something. The lambda limits to our region was 1000 concurrent executions per second. We asked AWS to raise it, and they raised it to 2500 requests per second.

Still way below what the customer is asking. There are also the limits of API gateway concurrent requests to consider. It seems that the API gateway also starts throttling too many requests.

Is there any better way to deal with that kind of requirements? What would be the best practice? We just need to count that some influencer received a swipe up, and redirect. Today we just create a link with the influencer id, the brand id and the URL to redirect. Is there a better alternative to deal with this then using lambdas? Is it possible to deal with it with a serverless approach? Would it be better to use multiple EC2 servers or to use beanstalk with apache or nginx?

And now the second question. How do we even test that kind of concurrent requests with AWS? Simply using Jmeter, when we increase the number of simultaneous requests, our lambda function doesn't even receive them. I imagine that making too many requests to AWS could be mistakenly considered a DDOS attack. How to test any AWS solutions that need to be able to accept very high simultaneous requests?

Thanks.

Edit:
To make it clear, we don't serve any content to the user. We just need to count that somebody did the request, and do a redirect. The information about who did the request and the URL to be redirected, will be on parameters on the requested link. We just need to capture that information, which is easily done in lambda, and do a 301 redirect.

1 Answers

Your use case looks like a good fit for Lambda@Edge, which utilizes CloudFront endpoints for lambda execution. This is a perfect combination of computing and cache at the edge location for use cases like yours.

By combining Lambda@Edge with other AWS services, developers can build powerful web applications at the edge that automatically scale up and down—with zero origin infrastructure and administrative effort required for automatic scaling, backups, or data center redundancy.

The limits are not exactly what you are looking for but I would imagine lot of requests will be served the response from the Cache instead of requiring lambda execution. Here is the table of limits for Lambda@Edge

enter image description here

Note: If due to any reason, you still need a higher limit, then you can always contact AWS Support, which I believe loves such challenges and will surely help you

Related