You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MultiVMWorkload interface returns a flat VMCount() total and a list of role names via Roles(). The orchestrator in cmd/virtwork/main.go divides VMCount() / len(Roles()) to determine how many VMs each role gets. This design has two problems:
No support for asymmetric role counts — a workload that needs 1 controller and 5 workers cannot express that through the current interface. Every role gets the same count.
Current implementations (network, tps) always produce even totals (config.VMCount * 2 with 2 roles), so this works today but the interface is structurally unable to support workloads with heterogeneous role requirements.
Proposed Solution
Replace Roles() []string and the flat VMCount() with a single method that declares per-role counts:
The orchestrator would iterate RoleDistribution() directly instead of dividing. VMCount() on the base Workload interface would sum the role counts (or be removed from MultiVMWorkload if redundant).
Migration path
Update MultiVMWorkload interface with RoleDistribution() []RoleSpec
Update NetworkWorkload and TPSWorkload to return []RoleSpec{{Role: "server", VMCount: N}, {Role: "client", VMCount: N}}
Update orchestrator loop in cmd/virtwork/main.go to use RoleDistribution() instead of VMCount() / len(Roles())
Problem Statement
The
MultiVMWorkloadinterface returns a flatVMCount()total and a list of role names viaRoles(). The orchestrator incmd/virtwork/main.godividesVMCount() / len(Roles())to determine how many VMs each role gets. This design has two problems:VMCount()is not evenly divisible by the number of roles, remainder VMs are silently dropped (now mitigated by a warning log added in [Bug]: Integer division truncation silently drops remainder VMs in multi-VM workloads #107).Current implementations (network, tps) always produce even totals (
config.VMCount * 2with 2 roles), so this works today but the interface is structurally unable to support workloads with heterogeneous role requirements.Proposed Solution
Replace
Roles() []stringand the flatVMCount()with a single method that declares per-role counts:The orchestrator would iterate
RoleDistribution()directly instead of dividing.VMCount()on the baseWorkloadinterface would sum the role counts (or be removed fromMultiVMWorkloadif redundant).Migration path
MultiVMWorkloadinterface withRoleDistribution() []RoleSpecNetworkWorkloadandTPSWorkloadto return[]RoleSpec{{Role: "server", VMCount: N}, {Role: "client", VMCount: N}}cmd/virtwork/main.goto useRoleDistribution()instead ofVMCount() / len(Roles())Alternatives Considered
Area
Architecture Layer
Additional Context
Related: #107 (added truncation warning as interim fix)