Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by lanpartygamesstudio · Sep 22, 2021 at 01:36 AM · CloudScriptLeaderboards and Statistics

Cloudscript memory limits (Player profile feature)

Hi!

Let me first describe the feature:

We have a leaderboard filled with data comming from GetLeaderboard.

When the user clicks on an entry we want to show a pretty complete and complex player profile, with different info that needs to be calculated from playerData, readonlyData, and statictics.

The approach would be to call a cloudscript that uses GetPlayerCombinedInfo to retrieved all needed data, processes that and returns a JSON with what we need.

This would cost some extra calls to our game, cause we have a GetPlayerCombinedInfo call made in that cloudscript each time a user wants to see a profile. That's why we are thinking of implementing a cache that holds the generated JSON for some time (each entry of the cache is valid for 5-10 minutes), so even if multiple players try to see the no.1 player, that profile gets calculated only once each 5-10 mins.

1 - How big can that cache be? Is there a limit from playfab? I couldn't find the answer in the "playfab limits" section of the docs.

2 - Is this a good solution? How are you people approaching this?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Sarah Zhang · Sep 22, 2021 at 09:43 AM

>> How big can that cache be? Is there a limit from playfab? I couldn't find the answer in the "playfab limits" section of the docs.

There is no exact limit of the data size that can be cached on CloudScript. Please follow the general limits of the CloudScript. You can navigate to your title’s [Game Manager]->[Title settings]->[Limits] or navigate to the URL - https://developer.playfab.com/en-US/c/[YourTitleId]/limits (replace the [YourTitleId] with your real title Id) to check the limits of your title.

>> Is this a good solution? How are you people approaching this?

As this thread - https://community.playfab.com/questions/15196/any-way-to-reset-all-cloudscript-instances.html said, although you can store the data as the static values to attempt to “cache” them. But since there are multiple servers that will service your CloudScript calls, each CloudScript instance will not communicate with each other, and those servers may unload your script at any time (based on overall load). We cannot guarantee that the cached value will work properly in each CloudScript API call. So, if you want to cache the data on the CloudScript, you need to implement the non-empty judgment and the retry mechanism to prevent potential problems that caused by empty data. Please check these threads for more information - https://community.playfab.com/questions/28524/cloud-script-staticvalue-to-improve-speed.html, https://community.playfab.com/questions/14498/use-of-cached-objects-in-cloudscript.html.

Besides, you can also consider caching a part of data locally to reduce the burden on the backend. Or you can use the external cache directly, such as the Azure Cache for Redis, to get a more reliable experience.

Comment
lanpartygamesstudio

People who like this

1 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Email Templates variables 1 Answer

    Leaderboard reset at custom time 1 Answer

    Returning linked account info from cloud script 1 Answer

    What's the best way to get a custom segment of players based on the user's current stats? 1 Answer

    Cloud functions vs client side code for leaderboards 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges