15

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.

5
  • Are you using master/slave or high replication for your datastore? Mar 4, 2013 at 14:52
  • Hello, I'm using High Replication
    – FrEaKmAn
    Mar 4, 2013 at 14:59
  • wondering - are you monitoring site load/GC/timing your code - if so, how?
    – ali haider
    Mar 4, 2013 at 16:11
  • No, I'm not monitoring but I'm looking for ways..
    – FrEaKmAn
    Mar 4, 2013 at 16:44
  • for me the issue looks like in your first sentence. GAE is not a provider, GAE is an SDK, a complete environment. using frameworks like play or what ever, they are not made for GAE. developing for GAE means and needs thinking of GAE and NOT of some framework or lib... (this also means after chosen GAE you can not go to EC2 or what ever) Mar 5, 2013 at 4:26

4 Answers 4

11

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.

4

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.

2

Combining some answers and adding a few things to check:

  1. 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.

  2. 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).

  3. 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.

  4. 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.

0

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

2
  • 1
    I'm aware of startup time. As I said, it works slow on random intervals.
    – FrEaKmAn
    Mar 13, 2013 at 8:16
  • Are you sure this isn't because a new instance is booting up. Depending on your application settings in the GAE console, you can actually negatively impact your app like this depending on the settings. There have been several talks about this and articles, but I can't seem to find them right away. You can also use warmup requests. Mar 16, 2014 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.