datayja
datayja

Reputation: 712

Addressing Backends

Google says at Addressing Backends chapter that without targeting an instance by number, App Engine selects the first available instance of the backend. That makes me wondering – what is that “first available instance”? Is it the instance #1, or is it picked by some other methods?

Upvotes: 2

Views: 159

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

The exact behavior of this depends on if your instances are dynamic or resident.

For dynamic instances, the request goes to the first instance that can handle the request immediately. If there are no instances that can handle the request immediately, the request is queued or a new instance is started, depending on queueing settings.

For resident instances, the request is sent to the least-loaded backend instance.

The reason for the different behaviors is to make the best use of your instances: resident instances are there anyway, so they're utilized equally, while dynamic instances are spawned only as needed, so the scheduler tries to avoid spinning up new ones if it can.

Upvotes: 3

Related Questions