根据负载和概率发送文件以转换到负载最小的服务器(在 php 中)
我有几个 ffmpeg 处理服务器来转换视频文件。我有一个轮询器,它从这些服务器获取平均负载,并每 5 分钟更新一次 mysql 表。
我只能说...给我负载最低的服务器,但问题是,在这 5 分钟内,它可能会在那 1 台服务器上排队 20 个要转换的文件,而其他服务器可能会在 10 分钟内释放,将会闲置。
所以我想在选择负载最少的服务器时添加一个概率方面的内容,这样负载最少的服务器就有很高的机会被选中,但其他服务器仍然会得到一些东西。
I have several ffmpeg processing servers that do conversions of video files. I have a poller that grabs the load averages from these servers, and updates a mysql table with them, every 5 minutes.
I could just say... give me server with lowest load, but the problem with that, in those 5 minutes, it might queue 20 files to be converted on that 1 server, while the other servers which might free up in 10 minutes, will be idle.
So i wanted to add a probability aspect to the selection of the least loaded server, so the least loaded server has a high chance of getting selected, but other servers will still get something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来你好像在倒退。不要根据过时的数据猜测哪个服务器可用于将作业推送到,而是将作业排队并让服务器在实际可以工作时提取它们。
Sounds like you're doing this backwards. Instead of guessing what server is available to push jobs to based on stale data, queue the jobs and let the servers pull them when they're actually available to work.