Hi, I have a small Remix app that reads .mdx files from the file system to generate pages. Currently, the server response time is pretty slow (> 200ms). I guess because the app reads these files from disk and disks are ‘ephemeral’. So I think I need add a disk to speed things up.
To clarify: When you add a disk, only files within that directory will persist across deploys. Files in /opt/render/project will be overwritten during the build, so a disk shouldn’t be used for that directory.
I checked where the .mdx files are located and they’re in /opt/render/project/src/content/posts but in the response above it says /opt/render/project should not be used for a disk.
Is adding a disk the right solution? If so what should the mount path for it?
An ephemeral filesystem means that the disk of a running instance isn’t persisted beyond restarts. It still has local file storage (a disk), but anything written to it after it boots would be lost the next time it’s restarted (e.g. the next deploy).
If the files you’re referring to are part of your git repo, then you likely wouldn’t need an additional disk. However, if your app has content uploaded from the client or a SQLite database, then you would need to persist it that that’s where a Render Disk would come in.
I’ve not had much personal experience with Remix, but it sounds like you’re generating the pages on-the-fly maybe this generation is where time is being lost? Is this how Remix is meant to be used in production? We have a guide on setting up Remix on Render (Deploy a Remix App), maybe comparing this config with your app may be a place to start?