Scaling memory does not seem to work

Am I just missing something or is scaling not working?

I ran fly scale memory 512 a long time ago. It’s showing in fly scale show but it’s not reflecting in the VM. The printenv is still showing 1024MB. Scaling up also doesn’t seem to work. Running fly scale memory 2048 also doesn’t work. No new VMs get created, when I run fly status --watch, nothing changes. No new VMs get added, the original VM does not get killed. What’s up with this? :frowning:

➜  salonbase git:(master) ✗ fly scale show -c infra/app.toml
VM Resources for salonbase
        VM Size: shared-cpu-1x
      VM Memory: 512 MB
          Count: 1
 Max Per Region: app=0 web=0 worker=0
➜  salonbase git:(master) ✗ fly ssh console -c infra/app.toml
Connecting to top1.nearest.of.salonbase.internal... complete
/ # printenv | grep FLY_VM_MEMORY_MB
FLY_VM_MEMORY_MB=1024

P.S. is this a cheat code to be billed much less than I am actually using? :smiling_imp::stuck_out_tongue:

2 Likes

Grafana has also been showing 1024:

Apparently, there was a bug which should have been since fixed. Did you try the scale cmd again, and it still didn’t work?

Nope, still not working.

fly status goes from Status = successful to Status = Deploying to Status = Deployment completed successfully. Yet when I SSH into the machine it still shows the old memory amount.

This is very strange!

Could you scale to 256 or 2048 then try scaling to 512 again after that first scale is complete and post the output of all the commands?

Sure, starting state is:

(that’s where it’s already out of sync btw)

➜  salonbase git:(master) ✗ fly scale memory 2048 -c infra/app.toml
Scaled VM Memory size to 2 GB
      CPU Cores: 1
         Memory: 2 GB

This almost immediately returns btw. Now back to 512:

➜  salonbase git:(master) ✗ time fly scale memory 512 -c infra/app.toml
Scaled VM Memory size to 512 MB
      CPU Cores: 1
         Memory: 512 MB
fly scale memory 512 -c infra/app.toml  0.05s user 0.01s system 9% cpu 0.677 total
➜  salonbase git:(master) ✗ fly scale show -c infra/app.toml
VM Resources for salonbase
        VM Size: shared-cpu-1x
      VM Memory: 512 MB
          Count: 1
 Max Per Region: app=0 web=0 worker=0

➜  salonbase git:(master) ✗ fly ssh console -c infra/app.toml
Connecting to top1.nearest.of.salonbase.internal... complete
/ # printenv | grep FLY_
FLY_PUBLIC_IP=2605:4c40:119:c6b2:0:a637:3710:1
FLY_VM_MEMORY_MB=1024
FLY_SSH=1
FLY_ALLOC_ID=a6373710-947f-4a76-6dac-78fa142714fe
FLY_REGION=ams
FLY_APP_NAME=salonbase
FLY_VCPU_COUNT=1

Does your app config have a [processes] section by chance? If you’re using process groups, you need to scale memory for each individually:

fly scale memory 2048 -c infra/app.toml --group worker

We should definitely return an error in this state, probably a quick fix.

That might be it!

Anyway, that’s a funny case then, because I don’t have [processes] anymore. I used to have them for app and worker but I switched to using supervisord to run my app & worker at the same time.

They are still showing in the UI though:

I just tried it and it works. Thanks!

Ah that’s a fun edge case. We will clean that up. :slight_smile:

2 Likes

@kurt is there a way for me to remove the groups?

I second that question @kurt :sweat_smile:

I switched from a 2 group to a single one, and now I have 3 :see_no_evil:

Im having a similar issue with mysql. I followed the documentation here on fly for setting up mysql and im on the last step where it tells me to scale my memory if im using mysql 8+ and I get the error:

failed to grab app config from existing machines, error: could not create a fly.toml from any machines :frowning:
No machines configured for this app

We might need to revisit those docs.

You can change (or add) the Machine memory in the fly.toml file before you deploy:

[[vm]]
memory = 2048
1 Like

Yeah I found the Issue. The documentation says to add memory before even making the machine so I had to deploy first so the docs are just out of order in that case. You have to deploy and then you can add memory for the MYSQL setup.

1 Like

That’s another way of doing it for sure, glad you figured it out!

If anyone runs into the case where they can’t deploy without upping the memory: you can use the [[vm]] settings in fly.toml before deploying for the first time.

1 Like