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 resource limits configuration capabilities for the chaincode pods #102

Open
davidfdr opened this issue Feb 21, 2024 · 6 comments
Open
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@davidfdr
Copy link
Contributor

The chaincode PODS don ´t have defined the resource limits.

Those limits can be configured in:

  1. Chaincode Artifacts - image.json;
  2. Environment Variables;
  3. etc?
@jt-nti jt-nti added the enhancement New feature or request label Feb 21, 2024
@jt-nti
Copy link
Member

jt-nti commented Feb 23, 2024

Defining resource limits definitely seems like a good idea. Configuration for the builder is done via environment variables since the chaincode package should be what is being deployed, not how it is deployed. Extra environment variables for everything you might want to configure in a pod doesn't seem like a good idea though. I'm wondering if using a ConfigMap might work, or if there is some other/better way to template pod configuration in kubernetes.

@jt-nti jt-nti added the help wanted Extra attention is needed label Feb 23, 2024
@davidfdr
Copy link
Contributor Author

davidfdr commented Feb 26, 2024

Defining resource limits definitely seems like a good idea. Configuration for the builder is done via environment variables since the chaincode package should be what is being deployed, not how it is deployed. Extra environment variables for everything you might want to configure in a pod doesn't seem like a good idea though. I'm wondering if using a ConfigMap might work, or if there is some other/better way to template pod configuration in kubernetes.

@jt-nti one question:

What is better, resource limits set by chaincode or all chaincodes runnning with the same resource limits?

If all chaincodes will be using the same resouce limits, I prefer setting this in ENVIRONMENT VARIABLES. I know that we can use config maps, but, I prefer less K8S config points and we already have the environment variables. I think that a centralized configuration point is better for the builder adoption.

If we want to have the resouce limits configured per chaincode, I think that the best location will be the image.json artifact file.

Thoughts?

@jt-nti
Copy link
Member

jt-nti commented Feb 27, 2024

Agreed, I think it does make sense to use environment variables. There are a few different options though:

  • a high level small/medium/large style setting to select between some preset resource requests and limits
  • separate environment variables for cpu/memory requests/limits
  • a single environment variable for all the requests and limits using a separator or possibly even json

Which do you think would make the most sense?

I've opened #104 to explore how to handle different settings for different chaincode in the future.

@davidfdr
Copy link
Contributor Author

davidfdr commented Feb 27, 2024

I think:

  • separate environment variables for cpu/memory requests/limits

I think that It's easiear to handle and a more direct approach.

A high level small/medium/large approach will have the need of a good documentation and explanation.

Anyway, I prefer the first two approaches. BUT, any of the three options are good to go.

@labibfarag
Copy link

how to control the Env variables value per the chaincode
chaincode A requires high CPU and memory
but chaincode B requires low memory and low CPU
if env variables are used will be the same case as all chaincodes running on the same namespace

@jt-nti
Copy link
Member

jt-nti commented Feb 28, 2024

@davidfdr separate environment variables for cpu/memory requests/limits sound good to me

how to control the Env variables value per the chaincode
chaincode A requires high CPU and memory
but chaincode B requires low memory and low CPU
if env variables are used will be the same case as all chaincodes running on the same namespace

@labibfarag I've opened #104 to investigate this kind of requirement. At the moment you would need to install chaincode A and B on different peers to be able to configure a different namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants