pytest-xdist icon indicating copy to clipboard operation
pytest-xdist copied to clipboard

Performance Degradation in Kubernetes with pytest-xdist

Open OriMeyuhas opened this issue 1 year ago • 0 comments

I’m experiencing significant performance degradation when running tests with pytest-xdist in a Kubernetes environment compared to running them locally.

Environment Details

Local Machine:

•	CPU: 8 cores
•	Memory: 16 GB
•	Command: pytest -n 8 (all distributions are working well)
•	Running Time: 10-15 minutes
•	Screenshot: 

image

Dedicated Machine on Kubernetes:

•	Pod Configuration:
•	CPU: 24 cores
•	Memory: 48 GB
•	Resources Requests and Limits: Correctly set
•	Command: pytest -n 21 --dist=loadfile
•	If using --dist=load or --dist=worksteal, workers are getting crushed and tests fail.
•	Running Time: 35-57 minutes
•	Screenshot: 

Screenshot 2024-07-11 at 18 08 05

Despite having significantly more resources in Kubernetes, the test running time is much longer, and using --dist=load or --dist=worksteal causes failures.

I need help understanding why this performance degradation is happening and how to optimize pytest-xdist in Kubernetes.

OriMeyuhas avatar Jul 11 '24 15:07 OriMeyuhas