question

YONGHAN CHOI avatar image
YONGHAN CHOI asked

CDN and Efficient Assetbundle Patch and ClientAPI Call Limit

Hi.

https://community.playfab.com/questions/11053/content-service-with-large-numbers-of-files.html

I read the above link.

I'm trying to create a patch system using CDN and Unity Assetbundle.

It's expensive to download all of them at one large assetbundle by CDN.

To save money, I'm going to chop up the assetbundles and patch only the changed parts.

I'm call PlayFabClientAPI.GetContentDownloadUrl to get the download address. But it takes a long time to get all URL.

So I want to call PlayFabClientAPI.GetContentDownloadUrl several times asynchronously.

1) How many times a second should we call them asynchronously so as not to reach the limit?

2) If this is not good, let me know if there is currently a better way to deploy patches in a different way.

3) I also wonder how other titles use CDN to efficiently patch while saving money.

Thanks.

limitsContent
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

·
Citrus Yan avatar image
Citrus Yan answered

How many parts your asset bundles can potentially be? And if the number is big, in that case, calling the Client GetContentDownloadUrl API multiple times in a short period of time (potentially within seconds) continuously would probably get your title throttled. Therefore, I would suggest caching those URLs of your assets, on both the client and the server:

  1. Maintain a server that holds a look-up table for those asset files and update it when certain URLs are becoming invalid (the download URL will be valid for about one hour from its creation).
  2. Have your clients retrieve all the URLs in a single request from the aforementioned server instead of calling multiple Client GetContentDownloadUrl APIs to retrieve them from PlayFab, and, caching those already obtained URLs locally so that you don’t need to request them frequently.

You can also add some other mechanisms to improve the system, for instance, if one of the requested URLs from the server is invalid, have the client request to the server again, however this time, have the server actively call GetContentDownloadUrl to get the refreshed URL and return it to the clients, after that, reflect changes on the look-up table immediately, you get the idea.

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.

YONGHAN CHOI avatar image YONGHAN CHOI commented ·

Thank you for your answer.

I'd like to hear a more detailed explanation about the specific implementation.

Here's what I thought.

Assuming that there are 200 assetbundles.

1. Save the Path List of files stored in CDN File Management into the title data.

2. Using Scheduled Tasks.

- By list in File Path List at approximately 40 minutes intervals, Run GetContentDownloadUrl per paths.

- The url lists obtained And Store or update in title data.

3. Each client receives a list of url stored in the title data from ExecuteCloudScript.

When I tried to do this, I found that there were the following limitations.

- Cloud Script action time (triggered action) is 1 second.

- Cloud Script action API requests enabled (triggered action) is 3.

Therefore, I have found that the implementation above is not possible.

I would appreciate it if you could give me more details on how to implement it in a specific way.

Thanks.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan YONGHAN CHOI commented ·

The reason I didn't mention CloudScript/Scheduled Tasks was that it may encounter some limitations , just like you mentioned above. As a matter of fact, what I intended to suggest was to use a custom server for this feature, which is more flexible than CloudScript, without those limitations. Or, you may also consider using Azure Function for this.

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.