Google App Engine instances keep closing fast

So, I have been using the application engine for a long time without any problems. I know that if the application has not been affected by the visitor for some time, the instance will be closed, and the first visitor to the site will have a delay of several seconds until the new instance begins.

However, recently it seems that instances remain alive for a very short period of time (sometimes less than a minute), and if I already have one instance and I refresh the application’s web page, it still fires another instance (and the start the page is the minimum HTML start page, does not require a lot of CPU / memory). Looking at my magazines, he constantly launches new copies, which has never happened before.

Any tips on what I should look at, or any ideas on why this is happening?

In addition, I use Python 2.7, threadsafe, python_precompiled, inbound warm-up services, NDB.

Update:

So, I modified my application to have at least one standby instance, hoping this solves the problem, but it still starts new instances, even if one resident instance is already running. Therefore, when there is only one resident instance (and I do not receive any traffic except me), and I go to another page of my application, it still starts a new instance.

Also, I changed the expected delay to 1.5 seconds, as the coma noted, but that doesn't seem to help.

The use of memory instances is always around 53 MB, which is surprising when the pages being called don't do much. I use the F1 Frontend Instance Class and has a limit of 128, but in any case 53MB seems high for what it should do. Is this an acceptable size on first start?

Update 2: I just noticed on the toolbar that over the past 14 hours, the request / _ah / warmup has answered 24,404 with errors. Could this be related? Why would they answer 404 response status?

The main question: Why does it constantly launch new instances (even without traffic)? Especially when there are already existing instances and why do they close so quickly?

+8
python google-app-engine
source share
3 answers

My solution was to increase the wait time delay .

If a web page starts 3 ajax requests right away, AppEngine starts new instances for additional requests. After setting the Minimum Pending Latency time , setting it to 2.5 seconds, the same instance processed all three requests, and the throughput was acceptable.

My project still has a small load / traffic ... so in addition to increasing the waiting delay, I open an account in Pingdom and configure it for every ping project of my Appengine.

The combination of both makes me have one instance that stays alive and serves all requests most of the time. It will scale in new cases when it is really necessary.

+4
source share

1 idle instance means that the engine application always launches an additional instance for the next user that arrives - that’s why you see an additional instance activated by this parameter.

If you remove the idle instance parameter (or use it by default) and simply increase the expected delay, it must "wait" before starting an additional instance.

As for the main question , I think that @koma might be for something, saying that with the default settings, the engine application will launch additional instances, even if the requests come from one session.

In my experience, the application engine works fine with heavy traffic, but it works hard (and sometimes with disappointment) in low traffic conditions. In particular, it is very difficult to understand the nuances of what are the criteria for exciting new specimens.

Personally, I have a “wake up” cron-job to call an instance every couple of minutes to make sure that if someone comes to the site, the instance is ready to serve. This is not ideal, because it will be eaten according to my quote, but it works most of the time, because the traffic on my application is quite high.

+1
source share

I just started practicing this type on Monday, February 4, at about 10 pm Eastern Standard Time, and it continues to this day. At first, I began to notice that the instances continued to shoot on and off, and the latency increased sharply. It seemed that the instance planner too quickly disconnected the excess instances and caused subsequent beating.

I set the minimum idle instances to 1 to stabilize the delay that worked. However, new cases still occur. I tried the recommendations in this thread only to set the minimum latency, but that does not help. Ultimately, idle instances are disconnected too quickly. Then, when they are needed, latency is triggered when trying to start new instances.

I'm not sure why you saw this a couple of weeks ago, and it only started for me a couple of days ago. Maybe they gradually changed their new instance planner in stages? Can't you see instances closing quickly?

0
source share

All Articles