dty5753 2012-07-25 08:01
浏览 38
已采纳

将文件发送给齿轮工人

I'm currently separating our video conversion part of the web page (kinda like youtube where users upload videos and we convert them to flv/mp4) to a different server. I already have the system running with gearman on the same machine. So when a user uploads a video file to server A in gets picked by a gearman worker on the same server A.

Now I moved the worker to server B. So worker on server B needs to access the uploaded file on server A. Currently I use SCP to copy the file from A to B and then process it. This method works but I feel like there should be a more clean way of doing it but I haven't found any information about sending files (or large files) to gearman workers. How would you approach this problem?

Preferably the client would send the video file as part of the command to start a background job, so I don't have to worry where the file actually is from within the worker. That way I can add more conversion servers without to much hassle.

I'm using PHP (with Gearman extension) for both my webpage and the worker.

  • 写回答

1条回答 默认 最新

  • duanfu5239 2012-07-26 09:42
    关注

    As was suggested in the comments, having a shared FS is the (usual) way to implement this, and simply pass the path around in the job request from gearman. Gearman is not well-suited for passing around large blobs of data, as it has to keep all of the information for a job in memory. It was never designed for handling the transfer and distribution of large files. Since MogileFS was also initially developed at Danga, there simply was no need to also incorporate file transfer and handling in Gearman (and that's a good thing, there's quite a few technologies that solve that problem better than Gearman would ever do).

    We're using NFS for handling distributed workers when videos arrive, and the encoder puts the encoded video back onto the NFS share that's available to the public when it's done. Haven't had a serious issue yet, NFS is stable and it's problems are well known and already solved for the kind of loads you'll see.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写