2

Judging by a conversation I had on #appengine at irc.freenode.net, I'm clearly not the only person baffled by GAE pricing, so I figured I'd throw this up on StackOverflow and ask for clarity. Essentially: given an app with the figures below, what should its "CPU time" bill be per year?

Suppose:
h = Google App Engine's charge per hour for CPU time. Currently, h = $0.10
f = Google App Engine's daily free quota of CPU hours. Currently, I think* f = 2853.5
t = total registered users
s = simultaneous users. Assume = t * 0.2
e = (requests/second)/simultaneous user. Assume = 0.5
r = requests/sec = s * e
R = requests/day = r * 3600 * 24
p = CPU hours/request. Assume 150ms/request. I.e. assume p = 0.15/3600
c = CPU hours/sec = r * p
C = CPU hours/day = c * 3600 * 24
y = average number of days in a year = 365.25 B = CPU time bill per year = (C - f) * h * y

Therefore, C = t * 0.2 * 0.5 * (0.15/3600) * 3600 * 24
So suppose I get 10000 registered users, that means C = 3600.

In that case:
B = (3600 - f) * h * y = 9146.5 * $0.10 * 365.25 = $40415 to the nearest dollar

Is that right, or have I misunderstood what CPU time is, how it is priced, or how the quotas work?

*The free daily quota is not clearly expressed, but I think it's 6.5 hours for general use plus 2,487 hours for datastore manipulation: 2853.5 hours/day in total, assuming that my app mostly spends its time handling requests by using a controller to generate views on the models in the datastore, and allowing CRUD operations on those models.

NB. For a transcript of the IRC discussion, please see the edit history of this question.

Samsquanch
  • 8,866
  • 12
  • 50
  • 89
  • For the same usage figures, I'd expect Amazon Web Services to total no more than $2000/year. –  Nov 20 '10 at 11:58
  • ...what? Have you tried asking Google? http://code.google.com/support/bin/request.py?contact_type=AppEngineBillingSupport – Cody Gray - on strike Nov 20 '10 at 12:00
  • No, I haven't. That form has the following required field: "Your application ID (http://myapp.appspot.com)". I want to estimate pricing - ballpark figures - *before* committing my time to building an app on a given platform, especially a platform with as much lock-in as GAE! I mean, if GAE's really going to cost >20x as much as AWS, I'll just skip GAE completely. –  Nov 20 '10 at 12:06

1 Answers1

6

I think some of your estimates are too high.

20% of a site's registered users are using the service at any time. This is extremely high. It would mean that the average person is registered at only 5 websites, and spends 24 hours per day browsing those 5 sites. I think it would be closer to estimate that an average person is registered at 50 websites, and spends 2.4 hours per day browsing all of them combined, which would put you off by a factor of 100.

0.5 requests per second per simultaneous user. This depends on the site, but I would say the normal pattern is to have a one dynamic request to render the page template, and a series of static handlers to render images, CSS, and javascript. Static requests don't incur CPU charges. If there's one dynamic request per page, your estimate assumes the average user is navigating to a new page twice every second. I'd say once every 5 seconds is more reasonable.

I'm not sure this kind of estimation is particularly useful to begin with. Whether your site has 10,000 users or 10 million users, you're either monetizing traffic or you're losing money. If you're averaging 150ms of CPU time per request @ $0.10 per hour, one dollar buys you 240,000 requests. If you can't earn back $1 in ad revenue from 240,000 page views, you're doing something wrong.

These estimates don't factor in what you're paying for bandwidth or disk storage, or what you lose every time Google decides to put the datastore in read-only mode in the middle of a weekday afternoon. Or the development costs of learning the datastore, which imposes many constraints that you wouldn't have with a traditional relational database. Nor do they factor in what you gain in scalability; if your site turns out to be only mildly popular (like the overwhelming majority of the internet), you'll probably fit within the free quotas, and pay nothing. If you become extremely popular, your app will scale automatically, assuming you designed it well to begin with. This is as opposed to EC2 or Azure, where you're paying ~$77 per instance whether anyone's hitting it or not.

