英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论