Slide 1

Slide 1 text

Postgres in the Container Era Postgres in the Container Era Álvaro Hernández @ahachete

Slide 2

Slide 2 text

Postgres in the Container Era @ahachete ` whoami ` Alvaro Hernandez aht.es ● Founder & CEO, OnGres ● 20+ years Postgres user and DBA ● Mostly doing R&D to create new, innovative software on Postgres ● More than 135 tech talks, most about Postgres ● Founder and President of the NPO Fundación PostgreSQL ● AWS Data Hero

Slide 3

Slide 3 text

Postgres in the Container Era @ahachete This is a journey from doubting, being scared, and avoiding to embracing, loving and needing containers

Slide 4

Slide 4 text

Postgres in the Container Era @ahachete But what about Kubernetes??? https://www.rawpixel.com/image/434575/massive-container-ship

Slide 5

Slide 5 text

Postgres in the Container Era @ahachete This is a journey from doubting, being scared, and avoiding to embracing, loving and needing containers and Kubernetes

Slide 6

Slide 6 text

Postgres in the Container Era @ahachete Containers and Kubernetes are here to stay https://dok.community/wp-content/uploads/2022/10/DoK_Report_2022.pdf

Slide 7

Slide 7 text

Postgres in the Container Era @ahachete Containers and Kubernetes are here to stay https://www.datadoghq.com/container-report/

Slide 8

Slide 8 text

Postgres in the Container Era @ahachete So what’s a container anyway? Pack once Deploy anywhere

Slide 9

Slide 9 text

Postgres in the Container Era @ahachete What is NOT a container A container is not a “lightweight” VM

Slide 10

Slide 10 text

Postgres in the Container Era @ahachete What is NOT a container A container is not a “lightweight” VM ● Well, a container is more lightweight than a VM

Slide 11

Slide 11 text

Postgres in the Container Era @ahachete What is NOT a container A container is not a “lightweight” VM ● Well, a container is more lightweight than a VM ● Well, actually a container can be a VM (but that’s not what we meant here)

Slide 12

Slide 12 text

Postgres in the Container Era @ahachete So what’s technically a container? ● Namespace isolation $ unshare …

Slide 13

Slide 13 text

Postgres in the Container Era @ahachete So what’s technically a container? ● Namespace isolation $ unshare … ● Container image / chroot

Slide 14

Slide 14 text

Postgres in the Container Era @ahachete So what’s technically a container? ● Namespace isolation $ unshare … ● Container image / chroot ● cgroups

Slide 15

Slide 15 text

Postgres in the Container Era @ahachete Yeah, but what about I/O?

Slide 16

Slide 16 text

Postgres in the Container Era @ahachete Yeah, but what about I/O? Just. Use. External. Storage https://giphy.com/gifs/KubbAndCo-simple-just-do-it-quite-really-W5Ub2lhJPWlL4iXnNL/

Slide 17

Slide 17 text

Postgres in the Container Era The problems that containers can solve for Postgres

Slide 18

Slide 18 text

Postgres in the Container Era @ahachete Extensions, extensions, extensions https://www.youtube.com/watch?v=EMldOiiG1Ko

Slide 19

Slide 19 text

Postgres in the Container Era @ahachete Option 1: the fatty container ● Size ● Security ● Restarts (downtime)

Slide 20

Slide 20 text

Postgres in the Container Era @ahachete Option 2: dynamically inject into container ● Security ● Startup time ● Approach followed in StackGres See https://aht.es/#talks-postgres_extensions_in_kubernetes

Slide 21

Slide 21 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images

Slide 22

Slide 22 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images Formula to compute all possible number of images, considering n extensions to choose from

Slide 23

Slide 23 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images Formula to compute all possible number of images, considering n extensions to choose from

Slide 24

Slide 24 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images Formula to compute all possible number of images, considering n extensions to choose from is bigger than

Slide 25

Slide 25 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images Option 3: dynamically generate container images n=10 → 252 n=200 → 9.05485146561032811654E+58

Slide 26

Slide 26 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images DEMO

Slide 27

Slide 27 text

Postgres in the Container Era @ahachete Option 3: dynamically generate container images ● acl ● hypopg ● mv_stats ● orafce ● pg_jobmon ● pg_track_settings ● pg_uuidv7 ● vector

Slide 28

Slide 28 text

Postgres in the Container Era @ahachete Can containers solve the Postgres collation issues? ● OS upgrades are painful and vendor dependent

Slide 29

Slide 29 text

Postgres in the Container Era @ahachete Can containers solve the Postgres collation issues? ● OS upgrades are painful and vendor dependent ● Containers isolate (and stabilize!) OS image

Slide 30

Slide 30 text

Postgres in the Container Era @ahachete Can containers solve the Postgres collation issues? ● OS upgrades are painful and vendor dependent ● Containers isolate (and stabilize!) OS image ● Create containers with stable collation (libc or better ICU) and deploy on any OS

Slide 31

Slide 31 text

Postgres in the Container Era @ahachete Single image, multiple OS ● Containers are (mostly) Linux-only

Slide 32

Slide 32 text

Postgres in the Container Era @ahachete Single image, multiple OS ● Containers are (mostly) Linux-only ● But Windows (and also Mac) can run (more or less transparently) Linux containers

Slide 33

Slide 33 text

Postgres in the Container Era @ahachete Single image, multiple OS ● Containers are (mostly) Linux-only ● But Windows (and also Mac) can run (more or less transparently) Linux containers ● Pack once, deploy on any OS

Slide 34

Slide 34 text

Postgres in the Container Era @ahachete Single image, multiple OS: embed container runtime DEMO

Slide 35

Slide 35 text

Postgres in the Container Era Kubernetes…

Slide 36

Slide 36 text

Postgres in the Container Era @ahachete Kubernetes is containers next level ● It’s not “that complicated”

Slide 37

Slide 37 text

Postgres in the Container Era @ahachete Kubernetes is containers next level ● It’s not “that complicated” ● Allows automation of infrastructure to unknown levels

Slide 38

Slide 38 text

Postgres in the Container Era @ahachete Kubernetes is containers next level ● It’s not “that complicated” ● Allows automation of infrastructure to unknown levels ● Operators can make extremely hard things extremely easy

Slide 39

Slide 39 text

Postgres in the Container Era @ahachete Learn more about Postgres on Kubernetes https://speakerdeck.com/ongres/where-should-i-run-my-database

Slide 40

Slide 40 text

Postgres in the Container Era @ahachete Run Postgres in Containers