开发者

Estimate server load for an API

开发者 https://www.devze.com 2023-02-01 15:34 出处:网络
I want to know how many resources (MySQL time, CPU usage, bandwidth, etc.) will use my system with a certain number of API calls per second.

I want to know how many resources (MySQL time, CPU usage, bandwidth, etc.) will use my system with a certain number of API calls per second.

One API call gets the parameters in PHP开发者_Python百科, do from 1 to 5 SQL queries and returns a XML file.

How I can do that? Any idea of a formula or something?


Try using the xhprof PHP extension to do some profiling. It will tell you things such as how much time is spend on each function call, memory used, CPU used, etc. Do a few runs with it and you should have a good idea about the resources you are using. I've found it to be one of the most useful tools available in PHP. For more info, see the this documentation.


The only real way to do this is by benchmarking it. It depends entirely on what your code is doing - I could write an SQL query that takes minutes to run, and I could write an SQL query that takes milliseconds.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号