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
Project ID:
N/A
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
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
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?
You can send it here, the build log has no personal information
I'm 101% confident that I'm doing something wrong ... thats the good part. That means this can be fixed 😄
doesn’t look like you sent from the top. Are you building from a dockerfile?
No
By "From the top" you mean what exacly ?
Scroll to the very top of the logs and send what’s there
it should look like a table
Thats on the top:
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
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.
ok, so you're running the react dev server
you need to use
serve
and serve the built production serversorry noob here react what? server
the development server (the one you run locally)
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
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
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.
And i read the link, did not udnerstand wher in Railway should this be but
I think i finaly figured it out:
Under settings I used:
Build: CI=false yarn build
Deploy -> Start command: npx serve -s build
132 Mb vs 2Gb
Great! Glad it worked out
132mb still seems high but that might be something to do with your code rather than railway settings
It is now howering in 98-100 Mb range
sounds good to me