Why GAE launched a second instance with Max Idle I

2019-04-09 04:18发布

I use Google Ap Engine with billing Status Enabled.
Idle Instances are set to : ( 1 – 1 )

enter image description here

And with only 2 clients on my service, sometimes I saw a second instance. The trouble is that it's take 15s to launch the new instance (spring and co..).

enter image description here

80Mb of memory is to hight for one instance ?
Log for new instance : /_ah/warmup 200 14580ms 0kb
The second instance disappears after a few seconds.

Why with 3-4 requests, GAE run a second instance ?? The first one do nothing (almost) !

I tried to modify "Pending Latency" without success.

A solution ? :)

Thx

2条回答
孤傲高冷的网名
2楼-- · 2019-04-09 04:52

If the resident instance is deemed "too busy" to handle a request, App Engine will start another one. Even with very low traffic, if the app is handling enough requests simultaneously, AE may decide it needs another instance to provide quality service. You are correct that increasing pending latency will reduce the chance that another instance gets started, but you can't prohibit dynamic instances completely.

Also, do you have multithreading enabled? If not, then the resident instance will be busy even if it's handling just one request. If your code is threadsafe, you can enable multithreading and handle more simultaneous requests concurrently with the instance.

With very low traffic and a very small number of instances, App Engine doesn't have a lot of information to go on when deciding whether it needs a new instance. You'll see better utilization and fewer spurious instances with more traffic.

查看更多
爷、活的狠高调
3楼-- · 2019-04-09 04:53

You've asked for exactly one idle instance. When serving a request, an instance is not idle. Therefore, App Engine spins up a new instance to maintain your requested number of idle instances.

查看更多
登录 后发表回答