omec-project / upf

4G/5G Mobile Core User Plane
178 stars 106 forks source link

Use all available cores #781

Closed markbeierl closed 1 month ago

markbeierl commented 6 months ago

When determining what cores are available, we should use the total number from the system, not from the current process

Addresses #780

omecproject commented 6 months ago

Can one of the admins verify this patch?

gab-arrobo commented 6 months ago

@markbeierl, have you tested the behavior of this PR when deploying multiple UPF instances in the same host?

markbeierl commented 6 months ago

Yes, I have tested it, and repeated tests show my affinity staying at [1-15] instead of increasing with subsequent runs.

markbeierl commented 6 months ago

Although, to note, we have no method of controlling the UPFs affinity when there is more than one on the physical host, so they both fight for processor 0 in that case.

gab-arrobo commented 3 months ago

@sureshmarikkannu, please review this PR. Thanks!

gab-arrobo commented 3 months ago

@markbeierl, you may need to rebase your PR and make the commit(s) appending the -s flag to pass the DCO check

sureshmarikkannu commented 2 months ago

@markbeierl , Sorry for the delayed review. I want to test multiple scenarios to understand the impact of this change and also want to understand the UPF behavior when we deploy multiple instances of UPF. Please find my observations below,

  1. performance tests with single UPF instance: I run TCP/UDP tests with this patch and all looks good, no issues observed.
  2. performance tests with multiple UPF instance: I do see that the same core was assigned for both UPF instances (bess worker threads) which impacts the throughput. Also please note that i do see same behavior without this patch as well (which means psutil.Process().cpu_affinity() returns the entire set of CPU's available in the system).

So in summary when we scale the UPF, we need to utilize the core's carefully in order to not intersect with other UPF's. We need to use specific set of cores per instance (maybe based on the cores allocated for the UPF pod) for allocating the worker threads.

@gab-arrobo, @markbeierl Let me know your thoughts.

gab-arrobo commented 1 month ago

close as explained in #780