There might be more than one reason for this:

>From the documentation 
<https://cloud.google.com/appengine/docs/python/modules/#instance_classes>:
>
> *Important:* When you are billed for instance hours, you will not see any 
> instance classes in your billing line items. Instead, you will see the 
> appropriate multiple of instance hours. For example, if you use an F4 
> instance for one hour, you do not see "F4" listed, but you will see billing 
> for four instance hours at the F1 rate.


So in your case with *F4_1G*, which costs 0.30$ per hour, rather than 0.05$ 
per hour of a *B1* instance, this is factor 6. The billings always show 
instance hours as B1, so 72 hours F4_1G translates to 432 hours B1. The 
same applies to the billing dashboard.

However, there can indeed be more instances with your setup, than the 3 you 
want, hence the "min-idle-instances":

>From the docs <https://cloud.google.com/appengine/docs/scaling>:

> Auto scaling modules use dynamic instances - but if you specify a number, 
> N, of minimum idle instances, the first N instances will be resident, and 
> additional dynamic instances will be created as necessary.


For example, if your cron job handler has an error and exponentially adds 
tasks into the queue. Or if tasks run much longer than expected, so 
additional instances are needed to handle the overlapping tasks. With your 
setup it is possible that you end up with more than three *F4_1G* instances 
during peeks, but never will fall below three. If I understand idle 
instances correctly, that means that at least three instances will be 
running that do nothing. If your cron-job starts, a fourth instance would 
be started, so there will always be three idle instances, plus the 
instances that are processing the cron-jobs.

You can limit this, either in auto-scaling (e.g. max_idle_instances 
<https://cloud.google.com/appengine/docs/python/modules/#Python_Instance_scaling_and_class>),
 
or kind of ultimately, you can set a daily budget. I recommend to check 
again the dashboard from your screenshot, just to be certain what the 
reason is for your instance hours. There is the "Summary" button on top. 
Toggle it to "Instances" diagram and switch the period to 1 day, for 
example, just to see if there were any peeks with more than 3 instances.

As far as I understand, you have no user-facing features in your app (or 
this module), but only cron-jobs? Do you expect to have always same load 
for your app or module? Maybe it doesn't matter if your cron-jobs have to 
wait a few additional seconds until a new instance is spawned (just in 
case). If the answers are all yes, you could consider basic-scaling with 
max-instances set to 3.  If you set the idle_timeout to something longer 
than your 5 minute cron-job schedule (e.g. 10m), the setup could work fine 
for your use-case.


On Friday, October 23, 2015 at 7:41:00 AM UTC+2, Naresh Pokuri wrote:
>
> I have started my GAE app with *Auto-scaling* having *min-idle-instances 
> 3*, each with 1GB RAM and 2.4GHz processor(i.e *F4_1G*). And I have a 
> cron job which runs on every 5 minutes. With this setup keeping application 
> idle for one day should equal to 72 instance hours. But I see that it 
> already reached 428 instance hours. So, I am clueless here how GAE 
> calculates instance hours, with this alone I can keep my budget in control. 
> Can someone help me in this *instance hours*
>

-- 
HATZIS Edelstahlbearbeitung GmbH
Hojen 2
87490 Haldenwang (Allgäu)
Germany

Handelsregister Kempten (Allgäu): HRB 4204
Geschäftsführer: Paulos Hatzis, Charalampos Hatzis
Umsatzsteuer-Identifikationsnummer: DE 128791802
GLN: 42 504331 0000 6

http://www.hatzis.de/

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/db24953e-1a1b-4b9c-9c4e-97d0e7e050a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to