Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Cloud Code pricing/billing clarification

Discussion in 'Cloud Code' started by CodeSmile, May 22, 2024.

  1. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    7,263
    I wonder about these things:
    1. Pricing page lists $0.00002 per compute second. That makes $0.072 per compute hour. I wonder if the price was provided in seconds not hours because it works like in telecommunication where users are charged per "started (unit of time)"? In other words if I have 1000 invocations each completing in 1 ms do I get charged $0.00002 or $0.02?
    2. Am I correct to assume that the compute time starts with the method invocation and stops with the return, including awaits? Meaning if an invocation has to await other services then my compute time for this invocation will include the awaited time? Meaning if the awaited service is offline and has a 10s timeout I would incur a penalty for that service being down? (service could be UGS or external)
    3. Egress traffic is the entire response body of the method return value(s)? So if a method returns an Int32 the egress for this call isn't just 4 bytes? If so, any way to determine or estimate that minimum egress size per invocation?
    Hopefully someone could clarify this a bit because I couldn't find anything about that in the FAQ, manual and REST docs.
     
    Last edited: May 22, 2024
  2. MariusUrbelis

    MariusUrbelis

    Unity Technologies

    Joined:
    Mar 15, 2015
    Posts:
    49
    Hey @CodeSmile,
    1. I would imagine the pricing per second is provided to be more simple to understand. You wouldn't however, be charged for the unused milliseconds. Say if your code took up 500 ms of CPU time, you would only be charged for that 500 ms.
    2. Almost. Processes blocked on I/O are not using the CPU so they don’t accrue charges. We bill based on the CPU-seconds scheduled, not on how long your request takes.
    3. The egress traffic is Cloud Code response. If a function returns an integer the end result will be:
      Code (JavaScript):
      1. {
      2.     "output": 1
      3. }
      this would count as 12 Bytes. However, if the function simply returns without a value it would result in:
      Code (JavaScript):
      1. {
      2.     "output": null
      3. }
      counting 15 Bytes.
    Let me know if that answers your questions!
     
    GabKBelmonte and CodeSmile like this.
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    7,263
    Thanks for clarifying the details!

    Interesting bit about no return value. So we better "return 0" to save 3 bytes per invocation. Probably amounts to almost nothing though but still. :)
     
    MariusUrbelis likes this.