亚马逊从Heroku的菌种背景的项目? [英] Spawn background project on Amazon from Heroku?

查看:109
本文介绍了亚马逊从Heroku的菌种背景的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku上一个Rails应用程序,我想都会产生的delayed_job ,<一个后台进程HREF =htt​​ps://github.com/mperham/sidekiq相对=nofollow> sidekiq 或一些其他类似的服务。我不想支付工人赛道,并听说是相对便宜运行这个程序在亚马逊。我说的不是被安排在特定的时间,一个后台进程 - 我要当用户做一些事情在我的网站上执行一定的过程。将亚马逊EC2是合适的工具,这一点,还是有不同的亚马逊的工具?而对于什么是正确的工具,我怎样才能从Rails的正常产卵呢?

I have a Rails app on Heroku and I want to spawn a background process with delayed_job, sidekiq, or some other similar service. I do not want to pay for a worker dyno, and have heard that it is relatively cheap to run this process on Amazon. I am not talking about a background process that is scheduled for a specific time - I want a certain process to be executed when a user does something on my site. Would Amazon EC2 be the right tool for this, or is there a different Amazon tool? And for whatever is the right tool, how can I spawn it from Rails correctly?

推荐答案

最简单的就是只需付的Heroku。

Easiest is to just pay Heroku.

AWS是一个很好的方式,只要你舒服管理部署和配置环境中去。它的相对容易,但我不会说这很容易,除非你有一些经验,部署和生产管理Rails应用。你也不用担心主机都在运行,有多少工人每台主机,内存,硬件故障等大多数人都在第一时间使用Heroku的,以避免这方面的工作。这就是说:

AWs is a good way to go as long as you're comfortable managing the deployments and configuring the environment. It's "relatively" easy, but I wouldn't say it's easy unless you have some experience deploying and managing rails apps in production. You also have to worry about hosts being up, how many workers per host, memory, hardware failure, etc. Most people are using Heroku in the first place to avoid this kind of work. That said:

1)resque,你只需要连接到相同的Redis集群。 AWS上的工人们将看到队列与您的Heroku的应用创造了就业机会。

1) for resque, you just need to connect to the same Redis cluster. Workers on AWS will see the queues with jobs created by your heroku app

2)滞报的工作,你需要能够读/写同一个数据库。这也应该是pretty的直线前进。

2) for delayed job, you need to be able to read/write to the same db. this should also be pretty straight forward.

这里最大的风险是,你必须要小心同步您的code。你真的不希望运行1.0版本的code在你的web应用,另一个版本的工人。你想成为非常小心,只有ID传递引用(注意工作延迟的序列化对象弄成工人无法反序列化)。

The big risk here is that you need to be careful about syncing your code. You don't really want to be running 1 version of code on your webapp and another version in your workers. You'd want to be extremely careful to pass references only by id (watch out for delayed job serializing your objects into something the worker can't deserialize).

这篇关于亚马逊从Heroku的菌种背景的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