Written by
Simon Daniel Moser (smoser@de.ibm.com) - Distinguished Engineer for Containers @ IBM Cloud
Enrico Regge (reggeenr@de.ibm.com) - Software Architect @ IBM Cloud
----------------------------------
IBM Cloud Code Engine is IBM Cloud’s all‑purpose serverless platform, capable of running 12-factor web apps, functions, batch jobs, and general containers (this collection is called compute variants in the further course of this article). However, until recently, Code Engine had one shortcoming: All its compute variants could only save data by writing to a database or using Cloud Object Storage (COS) through an API; mounting a persistent filesystem wasn’t possible.
Just recently, we wrote a blog using JupyterLab as an example where this limitation got in our way. JupyterLab is a popular tool for data scientists, and Code Engine makes it easy and cost‑efficient to run. But any data stored inside the Jupyter notebook environment lived only on the container’s ephemeral disk. When the app scaled down (a very common and intended use case for serverless computing), that data disappeared—far from ideal.
Now, as mentioned above, you could e.g. call some Cloud Object Storage API to persist that data, but that doesn’t work for software like JupyterLab where you can’t modify the source code to integrate such calls. For these “as‑is” applications, containers, or jobs, filesystem mounts are essential. They let you expose persistent storage directly into the filesystem, and using COS‑backed mounts aligns well with serverless patterns because COS itself is serverless as well, meaning the storage costs scale with the usage.
There are, however, scenarios where COS mounts aren’t ideal—for example, low‑latency, highly concurrent workloads like relational databases. Object Storage has higher latency and offers no coordination for concurrent writes. The Code Engine documentation lists more things to watch out for and covers these considerations in more detail. But for our Jupyter use case, none of these limitations matter, so let’s look at what the new persistent storage capabilities offer and how to use them.
Before diving in, let’s briefly review the system architecture of the sample. Figure 1 shows all required resources: