I have been working on a java application on GAE that uses services like cloud sql,calender api , mail API and data-store . So my question is that I need to meter the usage of these services for the users accessing my application . This will be based on how many I/O's they do on cloud sql or how much data they have stored . Is there any way to do that ?
App Engine flexible environment pricing These virtual machine resources are billed on a per-second basis with a 1 minute minimum usage cost. Billing for the memory resource includes the memory your app uses plus the memory that the runtime itself needs to run your app.
Opsview's Google Cloud Platform monitoring tools provides an easy way to monitor performance metrics for: Compute Engine Instances, Cloud Storage Buckets, and Cloud SQL Database Instances.
There is no builtin way to meter quota per user. You might be able to get away with keeping track of each user's accesses to these resources and storing them in the datastore, though this will drive usage up. 2 writes are needed for each use, or 4 if it is indexed.
If you don't require precise metering, and are OK with metering data being lost if Google's resources run low, you can store it in memcache as username/id->metering data. It is provided on a best-effort basis which should be enough if tied with your own per-app sanity limits and there is no need to bill users.
The two can optimally be used together. Every few minutes to an hour, write the memcached usage details to the datastore, and if data is lost from the memcache(unless you purchase dedicated memcache), restore from the datastore(possibly estimating usage over the past lost period).
Currently there is no way to meter the usage of each service. but this may help you to get the cost & CPU usage of each request.
App Engine will include a couple of extra headers in all the HTTP responses it sends you. Here's HTTP headers that will help to meter the resource usage & Estimated-CPM-US-Dollars:
X-AppEngine-Resource-Usage: ms=293 cpu_ms=500 api_cpu_ms=236
X-AppEngine-Estimated-CPM-US-Dollars: $0.012320
Here are some reference: http://googleappengine.blogspot.in/2009/08/new-features-in-124.html https://developers.google.com/appengine/docs/java/#Java_Responses
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With