To persist or not to persist container data

  • Slides: 19
Download presentation
To persist, or not to persist (container data), that is the question John Griffith,

To persist, or not to persist (container data), that is the question John Griffith, Solid. Fire Kenneth Hui, Rackspace Shamail Tahir, IBM

Presenters Kenneth Hui Open. Stack Evangelist Rackspace @kenhuiny

Presenters Kenneth Hui Open. Stack Evangelist Rackspace @kenhuiny

What’s To Know About Container Persistence?

What’s To Know About Container Persistence?

What is a container? Defines available operations, exec environment, FS setup, resource reservations, etc.

What is a container? Defines available operations, exec environment, FS setup, resource reservations, etc. Container Format LXC run. C (libcontainer) Filesystem OS Features Union. FS namespaces Used to provide container specific view of the system (isolated PID, net, user, etc. namespaces) Image Container R/W Layer (0 MB) Layer 2 (6 MB) Changes made to the running containers are stored in R/W layer Layer 1 (120 MB) cgroups Cgroups are used to limit resources available to the container (RAM, CPU, Block I/O) Images consist of read-only layers that create the aggregated contents/config of container at initialization

Introduction to micro services… UI API UI UI API Container Application Logic Database Logic

Introduction to micro services… UI API UI UI API Container Application Logic Database Logic X Logic Y Logic Z Container Single Instance Data Container Monolith Microservices Architecture

…So why a whole session on persistence? This service is stateless and I don’t

…So why a whole session on persistence? This service is stateless and I don’t care if the data goes *poof* Container R/W Layer Data in this layer is ephemeral and will be discarded when the container is terminated I will create a new image to retain the new content ┬─┬� ノ( ゜-゜ノ) I’m sure there are better ways to maintain persistence

Numerous persistence options Local Storage Container Host Remote Storage Container Host Distributed Storage Container

Numerous persistence options Local Storage Container Host Remote Storage Container Host Distributed Storage Container Host Data stores Container Host SDS Database Dedicated Storage

So You Want Container Storage: Do’s and Don’ts

So You Want Container Storage: Do’s and Don’ts

Are you sure you are doing this right? ONE DOES NOT SIMPLY ATTACH STORAGE

Are you sure you are doing this right? ONE DOES NOT SIMPLY ATTACH STORAGE TO A CONTAINER • Don’t treat your containers like lightweight virtual machines • Don’t attach volumes to all your containers • Don’t use traditional SAN Storage

Don’t treat your containers like lightweight VMs • Large images are anchors • Containers

Don’t treat your containers like lightweight VMs • Large images are anchors • Containers shouldn’t be treated like pets

Don’t attach volumes to all your containers • You lose benefits of ephemeralness •

Don’t attach volumes to all your containers • You lose benefits of ephemeralness • You reduce your elasticity

Don’t use traditional SAN storage • You limit your scalability • You create SPOF

Don’t use traditional SAN storage • You limit your scalability • You create SPOF

There is a better way to do this • Do use loosely coupled backend

There is a better way to do this • Do use loosely coupled backend services • Do use persistent storage only when necessary • Do use distributed storage

Do use loosely coupled backend services • Use object storage for file data •

Do use loosely coupled backend services • Use object storage for file data • Use DB-as-a-Service for data stores

Do use persistent storage only when necessary • Focus on keeping containers stateless •

Do use persistent storage only when necessary • Focus on keeping containers stateless • Use for data stores that may be difficult to replicate

Do use distributed storage

Do use distributed storage

Adding Persistent Storage To Your Containers

Adding Persistent Storage To Your Containers

Demo

Demo