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

Add cpu and mem limits options #65

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

endersonmaia
Copy link
Contributor

@endersonmaia endersonmaia commented Aug 21, 2024

This PR will add --cpus and --memory options for cartesi run command. This way it will be possible to define these in alignment with the production deployment values and evaluate locally if those values are enough for the application to run smoothly.

Also, it was added a hidden --dry-run to the run command, that will show the .yaml compose file in case it's needed to debug the compose file.

Copy link

changeset-bot bot commented Aug 21, 2024

🦋 Changeset detected

Latest commit: 506f441

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gbarros
Copy link

gbarros commented Aug 21, 2024

This is a 👍 change!

@endersonmaia endersonmaia requested a review from tuler August 21, 2024 18:51
@tuler tuler changed the title Feature/add cpu and mem limits options Add cpu and mem limits options Aug 21, 2024
apps/cli/src/commands/run.ts Outdated Show resolved Hide resolved
@endersonmaia endersonmaia requested a review from tuler August 21, 2024 19:07
@tuler
Copy link
Member

tuler commented Aug 21, 2024

Can you rebase to main and apply fixups?

@endersonmaia endersonmaia force-pushed the feature/add-cpu-and-mem-limits-options branch from 4c493a1 to a3e8e3a Compare August 21, 2024 19:51
@endersonmaia endersonmaia self-assigned this Aug 21, 2024
@tuler
Copy link
Member

tuler commented Aug 21, 2024

I see that the show-config option only shows the config, and don't actually run the service.
What do you think of calling the option --dry-run?

@tuler
Copy link
Member

tuler commented Aug 21, 2024

cartesi run --memory 512 --show-config

The command above produced the following output:

    deploy:
      resources:
        limits:
          memory: "536870912"

I don't know if that value is correct, as it should be a "byte value".
https://docs.docker.com/reference/compose-file/extension/#specifying-byte-values

@endersonmaia
Copy link
Contributor Author

cartesi run --memory 512 --show-config

The command above produced the following output:

    deploy:
      resources:
        limits:
          memory: "536870912"

I don't know if that value is correct, as it should be a "byte value". https://docs.docker.com/reference/compose-file/extension/#specifying-byte-values

The output is after the processing of the values.

The cartesi run --memory option should be in MB.

@endersonmaia endersonmaia force-pushed the feature/add-cpu-and-mem-limits-options branch from a3e8e3a to ea68daa Compare August 21, 2024 20:06
@endersonmaia endersonmaia requested a review from tuler August 21, 2024 20:09
@endersonmaia endersonmaia force-pushed the feature/add-cpu-and-mem-limits-options branch from 83323e1 to c3c649b Compare August 21, 2024 20:18
adds a `--dry-run` argument to `cartesi run` command so it's possible to
see the .yaml file used by docker compose to start the local infratructure
now it is possible to define limits for memory and cpu used for the
rollups-node (validator) container, the defaults are generous but can be
redefined
@endersonmaia endersonmaia force-pushed the feature/add-cpu-and-mem-limits-options branch from c3c649b to 506f441 Compare August 21, 2024 20:22
@endersonmaia endersonmaia merged commit 44c5cca into main Aug 21, 2024
2 checks passed
@endersonmaia endersonmaia deleted the feature/add-cpu-and-mem-limits-options branch August 21, 2024 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants