R
Railway2y ago
bjorn

Question regarding memory usage in Railway.

Question regarding memory usage in Railway. My React app takes approx 2,5Gb. It seems a lot for me, but still a noob in React etc. After deploy it goes to 2,5Gb and then comes down into 1,9-2,0 range. CPU only runs when someone is doing on the app, mostly it is 0%, that one I understand. But why is memory constantly at that 2Gb+ level. Should it be like that? Also what is considered a normal memeory usage? I know hard to tell, but I dont think my app has something that special that takes so much memory. Memory usage is dependent on dependencies rigth? How to tell which one is the bad boy?
27 Replies
Percy
Percy2y ago
Project ID: N/A
Percy
Percy2y ago
The amount of RAM usage each service uses is determined by the codebase and how much traffic, jobs, and other processes are running. Garbage Collection in a container is different than on a local machine, so it is important to call GC_FREE() if you want to minimize RAM usage.
⚠️ experimental feature
Adam
Adam2y ago
Like I said in quick qs, unless you’re doing something crazy memory intense, 2gb is a lot please send a screenshot of the top of your build logs the very top, scroll up
bjorn
bjornOP2y ago
The does not do much at all, some excel like view basically thats it. data is maybe 100-200 rows at the moment @Adam can i send the log in private, I basically copy pasted all of it?
Adam
Adam2y ago
You can send it here, the build log has no personal information
bjorn
bjornOP2y ago
bjorn
bjornOP2y ago
I'm 101% confident that I'm doing something wrong ... thats the good part. That means this can be fixed 😄
Adam
Adam2y ago
doesn’t look like you sent from the top. Are you building from a dockerfile?
bjorn
bjornOP2y ago
No By "From the top" you mean what exacly ?
Adam
Adam2y ago
Scroll to the very top of the logs and send what’s there it should look like a table
bjorn
bjornOP2y ago
Thats on the top:
bjorn
bjornOP2y ago
Adam
Adam2y ago
huh okay interesting I was looking to see if your build command was in the start section, that’s a problem i’ve run into before when learning a new language for now, delete the deployment so that you don’t run up a huge bill. Someone who knows the language will be able to help you out later I don’t have any experience with react unfortunately
bjorn
bjornOP2y ago
Intresting, but when I look at deploy logs 2 things I have questions: First is why is evry row doubble and second What does this mean: Note that the development build is not optimized. To create a production build, use yarn build.
nebula
nebula2y ago
ok, so you're running the react dev server you need to use serve and serve the built production server
bjorn
bjornOP2y ago
bjorn
bjornOP2y ago
sorry noob here react what? server
nebula
nebula2y ago
the development server (the one you run locally)
nebula
nebula2y ago
Stack Overflow
How to run build version using create-react-app?
So, I developed a small React application using create-react-app. (I have always made applications from scratch.) Then, after I was kind of happy with it, I decided to run npm run build to make an
bjorn
bjornOP2y ago
Ok, is there a difference npm install -g serve serve -s build vs something with yarn ? I could get this working on local machine but I dont understand wher or how should i execute this commands The Settings Tab does not give such a place
bjorn
bjornOP2y ago
I ihave this on log: The build folder is ready to be deployed. #13 69.68 You may serve it with a static server: #13 69.68 #13 69.68 yarn global add serve #13 69.68 serve -s build #13 69.68 #13 69.68 Find out more about deployment here: #13 69.68 #13 69.68 https://cra.link/deployment Wher should I but this yarn global add serve and wher this serve -s build
Deployment | Create React App
npm run build creates a build directory with a production build of your app. Set up your favorite HTTP server so that a visitor to your site is served index.html, and requests to static paths like /static/js/main..js are served with the contents of the /static/js/main..js file. For more information see the production build section.
bjorn
bjornOP2y ago
And i read the link, did not udnerstand wher in Railway should this be but
bjorn
bjornOP2y ago
I think i finaly figured it out:
bjorn
bjornOP2y ago
Under settings I used: Build: CI=false yarn build Deploy -> Start command: npx serve -s build 132 Mb vs 2Gb kekw
Adam
Adam2y ago
Great! Glad it worked out 132mb still seems high but that might be something to do with your code rather than railway settings
bjorn
bjornOP2y ago
It is now howering in 98-100 Mb range
Adam
Adam2y ago
sounds good to me
Want results from more Discord servers?
Add your server