speedplane
speedplane

Reputation: 16121

How to Change the Size of /dev/shm in App Engine Flexible

How do you change the size of the shared memory folder /dev/shm in an App Engine Flexible app?

By default it is set to 64M, too low to run many apps (e.g., chrome). I don't see any way to change it. There are ways to change it if you have access to the docker run command, but we don't have such access when launching app engine flexible apps.

Upvotes: 5

Views: 2339

Answers (2)

posit labs
posit labs

Reputation: 9431

A: No.

Unfortunately this isn't possible (yet?) with appengine. More than a few people have run into this issue. For some reason, the container default for /dev/shm is crazy small.

...but there are other options

If the process you want to run has the ability to configure the location of the tmpfs it uses, then you can create a tmpfs and simply point it there. Chromium can't do this.

Option 1

If you want to deploy a container to google cloud, one option is to use container engine. You can then mount a tmpfs volume to your pods like this:

spec:
  volumes:
  - name: dshm
    emptyDir:
      medium: Memory
  containers:
  - image: gcr.io/project/image
    volumeMounts:
      - mountPath: /dev/shm
        name: dshm

Kubernetes has a fairly steep learning curve, but it will allow you to uncap the limit on /dev/shm.

Option 2

There is a new feature that will allow you to deploy containers to compute engine, but it's currently in alpha and you will need to apply to have your project whitelisted to use this feature.

Option 3

Of course, you could deploy containers to GCE in a more manual fashion by creating a GCE instance using COS (container optimized os)


Update from speedplane's comment

Option #4

If the goal is to run a full browser on app engine flexible, then the new versions of Firefox run in headless just fine in Docker.

Upvotes: 3

speedplane
speedplane

Reputation: 16121

This is the answer I received from Google Support (support ID 13757624):

I understand that you have inquiry if it would be possible to increase the size of /dev/shm in App Engine Flex.

Unfortunately, this isn't possible. Since Flex is managed VM the default value is maintained. You may try to create manually a command on your dockerfile to change the shared cache via 'sudo' but there's no guarantee so I can't say that it will possibly work, still worth a try given that you are using custom runtimes otherwise, there's no other way.

Upvotes: 2

Related Questions