Search code examples
12factor

Why cloud application's file system is ephemeral


The "Beyond 12 factor APP" and "Considerations for Designing and Running an Application in the Cloud "(https://docs.cloudfoundry.org/devguide/deploy-apps/prepare-to-deploy.html) states file system is ephemeral. However I got different result when testing with openstack:

  1. create VM using openstack server create with centos qcow2 image, no external storage

  2. ssh to the VM, create file under /home/centos

  3. reboot VM

  4. after VM startup, the file is still there.

Did I understand something wrong?

quote from the book:

  1. cloud-friendly applications don’t just run in the cloud;they embrace elastic scalability, ephemeral filesystems

  2. in the "Logs" chapter: Cloud applications can make no assumptions about the file system on which they run, other than the fact that it is ephemeral.

quote from "Considerations for Designing and Running an Application in the Cloud " : "Avoid Writing to the Local File System": "Local file system storage is short-lived."..."When an application instance crashes or stops, the resources assigned to that instance are reclaimed by the platform including any local disk changes made since the app started. When the instance is restarted, the application will start with a new disk image. Although your application can write local files while it is running, the files will disappear after the application restarts."


Solution

  • The meaning is that when running containerized applications you can't trust the file system to be longed lived between restarts, as it may be purged, or you might be running next time on a different instance.

    It doesn't mean the data is guaranteed to disappear - just that it isn't guaranteed to stay - very much like a temp folder on a regular server