定义单个流程的成本

发布于 2024-11-26 01:23:31 字数 476 浏览 0 评论 0原文

我目前正在尝试提出一些与每个客户的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

养猫人 2024-12-03 01:23:31

如果是您自己的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文