question

brendan avatar image
brendan asked

Content service with large numbers of files

Question from a developer:

I want to use PlayFab's Content (CDN) service for my Unity game. We will have several AssetBundles to hold basically all game assets. I was looking for the root URL for my files when I saw I needed to make a request to PlayFabAPI to get the URL. To my surprise, I got an URL that was specific to the path I asked, and it cannot be used to download other files. So it seems that, for every file I want to download, I will need to do a PlayFabAPI request first. As our game will have several, lets say hundreds, of AssetBundles, and some, let's say 30, will be downloaded in one go, it means I need 30 PLayFabAPI calls just to start downloading the files. Given that, it seems like this isn't the best route for us. What would you recommend?

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

·
brendan avatar image
brendan answered

Correct - our CDN returns a pre-signed URL for the specific key being requested. We can't really allow for "open" access to the CDN (being able to use the returned link as a general "pointer" into the directory), as the potential for abuse in that model is too high. The signed URL system allows us to track on all data access accurately, and so do our billing appropriately. For cases where you may need to download a lot of CDN data to the client, we would recommend aggregating that data into fewer, larger packages as much as possible.

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.

luizbeneton avatar image luizbeneton commented ·

Hi Bredan, thanks for this post.
Aggregating the data into fewer packages will not work for us.

But we could request a list of all URLs via CloudScript and cache it in the client.
For how long is an URL valid after it is requested?

Thanks!

0 Likes 0 ·
brendan avatar image brendan luizbeneton commented ·

The download URL will be valid for one hour from the time it is created. You can certainly spread your files among multiple keys and request them separately, but you'll want to throttle that call to prevent hitting rate limits, and cache them locally so that you're not frequently requesting them.

1 Like 1 ·

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.