Need help with suggested plan/cpu/scale to start.

I’m looking to put my main app on fly.io but I don’t have any exp with VM’s and auto-scaling etc. I’m wondering if I could get a couple of suggestions on what to start with for my site. I currently get about 5-10k page views a day from mostly North America and a smaller percentage in Europe/Japan. Avg time on site is about 3min as well. Any given time there is about 20-30 people on the site at once, and when we run big promotions that jumps to 200-300. Wondering what CPU/memory setup would be best for this? What type of balance scale with min/max counts?

Thanks for any help in learning!
Spencer

What tech stack are you running? Assuming the 5k-10k page views are spread out over a few hours it sounds a small VM with a single dedicated CPU should be fine — the RAM will probably depend on the language and library.

I have a Rails app that I run with shared-cpu-1x / 512 MB RAM (single worker process). And Go apps work fine with 256MB RAM unless they’re loading up a lot of data (images in my case) to process. Most of the compiled languages will often fit in 256 MB, with maybe 512MB for Ruby or Python and 1GB or more for Java/JVM.

You’ve noted the balanced scaling strategy will work already, but I’d look at where the data is as well — if your application servers run far away from the database and try to read/write multiple times you’ll see reduced performance.

1 Like

@sudhir.j - Thanks for the help! My stack is a JS framework called Remix (its React frontend, and node backend). My DB is actually a wordpress site converted to headless hosted on WPEngine, so I’ll need to contact them and see if I can get an idea of where the DB’s are located to switch up my Regions list.

Right now the app is in a basic skeleton configuration with working features but zero styling and it takes up about 190mb-200mb roughly.This blog will though be image heavy once it’s finished, however the images will be served via a CDN if that helps.

Yes the 5-10k page views is over a like 18hour time frame so nothing crazy.

One other thing I’m trying to figure out is the min max scaling counts for apps. How many can I scale up with a dedicated CPU? 10? Does increasing the scale cost extra money or is it just a matter of how much work you’re giving the cpu?

Thanks again!

You probably don’t need a dedicated CPU for a Remix app. The shared-cpu-1x works great for the biggest Remix apps I’ve seen on Fly. I’d just try it with that size first.

If you want to add RAM, you can run fly vm scale shared-cpu-1x --memory 1024. Adding RAM or changing to dedicated CPUs does increase the price: Fly App Pricing

The min/max scale control how many VMs we’ll launch for you at a time. We bill per VM while it’s running, so if you set a max of 10 and your app scales to 10, you’ll be paying for 10 VMs until it scales back down.

Are you connecting to the wordpress DB directly or communicating through an API?

@kurt Super helpful man thank you for the support. Right now I’m grabbing data from Wordpress DB using graphql. Only cus thats the only way I know how to do it. Is there another way to set it up so it’s not an api call and a direct communication?

I think GraphQL is probably the best way to do that! The good news is, if you can do most of the API work in one request from Remix, you should be able to run your Remix app in many different regions and ease your way into regional caching.

Interesting. Right now I’d say it’s pretty straight forward, home page gets the first 10 posts and then you can scroll/ fetch another 10 and so on. Then each post lives on its own url and fetches the specific post data that way. To speed these requests up I’ve hooked up the DB to something called GraphCDN that can cache the graphql query for a certain amount of time or until I purge it using an api( like when I update a post or publish a new one.)

I’ll need to do some research on regional caching - that sounds interesting. Basically I can cache the whole site for a week until the next post publishes, but I would need control over it in case I have a typo or some images changes for example to clear it.

If you’re using GraphCDN, you probably don’t need to do regional caching on Fly to start. That seems like a pretty nice setup that’ll let you run things anywhere you want.

Cool - Thanks for all the help I think I can get started as soon as I figure out how to add new regions to my app. I know the command, but where do I see a full list of regions so I know what the region code is to add a certain area?

You can run fly platform regions to get a list of available regions. The best way to do this is to pick the ones you care about, run fly regions set ..., and then run fly scale count X --max-per-region=1. This will put one VM per region (without the max region limit, they can clump up).

Awesome man - this worked great. Again thank you for all the information and help!!

Once I decide to upgrade from the free tier, should I set my scale to balanced with a min count to 3 and a max count to something like 10? For the 3 or 4 regions I have selected?

Edit: Also I just noticed I did the --max-per-region=1 at the end and then typed fly scale show, and it’s still saying Max Per Region: Not set