I wonder about these things:
- 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?
- 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)
- 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.
Hey @CodeSmile ,
- 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.
- 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.
- The egress traffic is Cloud Code response. If a function returns an integer the end result will be:
{
"output": 1
}
this would count as 12 Bytes. However, if the function simply returns without a value it would result in:
{
"output": null
}
counting 15 Bytes.
Let me know if that answers your questions!
2 Likes
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. 
1 Like
I find the cloud code pricing for Unity Gaming Services (UGS) to be quite expensive.
To provide a comparison, the cost per invocation appears to be roughly ten times higher than with PlayFab. Additionally, the CPU time pricing lacks clarity. For instance, a user with a slower internet connection would consume more CPU time than a user with a faster connection. As a result, we would end up paying significantly more for users with slower connections.
Furthermore, compute hours in AWS and PlayFab are calculated using GB-s, but in UGS, the pricing is set without considering RAM usage. Since a well-written script typically uses no more than 10-20 MB of RAM, I believe UGS is at least ten times more expensive in comparison to other services.
While testing the UGS sample for just 10-20 minutes, I encountered 100 seconds of usage already. Although it is a great service, the high pricing makes it difficult to consider for my indie game. Based on comparisons with other services, I believe the pricing would need to be about ten times cheaper to be competitive.