RUN@cloud » File system access

File system access

Last modified by Nicolas De Loof on 2013/11/21 07:58

Every time you restart / redeploy / scale your application, it will start on a distinct node from fresh new environment. Such a node uses "ephemeral" filesystem: quick and large, but not persistent nor distributed on server pool.

Temporary/ephemeral filesystem access is available to your application. In a java app this is injected as the "java.io.tmpdir" system property - you can store files there as needed. Please note the following: 

  • When the application starts, it will be empty
  • When your application/hibernates/awakes it will be empty
  • When you deploy a new version of your application - the new version of the app will see it empty
  • Each instance of your app has its own directory (not shared) - so when you app scales out - each new instance will be empty

For file your application has to store a persistent way, you'll need a persistent store service, like Amazon S3. If you don't want to be tied to a provider API, you can use JClouds neutral frontend. This one can be configured to use local filesystem provide so you can test your code on local development computer and switch to S3 for cloud-deployment. A less intrusive alternative is to enable s3fs plugin, so you get a folder mapped to your S3 bucket. 

Another option is to store such files in database as BLOB.

In both case, you'll suffer S3 latency, so can take advantage for the local ephemeral filesystem as a cache, keeping a copy of all file you retrieve from S3 for quick access.

Tags:
Created by Michael Neale on 2012/02/16 00:15