Skip to content

Conversation

@eraykaradag
Copy link

Old PR: eraykaradag#1

This PR introduces a new allocator service that enables granular resource allocation for multiple enclaves, implemented in Rust for improved error handling and user experience.

Changes

  • Implemented per-enclave resource allocation using sysfs
  • Enhanced configuration format supporting multiple enclave definitions
  • Maintained backward compatibility with existing configurations

New Configuration File Format
allocator.yaml:

- memory_mib: 1024
  cpu_count: 2  
- memory_mib: 512
  cpu_pool: 2,6

Key features:

  • Supports concurrent cpu_count and cpu_pool usage
  • All resources are allocated within the same NUMA node
  • Prevents resource overallocation by nitro-cli

Testing Done

  • Verified backward compatibility
  • Tested on ARM and x86_64 instances
  • Validated on multi-NUMA instances
  • Added unit tests with sysfs mocking
  • Created CTS test case for user-reported issues
  • Enhanced MultiSanity payload tests

Notes

  • No changes required to nitro-cli resource manager
  • Improved error messages guide users through allocation failures
  • Maintains strict resource isolation between enclaves

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eraykaradag eraykaradag force-pushed the allocator-approval branch 4 times, most recently from a2ccc54 to ed5a91d Compare May 13, 2025 17:36
I have added unit tests to cover general functionality of allocator service. Tried to mock SysFs files to check if it will work or not. Also i have added documentation for functions to explain general functionality.
…izing strings

I changed error type with anyhow. Tried to add more information to error messages. Also found an error with serde with deserializing numbers into string when user provides pool of cpus. fixed it with implementing separate deserializer logic.
Changed makefile to build allocator as a separated binary. Since binary and the bash script has the same the allocator.service will pick up the new one.
…for NITRO_CLI_INSTALL_DIR env variable. It fails to read config file if env variable is not exist.

If env variable not exist then allocator will try to find the config file in / directory. Tried to build everything manually i bumped into this error in amazon linux and ubuntu instances. Also legacy allocator has the same mechanism but it was not failing. it was failing in Rust so i had to add a sanity check.
…nd also every documentation to guide how to build the allocator

Since the new allocator is a binary i put it's build flow with the nitro-cli and vsock-proxy. Also added to the how to install and setup nitro-cli documentations.
@eraykaradag eraykaradag force-pushed the allocator-approval branch from ed5a91d to 466fa8a Compare May 13, 2025 17:48
@eraykaradag eraykaradag marked this pull request as ready for review May 14, 2025 08:28
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.

2 participants