What is the best way to serve static image and javascript files using appengine?
From what I can see there are two methods applicable, having the files stored in the war directory of the service you are uploading, at design time. The alternative being using the blobstore, with the files being uploaded after the service has.
I see there is a 150mb restriction on the resource files in the war directory (with a 10mb limit per file), but from what I can see this is simpler, 'free' space. Is it slower than the blobstore? The dynamic nature of the blobstore is of little interest to me, so the directory seems the better option.
Can anyone offer any advice? Are my conclusions correct?
It's fine to put javascript and images files in your resources file directory on appengine. In my experience, blobstore and resource files have similar performance characteristics.
However, as site speed becomes more important it may make more sense to use a CDN to get the static files to your users more quickly.
If the static javascript is something common like jquery or jquery-ui I would recommend using google libraries API right off the bat: http://code.google.com/apis/libraries/devguide.html
The ideal way to serve static files (image, javascript, css) is to declare them using <static-files>
in appengine-web.xml
.
The opening paragraph of http://code.google.com/appengine/docs/java/config/appconfig.html#Static_Files_and_Resource_Files lays it out nicely:
Many web applications have files that are served directly to the user's browser, such as images, CSS style sheets, or browser JavaScript code. These are known as static files because they do not change, and can benefit from web servers dedicated just to static content. App Engine serves static files from dedicated servers and caches that are separate from the application servers.
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