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 Kim Strasser · Dec 25, 2020 at 10:35 AM · CloudScript

CloudScript and Azure Functions costs?

Is it possible to find out how much a specific CloudScript or Azure Functions call costs?

For example, I have this json data from the PlayStream event player_executed_cloudscript:

{
  "PlayFabEnvironment": {
    "Application": "logicserver",
    "Vertical": "master",
    "Commit": "22da35e",
    "Cloud": "main"
  },
  "EventNamespace": "com.playfab",
  "CloudScriptExecutionResult": {
    "FunctionName": "GetPlayerAvatar",
    "ExecutionTimeSeconds": 0.0539539,
    "ProcessorTimeSeconds": 0.0,
    "MemoryConsumedBytes": 15240,
    "HttpRequestsIssued": 0,
    "APIRequestsIssued": 1,
    "FunctionResult": {
      "callsuccessful": true,
      "avatarnumber": "6",
      "errorresult": null
    },
    "Revision": 71,
    "Logs": [
      {
        "Message": "avatar code is: 6",
        "Level": "Info"
      }
    ]
  },

Is it possible to calculate the costs with these informations?

I have read this article: https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/meters/meters

But I don't understand how to calculate the costs for CloudScript or Azure Functions calls myself.

How can I calculate the costs for CloudScript?

How can I calculate the costs for Azure Functions?

Comment
Meltdown Interactive Media

People who like this

1 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 · Dec 28, 2020 at 09:06 AM

To calculate the cost, you need to calculate the GB-s of CloudScript Execution Time that consumed by you. As this thread -- https://community.playfab.com/questions/42100/cloudscript-execution-time-pricing.html said, the minimum execution time and memory for a single function execution is 100ms and 128mb respectively. So, each script execution would consume 0.0128GB-s at least. In your example, the value of ExecutionTimeSeconds is 0.0539539 that equals 53.9539ms. It is less than 100ms. This execution consumes 0.0128GB-s.

As our documentation -- https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/development-mode said, the development mode title has the free quota of 20K GB-s CloudScript Execution Time and 200K Executions. For the launched title, different subscription plans have different limits. Please navigate to this page -- https://playfab.com/pricing/ for more details. For example, in Pay-as-you-go plan, the pricing of CloudScript Execution Time would be $0.000022 per GB-s and $0.22 per million executions. The cost of your example would be 0.0128*0.000022+ 0.000001*0.22.

The cost of Azure Functions will be charged by Azure, please check this documentation for more details. If you have more questions about the cost of Azure Functions, please contact the support of Azure.

Comment
Meltdown Interactive Media

People who like this

1 Show 5 · 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
avatar image Kim Strasser · Dec 28, 2020 at 10:59 PM 0
Share

I have a question about estimating the cost if 10000 people would execute the same CloudScript function 20 times per month.

Your example for 1 person who executes this CloudScript function 1 time per month:

 0.0128*0.000022+ 0.000001*0.22 = 0.0000005016$<br>

Example for 10000 people who execute this CloudScript function 20 times per month:

(0.0128*0.000022+ 0.000001*0.22) * 10000 * 20 = 0.10032$<br>

Are my calculations correct?

What happens if I have more than 1 million executions per month? Will the price of 0.000001*0.22 change if I have more than 1 million executions per month?

What happens if the ExecutionTimeSeconds of a CloudScript function is more than 100ms? How can I calculate the cost when it is more than 100ms?

I have a question about PlayStream Events.

I often use player_executed_cloudscript events in my game and I'm not sure if the cost($6.60 per million events*) of the PlayStream events depends on the size of the PlayStream event json file.

Does it cost me more money if my PlayStream event json files are bigger? For example, my PlayStream event json files are often big because I use Logs regularly:

"Logs": [
{
 "Message": "true",
 "Level": "Info"
},
avatar image Sarah Zhang Kim Strasser · Jan 04, 2021 at 01:58 AM 0
Share

>> Are my calculations correct?

If you in the Pay-as-you-go, and the execution time is less than 100ms. It’s correct.

>> What happens if I have more than 1 million executions per month? Will the price of 0.000001*0.22 change if I have more than 1 million executions per month?

If you in the Pay-as-you-go, the price would be always $0.22 per million executions. If you purchase the Standard Plan, the first “1 Million executions” is free. Then the price would be $0.2 per additional million executions. For more details, please check this page -- https://playfab.com/pricing/.

>> Does it cost me more money if my PlayStream event json files are bigger?

[Edited]Yes, it does. As this section said -- https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/meters/meters#example. The calculation of the count of PlayStream events depends on the average size of your events. If the average size is bigger than 1KB, PlayFab would calculate bigger count of events, it would cost you more money. The size less than 1KB would be calculated as 1KB. PlayFab would calculate count of events depends on actual count.

avatar image Kim Strasser Sarah Zhang · Jan 04, 2021 at 10:06 AM 0
Share

I have one more question about CloudScript. How can I calculate the CloudScript costs if the ExecutionTimeSeconds is more than 100ms? Will the 128mb change if ExecutionTimeSeconds is more than 100ms?

For example, if ExecutionTimeSeconds is 0,1403627 that equals 140,3627ms. How can I calculate the cost in this case?

Show more comments
Show more comments

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

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    GrantItemsTouser not letting me access ItemInstanceId? 1 Answer

    Advantages of CloudScript over Calling JavaScript from Node.js 1 Answer

    Update Character Data 3 Answers

    GetPlayersInSegment is really slow suddenly. What has changed? 1 Answer

    For Loop - Iterating GetCharacterInventory & matching 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