question

kristofer avatar image
kristofer asked

Azure functions slow response times

Hi,

We're using Azure functions in our game. The functions app is set up in the US East region. We feel that the response times are unacceptable and have started investigating why this might be. Looking at the Daily API Usage reports, the average for the "execute function" is around 1-1.5 sec.

So we created a small test function that calls "GetUserDataAsync" and returns it to the client. The user data is minimal.

We then set up a test:

1. Calling the function through PlayFab.

2. Calling the function directly.

We

ensured the function app was "warmed up" before

the tests.

Our result shows that calling the function through the PlayFab API is almost 80% slower.

Is it expected to take this much more time when PlayFab is the middleman?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

When calling an Azure Function (AF) through PlayFab, PlayFab will verify the request and gather the information of the caller. At the end of the function execution, PlayFab will wrap up the result and return to client. This takes a bit more time than calling the AF directly.

In addition, the PlayFab core service is in US West. The traffic between PlayFab and AF also takes time. I would suggest you set up your AF in US West region to reduce this traffic time.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kristofer avatar image kristofer commented ·

Thanks for confirming, @Rick Chen. I'll move our functions app to the US West region. But I guess that we will still not be happy with the response times.

With this in mind, I don't see a reason we would want to have PlayFab as a middleman for functions we do not intend to use with the "Automation" system.

We can construct the "FunctionExecutionContext" ourselves and call the AF directly in such cases.

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ kristofer commented ·

It is up to you. But please note that it is safer to use the PlayFab API to call the function instead of directly calling your Azure Function. Because by directly using your Azure Function from client, you will expose your Azure Function URL to public, putting it at a risk of getting DDoS attack.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.