App Engine server + Android multiplayer game - google-app-engine

Greetings,
I'm creating a multi-player android game and thought it would be a interesting idea to have App Engine handle the server work.
The game consists of 4 players, each phone requests an update every 0.5 seconds.
These requests are very simple and lightweight so i shouldn't be over reaching any free quotas.
The problem i found was that App Engine only handles 500 requests per second, i would only be able to
have around 60 game sessions active before App Engine will start ignoring new requests?
"App Engine's quota system allows for efficient applications with billing enabled to scale to around 500 queries per second (qps) or more than 40 million queries per day."
Or should i just not use this platform because it is not made for this kind of usage?
I sent this same question to the discussion groups on google but after 4 hours it hasn't been posted, there was no response on whether it was a bad question or anything. Hopefully someone here can give me some advice.
Thank you kindly, i'm looking forward to an answer and or advice.
Greetings,
Rohan C

That's an interesting question, considering the only page where I can find that quote contains the answer in the same paragraph.
http://code.google.com/support/bin/request.py?contact_type=AppEngineCPURequest
App Engine's quota system allows for
efficient applications with billing
enabled to scale to around 500 queries
per second (qps) or more than 40
million queries per day. This is a
substantial amount of traffic and
should easily suffice for even the
heaviest of Slashdottings. But if you
expect your application will need to
handle even higher qps, please
complete this form so we can assist
you.

Related

How calculate the number of instances in Google App Engine

I aim to create an application that will be deployed thanks to Google App Engine.
Before that I would like to calculate the cost of Google App Engine.
For this I have to provide the Number of instances, per hour. How can caluculate this number of Instances ?
To reformulate, imagine I have 1 thousand users connected, how many users can 1 instance afford ?
Thank you for your answer and help
Regards
Benoit
It's really hard to answer without more info. App engine consumption will depend on the nature of your app, the average session span and usage hours, how well you optimize your implementation and so much more variables...
Don't think about how many instances, think about how many instance hours you'll need to serve your users if you can figure how much you'll be consuming you could get an estimate using the App engine pricing calculator .
Completely depends on the code that runs on each request. You need to make it more specific to get a better answer. Ive had carefully implemented apps that receives thousands of requests per minute with a single instance. How long each request takes and the memory it consumes is key as well as the frontend instance type you select to use.
Appengine also lets you calibrate some parameters like min/max latency to control when more instances are launched.

Google App Engine Billing inconsistent with Usage History

I am sorry if this is not the right place to ask this question, but Google has moved customer support for Bronze Tier to Community Forum aka Stackoverflow... So here I am, stuck with a bill that I can't figure out. Just to give you the context, I am running an Android app sending videos averaging 2 megabytes per video to users. There are around 70 daily users downloading 2 videos a day.
Image here: http://postimg.org/image/cytlw3rzx/ (Sorry I don't have 10 reputation yet)
As you can see, there are supposedly 516 Gibibyte of Cloud Storage Download APAC. However, I only have around 150 megabytes of data stored on the cloud. So it is mathematically impossible to have such traffic over this period of time. On top of this, here is the Usage History which suggests totally different usage.
Image here: http://postimg.org/image/5h1tzl49f/
Please help if you have any idea what is going on as I am stuck with no customer support and no helpful information on the internet...
The usage history you posted (your second picture) is only for the App Engine application, but does not include Cloud Storage usage. It also does not include any usage you may make of Compute Engine, Big Query etc.
That is why the usage history shows less than 1$ per day whereas your final bill shows additional charges for Cloud Storage.
You can ask billing-related questions to the Cloud Platform billing team here : https://support.google.com/code/contact/cloud_platform_billing
You can also find more info on your current usage here :
https://console.developers.google.com/project/YOUR_PROJECT_ID/billing/unbilledinvoice
If you have doubted about how your cloud storage buckets are used, set up access logging as explained here.

Compendium of App Engine limits

I have been trying to build a web application using Google App Engine, but am finding it slow going. A major problem is GAE's many limits, both architectural and quantitative. Not knowing the system well, I design a solution, implement it, and then find it won't work in production because of some heretofore unsuspected limit.
Is there a resource that collects all of GAE's limits on one web page? I could see it being divided into subsections, like "Datastore," "Memcache," "Response times," "Blobstore," etc. Stackoverflow shows a multitude of questions about GAE limits.
Thanks.
Google's App Engine dashboard has all the limit showing under quota details. But most of this limits are soft limits which you can send them a request to increase when you reach it, it's just there to avoid abuse/spam. Also note that these limits are increased when you enable billing.
But if you are talking about limitations like request size, request timeout and limits with datastore these are all because it is designed so it will scale seamlessly without degrading the performance if you have 10 users to 10 billion users.
It also took me few weeks to really get the hang of it and now even at my work(not using app engine) I try to do it the app engine way, like trying to limit a lot of things to avoid anything that will cause a degradation of the system. So this limitations are also learning curve on what you can do on other systems that don't put this kind of limitation to make your app scale.

