- Bandwidth: 1 GB of data transferred in per day, and 1 GB out per day.
- CPU time: 6.5 hours of CPU time per day (measured in 1.2 GHz Intel x86 CPU time)
What's the per page-view assumptions behind these calculations?
Let's start with the bandwidth:
It is safe to assume that the amount of consumed outgoing bandwidth is much larger than the amount of incoming bandwidth consumed (average size of HTTP-request < average size of HTTP-response). 1 GB per day should serve at least 5M page-views per month. Assuming 30 days per month:
- (30 days * 1 073 741 824 bytes/day) / 5 000 000 page-views = 6442 bytes of outgoing bandwidth per page-view
6.5 CPU-hours per day should be enough to serve at least 5M page-views per month. Again assuming 30 days per month:th:
- (30 days * 6.5 CPU-hours/day * 3600 CPU-seconds/CPU-hour) / 5 000 000 page-views = 0.1404 CPU-seconds per page-view
- Outgoing bandwidth: 6442 bytes per page-view
- CPU time: 0.1404 CPU-seconds per page-view
The current per unit price of billable Google App Engine resources:
- Outgoing bandwidth: 0.12 USD per gigabyte
- Incoming bandwidth: 0.10 USD per gigabyte
- CPU time: 0.10 USD per CPU-hour
(measured in 1.2 GHz Intel x86 CPU time) - Stored data: 0.15 USD per GB and month
- E-mail recipients: 0.0001 USD per recipient
- Bandwidth cost for 6442 bytes: 6442 bytes * 0.12 USD per GB / 1073741824 bytes per GB = 0.0000007199 USD per page-view
- CPU cost for 0.1404 CPU-seconds: 0.1404 CPU-seconds * 0.10 USD per CPU-hour / 3600 CPU-seconds per CPU-hour = 0.0000039000 USD per page-view
So in summary - the per page-view cost of hosting a resonably efficient GAE/J application is roughly 0.0000046199 USD per page-view. This is equivalent to 4.62 USD per million page-views.
2 comments:
Great series of posts, really enjoying this blog.
Could you investigate gzip compression? There is a trade-off between bandwidth and cpu usage when gzip compression is used for dynamic pages.
Paul Buchheit (GMail creator) says that this trade-off favours using cpu for gzip over bandwidth:
http://paulbuchheit.blogspot.com/2009/04/make-your-site-faster-and-cheaper-to.html
However, for Appengine/Python, although static resources like css and javascript are automatically served compressed, dynamic pages aren't, and you cannot do it manually as Content-Encoding response headers are stripped by the server.
The Appengine/J docs don't make the distinction between compressing dynamic/static content, but they imply that dynamic content is compressed.
Is this the case? Does Appengine/J compress dynamic content and how does that change the budget for cpu/bandwidth allowance and price per request?
140ms (1.2GHZ CPU) per request.
But what can you do with 140cpums? How many cpums for a simple servlet which returns 6,400 bytes. How many cpums for a single datastore call which finds a single entity?
If the datastore is busy then your process spin/waits and you are charged for the cpu time.
What I am wondering is, what can a 'reasonably efficient' web app achieve in 140cpu-ms, and is that reasonable?
Post a Comment