We have a web application in App Engine. I was wondering whether it is a good idea to move my static resources (i.e Images, CSS files, and JS files) out from App Engine and serve them from Google Cloud Storage.
My thinking here is two-fold:
1) We can get the advantages of a CDN with Google Cloud Storage. We can even configure metadata for each file to set expiration headers, gzip compression, etc. Also, by serving files from different domains we can have browsers download more content in parallel.
2) By off-loading some of the files from App Engine, the instance consumption is going to decrease (less requests to App Engine), so the costs will go down.
Am I right? Is this a wise move?
Thanks,
While App Engine supports many different services within a single application, Cloud Functions support individualized services. It's an important detail when comparing Google App Engine vs Cloud Functions. If your requirements don't include multiple services then Cloud Functions is a great choice.
When App Engine receives a request for a URL beginning with /static , it maps the remainder of the path to files in the ./public directory. If an appropriate file is found in the directory, the contents of that file are returned to the client. The /. * handler matches all other URLs and directs them to your app.
Google App Engine is designed for smaller applications and is used for developing web applications. PRO TIP: No, Google App Engine and Google Cloud are not the same. Google App Engine is a platform as a service (PaaS) that provides a runtime environment for web applications written in Python, Java, or Go.
Google App Engine makes it easy to use the platform, which offers the flexibility to focus on other concurrent web applications and processes. The best part is that GAE automatically handles the traffic increase through patching, provisioning, and monitoring.
Your intuition is right, here's the confirmation from Google docs:
The benefits of using Cloud Storage instead of serving directly from your app include:
Cloud Storage essentially works as a content delivery network. This does not require any special configuration because by default any publicly readable object is cached in the global Cloud Storage network.
Your app's load will be reduced by offloading serving static assets to Cloud Storage. Depending on how many static assets you have and the frequency of access, this can reduce the cost of running your app by a significant amount.
Bandwidth charges for accessing content can often be less with Cloud Storage.
Know that static files are definitely served using instance resources. It's true that edge cache comes into effect, but this does not simply remove the whole problem. Moving statics to GCS is the right way of doing this.
Note, however, that if you plan to serve your static files from GCS, you won't be able to properly map a (sub)domain to it over HTTPS (SSL) and you'll have to use a load-balancer or 3rd party CDN. In some cases this may prove to be more of a hassle. See here for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With