Cold start of C# CloudCode

Hello,

I`m using Cloud Code with C# module. The problem is that the latency time of cold start is too long. It takes over 8000ms. If it is not on a cold start, it takes around 200~600ms.

I tested it again with the basic sample module - SayHello function, and this small function also takes over 6000ms! Is this normal?

public class HelloWorld
{
    [CloudCodeFunction("Hello")]
    public string SayHello()
    {
        return "Hello World!";
    }
}

The difference of about 2000ms between the two comes from fetching Cloud Save or Remote Config for the first time in a cloud module. Calling other UGS api drops to under 100ms during a warm state, and under 400ms when it is called directly from client (without Cloud Code).

.

I was suspicious of the region out of US, but I think it would not be that much.

One more thing I noticed is, I heard that a cloud function becomes a cold start right after deploying, but it drops to 2000~3000ms when it runs after the deployment.
Someone says using REST api instead of C# module will help the cold start issue, but I`m not sure.

Anybody who has experienced like this?

1 Like

Hi there!

If you’re game is receiving active traffic (likely in a production environment of your game), you should not experience a cold start, so long as there is at least 1 request per 15 minutes to your module (you can see more about this here). In development you are more likely to encounter cold starts, however we are currently working to mitigate this in the future.

With respect to the 200~600ms response times, this could be affected by a number of factors, such as how many other services (unity or otherwise) you are calling out to in your module function, but would need more information about what the function does to help with that. I will also note that our servers are in the US, so this could also be a factor if you’re outside the US.

1 Like