如何计算不同机器上的统计数据并再次组合?

发布于 2024-07-11 23:26:15 字数 310 浏览 4 评论 0原文

我有两个提供相同功能的后端应用程序,它们位于两台单独的机器上(实际上这是为了进行负载平衡)。 因此他们使用相同的方式处理客户端前端请求。

我想收集有关所有连接的客户端的一些统计信息(即:客户端 GUI 应用程序中最常用的组件是什么或类似的组件) 并每秒将结果发送给所有客户端。

我正在考虑分别计算每个后端组件的这些统计数据,然后将两者相加,在这种情况下,我有一组选项,例如在后端组件之间进行某种通信,或者只是在全局数据库中创建小表,每个后端更新该表,然后选择并发送给其客户 但这可能会降低性能,因为我想每秒发送统计信息

我需要帮助

I have two backend applications which provide the same functions and they are located on two separate machines (actually this is to make a load balance).
So they handle the client frontend requests using the same manner.

I want to collect some statistics about all the clients connected (i.e: what is the most used component in the client GUI application or something like that)
and send the result to all clients every second.

I am thinking about calculate these statistics on each backend component separately and sum both together in that case I have set of options like make some sort of communication between backend components, or simply make small table in global DB and each backend update the table then select and send to its clients
but this may decrease the performance as I want to send the statistics every second

I need a help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

禾厶谷欠 2024-07-18 23:26:15

在我投资更复杂的解决方案之前,我需要证明任意(或随机)分配不够好。 首先对每台机器进行统计,并根据某种任意分配(当前第二台是奇数,选择机器 1,第二台是偶数,选择 2)比较它们的负载系数。 如果这不起作用,那么您可以开始寻找更好的算法。

FWIW,这正是我们在校园计算实验室中为 1000 多台机器分配默认打印机的方式。 我们在每个实验室的各种打印机上的负载是均匀分布的。

I'd need proof that an arbitrary (or random) assignment wasn't good enough before I'd invest a more complex solution. Keep statistics on each machine and compare their load factors based on some arbitrary assignment (current second is odd, choose machine 1, second is even, choose 2) first. If that isn't working, then you can start looking at a better algorithm.

FWIW, this is exactly how we assign default printers in our computing labs on campus for 1000+ machines. Our load across the various printers in each lab are evenly distributed.

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