14

I've a static html website hosted with Google App Engine Free option. I do not have any traffic to speak of as it is new site and only traffic is myself visiting the website.

I notice, with just 15 request of the homepage my frontend instance hours consumed is 5%. With this rate, I my website can serve only 300 visitors per day.

I want to know what happens when the frontend instance hours limit is reached? Will my website become unavailable to public? I read somewhere that static content is served by different servers and should still be served, as long as you don't go beyond the bandwidth limits. Is this true?

How to reduce frontend instance hours?

Bart
  • 19,692
  • 7
  • 68
  • 77
Apra Barua
  • 159
  • 2
  • 7

3 Answers3

11

Just to clarify a bit for you. You are thinking each request consumed .05/15 of your free quota. This is your fundamental error. Each request will be served by an instance of your app. You get 28 instance hours free. Each time a request is sent, if no instance is active, one will be started and it will consume 15 minutes of this quota -- even if it just services one request. However, if you app is efficient, many thousands of requests can be served by this one instance in 15 minutes. If your app is inefficient, or you have a lot of traffic, you will end up with more than one instance running at a time. If you always have 4 instances always running, you will consume 1 hour of instance quota each 15 minutes, so your site will become unavailable after 6 hours. As noted, this is when you start playing with the min/max idle instances -- you can tradeoff response time for fewer instances. In the example, let's say you adjust Min/Max Idle and let your app's response time go up, but by doing so you reduced the number of active instances from 4 back to 1. You could then keep the site up for a full 24 hours.

stevep
  • 959
  • 5
  • 8
  • Thanks. Is there any general estimate as to how much traffic can cause the frontend instance hour limit of 28hour to reach for a static html site? – Apra Barua Jun 15 '12 at 20:50
  • I mean how much traffic can a free GAE serve, if it is a static html site? – Apra Barua Jun 15 '12 at 21:05
  • Static files are handled differently that RPCs that need to be handled by your specific on-line application. Static files get delivered by Google's content network. I am not familiar enough to estimate capacities, but it certainly would be many factors higher. Plus, if your content static content is cached by ISP or locally, it may never reach GAE. – stevep Jun 16 '12 at 03:00
  • Thanks so much, I learned a lot. I am however not clear about browser cache expiration time for static files. What value should I set my html and image files? if my index html file runs java script for eg. google analytics script, can I still make it a static file? – Apra Barua Jun 16 '12 at 07:00
  • My app.yaml has - static_files: \1 – Apra Barua Jun 16 '12 at 07:15
  • My app.yaml has the code= static_files: \1 (does this mean all my files are considered static?) And to set browser cache do i enter this code in app.yaml= default_expiration: "4d 5h" (What value should I set for expiration time?) – Apra Barua Jun 16 '12 at 07:40
10

If no instance is running than a request will cause an instance to start. Instances stay up for 15 minutes after they served last request.

So, theoretically, you could make requests every 15 min, total 96 a day and use 24 hours of instance time, out of 28 free instance hours a day.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Thanks. What happens when the frontend instance hours limit is reached? Will my website become unavailable? – Apra Barua Jun 15 '12 at 15:24
  • 2
    Yes, it will start producing the 500 errors. But you can limit the number of instances to 1, then this will never happen. – Peter Knego Jun 15 '12 at 16:00
  • Thanks. Is there any general estimate as to how much traffic can cause the frontend instance hour limit of 28hour to reach for a static html site? – Apra Barua Jun 15 '12 at 20:51
  • I mean how much traffic can a free GAE serve, if it is a static html site? – Apra Barua Jun 15 '12 at 21:04
  • This depends on your page & content size. See AppEngine Quotas page. The one important for static content serving is: 1GB free per day, max 56MB / minute. – Peter Knego Jun 15 '12 at 21:19
  • Also, for static content you should set caching: https://developers.google.com/appengine/docs/java/config/appconfig#Setting_the_Browser_Cache_Expiration . This does not lower the bandwidth quota (cache counts towards your bandwidth quota), but it makes it lighter on your server instances (since request is served by cache, not your instance). – Peter Knego Jun 15 '12 at 21:22
  • Thanks so much, I learned a lot. I am however not clear about browser cache expiration time for static files. What value should I set my html and image files? if my index html file runs java script for eg. google analytics script, can I still make it a static file? – Apra Barua Jun 16 '12 at 07:01
  • My app.yaml has the code= static_files: \1 (does this mean all my files are considered static?) And to set browser cache do i enter this code in app.yaml= default_expiration: "4d 5h" (What value should I set for expiration time?) – Apra Barua Jun 16 '12 at 07:23
  • 1
    FYI you cant actually force appengine to use at most one instance. it could go over that, and with high trafic that can pause the site. You can lower the chances of that happening a lot by setting idle instances to automatic-1 and latency to the maximum. – Zig Mandel Jul 03 '14 at 03:29
1

you can change Max Idle Instances and Min Pending Latency settings to reduce creating more than one instance. set expirations for your content. (link)

pahan
  • 2,445
  • 1
  • 28
  • 36