Drew Sears
  • 12,812
  • 1
  • 32
  • 41
  • The estimates are pessimistic, insofar as they're designed to scope out the maximum I might have to pay for webhosting for this app: i.e. if users get obsessed with it and use it *a lot*. But that's not really the point: the point is, the pricing on GAE is opaque. E.g. on EC2, the meter for a machine instance has a dollar rate corresponding to the power of the instance. This meter starts running as soon as the instance is started and it stops when the instance stops. That's comprehensible. On a DreamHost VPS, the meter runs constantly, and you vary the rate by varying the resources. On GAE...? –  Nov 20 '10 at 16:08
  • Also, on EC2 there's no need to pay if no-one's using your app: just scale back to a single Micro Instance, which is free of charge. –  Nov 20 '10 at 16:10
  • Incidentally, my estimates were based in part on this post: http://www.mail-archive.com/rubyonrails-deployment@googlegroups.com/msg02307.html , in part on various vBulletin forum stats, which suggest that having 10% of registered users active simultaneously is the maximum any forum is likely to experience, and in part on the assumption that only half the people using the website at any given time are likely to be using the forum part of it. For good measure (worst-case scoping), I've assumed that these conditions prevail indefinitely rather than being transient. –  Nov 20 '10 at 16:16
  • 2
    @sampablokuper Your figures aren't pessimistic - they're pathological. As Drew points out, no site gets this level of devotion or traffic from its users, and if it did, monetization should be no problem. Pricing on EC2 is at least as opaque for your purposes as App Engine, if not more so - how many concurrent users can one EC2 instance serve? The answer depends on all the figures you used in your question, plus additional ones revolving around your system architecture and demands. Finally, micro instances are only free for new developers for 1 year. – Nick Johnson Nov 22 '10 at 02:11
  • Er... I've outlined the basis for my figures in the comments above. Besides, the question is ***not*** about whether the estimated usage is likely but rather whether, for some given usage beyond the free quota, GAE pricing can easily be estimated - and if so, whether it compares favourably to more traditional alternatives. For many website software packages (frameworks, CMSes, forums, etc), users have publicly posted the server loads they experience in traditional hosting environments. With GAE, this isn't (yet?) the case. By all means remedy this; I'd like to see the results! –  Nov 22 '10 at 13:44
  • @Nick Johnson: Ah, I see that over on the Google Groups thread I started on the same topic, you've confirmed that my calculations were correct (apart, perhaps, from my bundling "datastore CPU time" free quota together with the general "CPU time" free quota): http://groups.google.com/group/google-appengine/msg/827810a7714cbea8 . This is much more the sort of answer I was after, so thank you :) –  Nov 22 '10 at 13:52
  • @Nick Johnson. In fact, if you'll post a link to http://groups.google.com/group/google-appengine/msg/827810a7714cbea8 as an answer to this question, I'll happily mark it as solved. If not, I don't mind doing that myself, but I don't want to cheat you of deserved rep, so I'll wait at least a few days before doing so, to give you time :) –  Nov 22 '10 at 13:58
  • Incidentally, about the AWS free quota: although it does only last for a year, it includes a bit more than just a Micro EC2 instance: http://aws.amazon.com/free/ –  Nov 22 '10 at 14:24
  • @sampablokuper: there is no way you can handle the scenario you describe on 1 uEC2 instance. To compare apples to apples, you need to figure out how many instances with what parameters do you need from EC2. Which is harder than with GAE. And that is because GAE gives you "cloudifies" you at app-server level, wherever AWS does that at virtual machine level and the app stack is your burden, you have to account for kernel/os/db/webserver overheads - which GAE does not bill you for. – Nas Banov Nov 23 '10 at 11:53
  • @sampablokuper: and being reportedly fully aware of this, why do you compare apples to oranges? – Nas Banov Nov 23 '10 at 23:35
  • @Nas Banov: because if I, er, don't care which fruit I eat (as long as it's sufficiently nutritious for my needs), I'm better off choosing whichever species is the most reasonably priced. And in this context, that is indeed the case. –  Nov 24 '10 at 03:47