在Go语言中,与PHP的gearman workers相当的是什么?

huangapple go评论91阅读模式
英文:

PHP gearman workers equivalent in GO?

问题

我正在处理一个处理数据的项目。每隔5分钟,cron会执行一个Go脚本来完成所有的工作。其中一部分工作需要更多的性能和更重要的是,它需要更多的时间,所以我想将这部分工作放在一个单独的Go脚本中。这个脚本将接收process_id并完成相应的工作,而主要的工作可以继续进行,而且重要的是,它不需要等待后台的Go脚本完成。不需要后台任务在完成后回调我(这个信息将保存在数据库中)。

在PHP中,这种情况可以通过Gearman worker来解决,你可以调用它,发送数据,并且在Gearman在后台处理数据时可以继续进行你的工作。

在Go语言中是否有类似的解决方案,而且不是通过HTTP调用的呢?

谢谢。

英文:

I'm working on one project which is processing data. Every 5 minutes cron executes go script which is doing all job. One part of job is taking a little more performance and more important, it's taking to much time so I would like to take this part of proccess and put in separate go script. This script would receive proccess_id and do that stuff while main job can continue and important, it would not wait that background go script finishes. It's not required that background job call me back when it's done (that info would be saved in db).

That kind of situation in PHP would be solved by gearman worker which you call, send data and you can contiue with your job while gearman is processing data by himself in background

Is there any similar in go lang which can also be called and not over http?

Thank you

答案1

得分: 5

你可以使用gearman的go绑定。在这里查看:

https://github.com/mikespook/gearman-go

这个链接是从gearman主站的下载部分链接过来的。

英文:

You can use the go bindings for gearman. Check it out here:

https://github.com/mikespook/gearman-go

This is linked from the downloads section of the main gearman site.

huangapple
  • 本文由 发表于 2015年10月18日 02:01:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/33189840.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定