定义单个流程的成本
我目前正在尝试提出一些与每个客户的 Web 应用程序成本相关的业务指标。我知道我们每月为亚马逊服务器支付的价格,并且可以限制附加到该客户的进程数量。然而,一些客户拥有额外的数据,这会带来额外的数据库开销、更多的进程和更长的处理时间。计算这些成本的最佳方法是什么?由于存储非常便宜,而且更容易计算,所以我想暂时将这一部分排除在外。
#Naive Way
Customer $$ = Cost of Server/Number of Customers
考虑到一些客户比其他客户拥有更多的进程,
#Less Naive Way
Customer $$ = Cost of Server/(% of processes for that Customer)
更精确的是在每个进程、内存使用情况、系统时间等中构建一些跟踪,我应该跟踪什么?他们是否存在已经执行此操作的包? (Python 最好是我们的代码库。)
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.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果是您自己的 Python 代码,则每个进程都可以进行自己的核算。该流程收集有关自身的信息并根据客户 ID 提交到数据库。
您要寻找的指标是“CPU 时间”——进程使用 CPU 的时间。
Python 中每个进程的 CPU 使用情况
此外,您还可以获得进程 IO,包括磁盘和网络、消费,类似的方式。在 OSX 中,您应该在 stdlib 中准备好 Python 调用(但不确定)。我相信在 Windows 上你需要使用 Pywin32 扩展。
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.