question

gestion avatar image
gestion asked

Migrating large (really large) list of objects/codes from azure database to playfab

Hi there,

We have an app (that was released years ago) and are now implementing a system in which users can enter codes obtained outside the app (from toys) to get objects such as items and/or ingame currency. Each code can only be claimed once, so we basically store them inside a table in a database using azure and check if they are available and such.

The thing is we are currently migrating from Azure to PlayFab and we were wondering what would be the best option for storing the codes inside PlayFab. The amount of codes is huge (400k), which isn't a problem within a database, but it really is a problem inside PlayFab. So we've been doing some tests and investigating for the last few days/weeks.

We have tried using items inside a catalog, or properties inside Title Internal Data, but the limit on the amount of items is way below our needs. We also tried setting the list of codes as the value of an internal title data property, but the 10k limit cannot hold all of our codes.

Our last option is using files on the CDN, which has the $0.10/GB cost. Our file is 7MB heavy which I believe the costs would be really low.

What would be our best option?

Thanks in advance.

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

·
Seth Du avatar image
Seth Du answered

Currently, PlayFab doesn’t support custom database. Your solution CDN is not feasible because the File management feature of PlayFab is a simple storage service which only allow users to download and upload(Admin API only). It is not safe to download the whole database to local client since players can manipulate the data. Meanwhile, it will not be easy to mark if the coupon code has been used.

I believe an external database is still required to handle such verification process and usage logic.

7 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.

brendan avatar image brendan commented ·

Alternately, if the codes haven't been generated yet, you could just use our code system:

https://docs.microsoft.com/en-us/gaming/playfab/features/commerce/economy/coupons-and-promotions.

Just let us know how many codes you need, and the Title ID, Catalog Version, and Item IDs the coupons should provide, and we can generate them for you.

0 Likes 0 ·
gestion avatar image gestion brendan commented ·

Hi @Brendan,

The codes have already been generated. There's 400k of them and around 20k of them have already been printed on toys and are available to the public, so generating the codes again is kind of out of reach now.

We'll have a look at the docs you linked, in case we can create a workaround using the code system. Thanks a lot.

Thanks guys, we'll keep you updated.

0 Likes 0 ·
gestion avatar image gestion commented ·

Hi, @SethDu,

We were thinking about using cloud scripts to read the file from the CDN, so the clients wouldn't need to download the file and everything would be managed entirely on the server side (just download the file, mark the code and reupload).

It would be just one table from the database that would need to be transferred to the file on the CDN (the one that is 7MB size).

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ gestion commented ·

In terms of CDN, the download/upload time will be uncertain. Because the maximum limit to Cloud Script execution time is 4.5s and only Enterprise Tier users can increase this limit, even though 7MB is not that large, you may try it but possibly it can return error.

Since your database is on Azure, you may use Azure RESTful API to get the query result from Cloud Script. Another good new is that even I cannot tell the ETA, we are planning to implement Azure function on PlayFab, please keep track of the update news and blogs.

0 Likes 0 ·
gestion avatar image gestion Seth Du ♦ commented ·

Hi @SethDu,

We are already doing some tests with the file on the CDN. There's no problem at all donwloading and reading the file from a cloud script (even being a 7MB file, it goes really fast). We are facing problems trying to update the file tho, since it seems the GetContentUploadURL cannot be called from within a cloudscript.

Is there a way of uploading the file on the CDN from the cloud script?

0 Likes 0 ·
Show more comments

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.