Software performance testing is implemented by simulating normal,peak and abnormal load conditions to test various performances of the system, it is a typical resource intensive operation. Cloud computing provides a new application model for software performance testing, the testing users(tenants) dont have to deploy and manage a huge number of load generation servers or expensive test software,but use performance testing service via browser and pay according to the time and the amount of test resources. Performance testing based on cloud computing can shield the management complexity of software and hardware test resources,but elastic supply and multi - tenant sharing of test resources still face technical challenges. This paper analyses the relationship between resource requirement of performance testing and test scripts and loads, and proposes the lightweight container technology-based elastic management mechanism for testing resource, and implements it in Bench4Q,which is an open source performance testing tool,as well as conducts experimental analysis. Results show that the proposed method can estimate accurately the test resource the tenants needed, and achieves the elastic resource allocation, raises the resource utilisation rate.