If it helps, here is a write up on what we did to somewhat simulate the single 
instance.

Originally we had min instances = 1, max instances  =1. This was resulting in 
higher average latencies due to spinning off of instances. Our warm ups takes 
around 20 seconds, but it only warms up and does not heat up so the first 
request after the warm up was taking 6-7 seconds. The scheduler is designed to 
keep the constraint min instances = 1, and so, we were seeing unnecessary 
instances. Our goal was to get to a single instance and eliminate warmups. To 
that end, We made the following changes to get mostly a single instance 
behavior.

1) We set min instances = auto.

As per documentation  in 
(https://developers.google.com/appengine/docs/adminconsole/performancesettings)

=======
Note: If you set a minimum number of idle instances, the Pending Latency 
controls will have little or no effect on your app's performance. See Minimum 
Idle Instances for more information.
======

So, with min instances = auto, scheduler will start honoring Min Pending 
Latency and Max Pending Latency.

3. We set max instances = 1. This is because thats what our app needs, and 
thats what our pockets allow as of now. 

4. We set the minimum pending latency as 7.5seconds. This was chosen because, 
we felt that by waiting for 7.5 seconds there is a high likelihood that already 
serving instance will become free. We have Java with multi thread enabled,  
with average request latency is < 1 second and request rate is ~ 1 req/s.

5. We set the maximum pending latency to = 15 seconds. If for some reason app 
engine was not able to start an instance until 15 seconds ( from 7.5 seconds 
onwards), we wanted it to immediately start after 15 seconds.  

Results:

Pros:

Now, 99% of requests go to a single instance. 

Cons:

App engine does not send warm up requests for new instances  if min instances 
is not set ( don't know why). So, in the rare event that a new instance gets 
started and the request sent to the new instance, users are likely to see 20 
second delay which is our startup time. Not the most ideal scenario, but, we 
are living with this trade off at the moment.

Prashant



On 10-Apr-2012, at 10:02 AM, Jeff Schnitzer wrote:

> It doesn't work that way.
> 
> Setting max idle instances to 1 changes the number of idle instances,
> not necessarily the total number of instances.
> 
> There is no way to do what the previous poster wants to do - keep a
> single instance in the cluster so he/she doesn't have to worry about
> instance memory synchronization issues.  GAE is not designed this way.
> 
> It is possible to create a single backend that works this way,
> however.  I'm not sure how - or if - you can direct traffic from a
> "normal" domain name like www.example.com to a backend.
> 
> Jeff
> 
> 2012/4/9 András Belicza <icz...@gmail.com>:
>> If you have billing enabled, you can set the min idle instances and the max
>> idle instances separately.
>> Therefore if you sent the min and the max idle instances to 1, you will have
>> 1 instance, a resident instance at any time.
>> 
>> 
>> On Friday, April 6, 2012 1:51:44 PM UTC+2, Ijaja wrote:
>>> 
>>> Hi,
>>> 
>>> is there a way to restrict the number of instances for my application
>>> to really one?!!
>>> 
>>> Using the slider, to set maximum instances to 1 does not seem to work.
>>> I understand, that this is obvious only intended to restrict the
>>> amount i have to pay,
>>> but google spends nevertheless more instances. I want really to
>>> restrict it, because
>>> my application uses caching, which may result in inconsistent data
>>> views!
>>> 
>>> 
>>> greets, ijaja
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-appengine/-/5uwDJvTbJnAJ.
>> 
>> To post to this group, send email to google-appengine@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to