CodedGames
CodedGames

Reputation: 11

Cannot achieve 1000 concurrent function requests with Google Cloud Functions

I am trying to run an RNA-Seq application with Google Cloud Functions. To run this application I need to be able to have over 800 functions running concurrently. This has been achieved using AWS Lambda, but I have not been able to do this on Google Cloud Functions.

When I attempt to run hundreds of basic HTTP requests with the default HTTP trigger, I start getting tons of 500 errors:

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>500 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered an error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

If I check the logs for my function, I see no error messages! The cloud console makes it seem like everything is perfect even though my requests are failing.

How should I got about diagnosing this problem? It looks like it's something wrong on Google's end, as my code works fine when requests do go through. Does Google limit the amount of HTTP requests you can make?

Any help would be really appreciated.

Upvotes: 1

Views: 1065

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317948

The scaling limit for HTTP type functions is different than background functions. Please read the documentation about scalability to be clear on the limits.

For background functions, it will scale gradually up to 1000 current invocations. Since you're writing an HTTP function, this does not apply.

For HTTP functions, note that rates are limited by the amount of outbound network bandwidth generated by the function (among other things). You will have to take a close look at what your function is actually doing to figure out if it's exceeding the documented rate limits.

If you can limit what the function is doing internally to meet the scalability limits, one thing you can try is to shard your functions. Instead of one HTTP function, create two, and split traffic between them. The stated limits are per-function (not per-project), so you should be able to handle more load that way.

Upvotes: 1

Related Questions