Identify why Google app engine is slow

I developed an application for client that uses Play framework 1.x and runs on GAE. The app works great, but sometimes is crazy slow. It takes around 30 seconds to load simple page but sometimes it runs faster - no code change whatsoever.
Are there any way to identify why it's running slow? I tried to contact support but I couldnt find any telephone number or email. Also there is no response on official google group.
How would you approach this problem? Currently my customer is very angry because of slow loading time, but switching to other provider is last option at the moment.
Use GAE Appstats to profile your remote procedure calls. All of the RPCs are slow (Google Cloud Storage, Google Cloud SQL, ...), so if you can reduce the amount of RPCs or can use some caching datastructures, use them -> your application will be much faster. But you can see with appstats which parts are slow and if they need attention :) .
For example, I've created a Google Cloud Storage cache for my application and decreased execution time from 2 minutes to under 30 seconds. The RPCs are a bottleneck in the GAE.
Google does not usually provide a contact support for a lot of services. The issue described about google app engine slowness is probably caused by a cold start. Google app engine front-end instances sleep after about 15 minutes. You could write a cron job to ping instances every 14 minutes to keep the nodes up.
Combining some answers and adding a few things to check:
Debug using app stats. Look for "staircase" situations and RPC calls. Maybe something in your app is triggering RPC calls at certain points that don't happen in your logic all the time.
Tweak your instance settings. Add some permanent/resident instances and see if that makes a difference. If you are spinning up new instances, things will be slow, for probably around the time frame (30 seconds or more) you describe. It will seem random. It's not just how many instances, but what combinations of the sliders you are using (you can actually hurt yourself with too little/many).
Look at your app itself. Are you doing lots of memory allocations in the JVM? Allocating/freeing memory is inherently a slow operation and can cause freezes. Are you sure your freezing is not a JVM issue? Try replicating the problem locally and tweak the JVM xmx and xms settings and see if you find similar behavior. Also profile your application locally for memory/performance issues. You can cut down on allocations using pooling, DI containers, etc.
Are you running any sort of cron jobs/processing on your front-end servers? Try to move as much as you can to background tasks such as sending emails. The intervals may seem random, but it can be a result of things happening depending on your job settings. 9 am every day may not mean what you think depending on the cron/task options. A corollary - move things to back-end servers and pull queues.
It's tough to give you a good answer without more information. The best someone here can do is give you a starting point, which pretty much every answer here already has.
By making at least one instance permanent, you get a great improvement in the first use. It takes about 15 sec. to load the application in the instance, which is why you experience long request times, when nobody has been using the application for a while

how is Billing for Channel API done?

I've chosen google-app-engine because of its scalability, and now I try to understand how much I will have to pay once I release the product.
I've looked back and forth in the google app engine documentation to find an answer for question and couldn't find. I found few details in the "Quotas" page, I found how much I can get for free and how much is the Billing Default Quota.
In Billing Page there are number for CPU, etc with Resource and Unit and how much it cost. But no where could I find how much will it cost me per channel calls/created, etc.
I can't even try to make calculations with what's in the Admin console, because the current numbers there now are 0 (since there are 2 users which are the programmers).
How can I be ready for the releasing of the product that (hopefully) will have a huge number of channels created daily?
Is there a page I missed, or is there a tool for calculating?
Thanks!
EDIT:
Moishe, thanks for the quick and readable answer. So here are some more questions:
1. Do you think - if needed - that I will be able to get even more quota for the number of channels? I saw there's a special form to ask for more quotas, but I'm not sure that includes the Channel-API feature...
2. Are there any posts you've made for "how to use channel-API efficiently"? I saw some stuff about reusing the tokens per user. Is there more?
Thanks again.
Creating a channel costs about 2.7 CPU-seconds. A CPU-hour costs $0.10. So, each channel created costs
(2.7 / 3 600) * $0.10 = $7.5 × 10^-5
So creating 1000 channels will cost $0.075, or 7.5 cents.
You'll also get charged the normal outgoing bandwidth costs for any data sent over a channel.
The CPU cost probably isn't the biggest concern; you're more likely to run into quota caps then running out of money. Paid apps are limited to 86400 channel creations/day (1/second).

Resources