开发者

Define the Cost of a single process [closed]

开发者 https://www.devze.com 2023-03-22 16:13 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I am currently trying to come up with some business metrics related to how much my web application costs per customer. I know the price we pay per month for servers on amazon and can delimit the number of processes attached to that customer. However, some customers have extra data which incurs extra database overhead, more processes and longer processing. What is the best way to calculate these costs. Since storage is so cheap, and easier to calculate, I want to leave that piece out of the equation for now.

#Naive Way
Customer $$ = Cost of Server/Number of Customers

Factoring in that some customers have more processes than others

#Less Naive Way
Customer $$ = Cost of Server/(% of processes for that Customer)

More precise would be to build some tracking into each process, memory usage, system time etc What should I track and does 开发者_如何学运维their exist a package that does this already? (Python preferably as that is is our code base.)


If it's your own Python code it is possible for each process to do it's own accounting. The process collects information about itself and submits to the database under the customer id.

The metric here what you are looking for is "CPU time" - how much the process has been using CPU.

CPU Usage Per Process in Python

Also you can get process IO, both disk and network, consumption, in the similar manner. In OSX you should have ready Python calls for these in stdlib (not sure though). On Windows you need to use Pywin32 extensions I believe.

0

精彩评论

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