robusta-dev / krr

Prometheus-based Kubernetes Resource Recommendations
MIT License
3.05k stars 160 forks source link

About memory requests and limits calculation #324

Closed GregVes closed 3 months ago

GregVes commented 3 months ago

Good morning,

First, thanks for your tool, this is of a precious help for right-sizing our clusters. Your documentation says that

For memory, we take the maximum value over the past week and add a 15% buffer.

But is it for memory request or limit ? It seems to be for both since the value in the recommendation is always the same for us Screenshot from 2024-08-07 08-57-23

Simple Strategy                                                                                                                                                                             

CPU request: 95.0% percentile, limit: unset                                                                                                                                                 
Memory request: max + 15.0%, limit: max + 15.0%                                                                                                                                             
History: 336.0 hours                                                                                                                                                                        
Step: 1.25 minutes  

Is it expected or am I missing something?

Thanks!

GregVes commented 3 months ago

Ah nevermind, you guys explained it in the following post https://home.robusta.dev/blog/kubernetes-memory-limit

aantn commented 3 months ago

Yep, exactly! Let me know if you have further questions!

On Wed, Aug 7, 2024 at 12:39 PM Grégory Vespasien @.***> wrote:

Ah nevermind, you guys explained it in the following post https://home.robusta.dev/blog/kubernetes-memory-limit

— Reply to this email directly, view it on GitHub https://github.com/robusta-dev/krr/issues/324#issuecomment-2273051684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYUB63PYPW732SIFN7SVDZQHTOLAVCNFSM6AAAAABMDX5O46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTGA2TCNRYGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

GregVes commented 3 months ago

For those reading this issue, see the example a k8s maintainer gives to justify memory request = memory limit

Screenshot from 2024-08-07 12-24-49

So KRR idea to calculate memory request/memory as "peak usage + 15%" buffer" makes sense as it ensures a predictable resources consumption and gives room for the pod in case of intensive load.

aantn commented 3 months ago

Yes!

On Wed, Aug 7, 2024 at 1:26 PM Grégory Vespasien @.***> wrote:

For those reading this issue, see the example a k8s maintainer gives to justify memory request = memory limit

Screenshot.from.2024-08-07.12-24-49.png (view on web) https://github.com/user-attachments/assets/c9725978-1385-4f2a-885b-5611a943998f

Makes sense, indeed

— Reply to this email directly, view it on GitHub https://github.com/robusta-dev/krr/issues/324#issuecomment-2273140779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYUBYVG6ZKRLGTAIMOMGDZQHY4NAVCNFSM6AAAAABMDX5O46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTGE2DANZXHE . You are receiving this because you commented.Message ID: @.***>