Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rw deploy render redundant api processes causing server to exceed mem limit #4278

Merged
merged 20 commits into from
Feb 2, 2022

Conversation

thedavidprice
Copy link
Contributor

@thedavidprice thedavidprice commented Jan 27, 2022

fixes #4271

TODO:

  • Release Notes: add 1.0.0 deprecation notice for rw-api-server binary; use rw-server api instead

Render Deploy API Server < 500MB Mem

Now uses imports from the api-server package to programatically start fastify without spawning or running another RW CLI command (which was the root cause of multiple running processes). Total process mem < 225MB.
run yarn rw deploy render api
Screen Shot 2022-01-28 at 11 06 27 PM
process memory
Screen Shot 2022-01-28 at 11 10 23 PM

Additionally I cleaned up a few things with the setup deploy render and deploy render commands.

api-server console output

The console outputs for apiServerHandler, webServerHandler, bothServerHandler weren't consitent and didn't always make sense to me. I've updated them accordingly:

bothServerHandler aka yarn rw serve

Screen Shot 2022-01-29 at 8 12 21 AM

apiServerHandler aka yarn rw serve api

Screen Shot 2022-01-28 at 11 14 01 PM

webServerHandler aka yarn rw serve web

Screen Shot 2022-01-28 at 11 14 48 PM

New api-server bin in `package/api-server/package.json

Previously the serve api process could be run via bin, e.g. yarn rw-api-server. It made sense to me to add a bin that would handle running api, web, or both.

This is now possible via yarn rw-server:

  • Sides: defaults to both, takes api or web
  • Options: take the api-server options for api (port, socket, apiRootPath), web (port, socket, apiHost), or both (port, socket)

@thedavidprice thedavidprice changed the title fix rw deploy render redundant api processes that exceed mem fix rw deploy render redundant api processes causing server to exceed mem limit Jan 27, 2022
@thedavidprice thedavidprice added the release:fix This PR is a fix label Jan 27, 2022
@thedavidprice
Copy link
Contributor Author

thedavidprice commented Jan 27, 2022

This is close. Having an issue with Yargs (specific to deploy render command) that's been challenging to diagnose.

Ready 🚀

@Tobbe
Copy link
Member

Tobbe commented Jan 29, 2022

Nice work @thedavidprice! Can't wait to take this for a spin on my own Render deploy!

@crcastle
Copy link

Awesome work @thedavidprice! I may not have time to check it out this weekend, but I will on Monday or Tuesday for sure. cc @SEANDOUGHTY

Copy link
Collaborator

@dac09 dac09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just have to merge and take it for a spin

@thedavidprice
Copy link
Contributor Author

re:

either way, we should update the setup deploy render to set apiUrl to "/" to be consistent (logically) with the API path during production deploy. (Again, I understand it's not applicable mechanically. But in all other cases we update to match what the deploy host provider is going to use for the API path — so I'm just suggesting consistent behavior.)

I'm unable to do this due to this bug #4352

Skipping so I can get this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rw deploy render api command results in 2x running processes and > 500MB mem usage
6 participants