Conversation
|
@twood02 we allocate and free lb->weights and lb->policy using standard malloc and free functions. However, in the previous of the code dpdk's function rte_calloc and rte_free are used. Should I edit this code to use those functions? I am not sure how to free them later in that case. |
twood02
left a comment
There was a problem hiding this comment.
Good start! I've marked a few things which can be improved.
|
|
||
| /* structures to store server weights */ | ||
| int *weights; | ||
| int total_weight; |
There was a problem hiding this comment.
your data structure here will allow us to represent weighted load balancers, but there could be other policies we could come up with in the future that might need totally different data. For now this is fine, but you should think about how you would make this data structure generic so it works for all LBs (but still allows customization by each policy in some way)
The main differences between normal malloc and rte_malloc are:
For your use case, you are allocating memory which will only be used by the LB NF and you are only doing it once when the NF starts. So it is fine to use normal malloc here. |
twood02
left a comment
There was a problem hiding this comment.
a bit more cleanup then this is ready
|
@twood02 I removed the commented code and did a final check with all policies. this should be good to go |
|
@xwedea - can you put a description of what this PR adds at the top of this page. When we make our release notes for each ONVM version we go back to the PRs to get short descriptions of each new feature. Otherwise this looks good and I will merge it into develop. Then next week we'll go through a full review process with @andreaseno's PR where he will run the NFs and demonstrate it working for me. |
|
@twood02 I put a description. |
This PR adds 2 new policies to the load balancer: Random and Weighted Random.
After this PR, there are 3 policies that can be specified in the configuration file as:
Summary:
Usage:
Merging notes:
TODO before merging :
Test Plan:
Review:
(optional) << @-mention people who should review these changes >>
(optional) Subscribers: << @-mention people who probably care about these changes >>