My main job is to write the API, so how to test the API response time, as well as the expected high concurrency server pressure?
1 The total number of API daily visits is first counted, for example a.
API generally has access logs, statistical access logs. Linux uses a similar grep WC pipeline command statistic.
2 computes the number of concurrent numbers.
How does this count? Estimate it. Here we have a principle: 80% traffic is concentrated in 20% time.
m = a*0.8/(24*0.2*3600) Gets the approximate number of concurrent m per second.
3 assume that the agreed API response can endure a maximum of B MS and test the number of concurrent times when the response time is b MS
Linux under the AB performance test, as follows (this oneself slowly try out)
Ab-c 100-n 10000 http://mixservice/shop/template?shop_id=15141
-C is the number of concurrent,-n try to set a larger.
Get the critical concurrency C when the response time is B Ms.
4 assuming 5 times times the pressure, how many servers should be needed.
5M/C (assuming that C is concurrency that can be handled by a single server)
Estimated number of API servers under high concurrency