This article introduces the concept of message queues and discusses the strengths and weaknesses of three specific message queue services: Beanstalkd, IronMQ and Amazon SQS.
本文介绍了消息队列的概念,并讨论了三种特定的消息队列服务的优缺点:Beanstalkd,IronMQ和Amazon SQS。
Any information described in this article is correct at the time of writing and is subject to change.
本文中描述的任何信息在撰写本文时都是正确的,并且可能会随时更改。
Queues allow you to store metadata for processing jobs at a later date. They can aid in the development of SOA (service-oriented architecture) by providing the flexibility to defer tasks to separate processes. When applied correctly, queues can dramatically increase the user experience of a web site by reducing load times.
队列使您可以存储元数据,以便以后处理作业。 通过提供将任务推迟到单独的流程的灵活性,它们可以帮助开发SOA(面向服务的体系结构)。 如果正确应用队列,则可以通过减少加载时间来极大地提高网站的用户体验。
Any time consuming process can be placed in a queue:
任何耗时的过程都可以放在队列中:
You can also use queues in creative ways – locking jobs so only one user can access information at a time
您还可以创造性地使用队列-锁定作业,以便一次只能有一个用户访问信息
There are many services that you can use to implement message queues, this article outlines differences between Beanstalkd, IronMQ and Amazon SQS.
您可以使用许多服务来实现消息队列,本文概述了Beanstalkd,IronMQ和Amazon SQS之间的区别。
Beanstalkd is "… a simple, fast work queue". It is released as open source under the MIT license. It's well documented, unit tested and can be downloaded for free to run on your own server. The architecture is borrowed from memcached and it is designed specifically to be a message queue.
Beanstalkd是“……一个简单,快速的工作队列”。 它根据MIT许可证作为开源发布。 它具有充分的文档记录,已进行了单元测试,可以免费下载以在您自己的服务器上运行。 该架构是从memcached借用的,专门设计为消息队列。
An article on SitePoint by author Dave Kennedy called Giant Killing with Beanstalkd contains information on how to start using Beanstalkd with Ruby.
作者Dave Kennedy在SitePoint上发表的一篇文章《 Beanstalkd的巨人杀戮》包含有关如何开始将Ruby和Beanstalkd一起使用的信息。
IronMQ is a hosted RESTful web service. There is a free tier for developers and many other subscription tiers for commercial applications.
IronMQ是托管的RESTful Web服务。 开发人员有一个免费层,商业应用程序有许多其他订阅层。
Amazon SQS is an inexpensive hosted solution for implementing message queues. It comes as part of Amazon Web Services (AWS). Amazon offers a Free Tier for evaluating their web services which includes SQS.
Amazon SQS是用于实施消息队列的廉价托管解决方案。 它是Amazon Web Services(AWS)的一部分。 亚马逊提供免费层级以评估其包括SQS的Web服务。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Self-hosted | Remotely hosted | Remotely hosted |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
自托管 | 远程托管 | 远程托管 |
Runs on Linux and Mac OS X. Read the installation instructions from the Beanstalkd website for details on how to get it working on your system. The Beanstalkd server does not work on Windows.
在Linux和Mac OS X上运行。请阅读Beanstalkd网站上的安装说明,以获取有关如何使其在系统上运行的详细信息。 Beanstalkd服务器在Windows上不起作用。
IronMQ and Amazon SQS are cloud-based web services. No applications need to be setup on your server, you simply need to sign-up for an account and setup a queue.
IronMQ和Amazon SQS是基于云的Web服务。 您无需在服务器上设置任何应用程序,只需要注册一个帐户并设置队列即可。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
None | 99.95% per month | None |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
没有 | 每月99.95% | 没有 |
As Beanstalkd is a server you host, you are responsible for ensuring its availability.
由于Beanstalkd是您托管的服务器,因此您有责任确保其可用性。
Iron.IO has a Service Level Agreement with an uptime percentage of at least 99.95% during any monthly billing cycle. Their Pro Platinum package ($2450/month) has custom contract terms which includes Service Level Agreements. They provide refunds in Service Credits.
Iron.IO的服务水平协议在任何每月计费周期内的正常运行时间百分比至少为99.95%。 他们的Pro Platinum套餐($ 2450 /月)具有自定义合同条款,其中包括服务水平协议。 他们提供服务积分中的退款。
Amazon does not have a specific Service Level Agreement for SQS. They do have Support Services available which can cover SQS at an extra cost.
亚马逊没有针对SQS的特定服务水平协议。 他们确实有可用的支持服务 ,可以额外支付SQS。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
PUSH (sockets) | HTTP Web Service | HTTP Web Service |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
推(插座) | HTTP Web服务 | HTTP Web服务 |
Communicates via PUSH sockets providing instant communication between providers and workers.
通过PUSH套接字进行通信,以在提供程序和工作程序之间进行即时通信。
When a provider enqueues a job, a worker can reserve it immediately if it is connected and ready. Jobs are reserved until a worker has sent a response (delete, bury, etc.)
当提供者排队工作时,如果已连接并准备就绪,工作人员可以立即保留该工作。 保留作业,直到工人发送响应(删除,掩埋等)为止
SQS is a hosted RESTful web service.
SQS是托管的RESTful Web服务。
There is push-like support for IronMQ. A subscriber can be called whenever a provider enqueues a job to the queue. Generally you will want to use the standard RESTful service to enqueue and dequeue jobs instead of the push approach.
IronMQ有类似推送的支持。 只要提供者将作业排入队列, 就可以调用订阅者。 通常,您将需要使用标准的RESTful服务来入队和出队作业,而不是推入方法。
SQS is a hosted web service.
SQS是托管的Web服务。
There is no push support for SQS. You must poll at regular intervals to check if there are jobs in the queue.
没有对SQS的推送支持。 您必须定期轮询以检查队列中是否有作业。
SQS can use long polling known as Message Receive Wait Time
(default: 0 seconds, max: 20 seconds) to keep a connection open while the worker waits for a job. This can mean fewer requests and longer socket opening times.
SQS可以使用称为Message Receive Wait Time
(默认:0秒,最大:20秒)的长轮询来在工作人员等待作业时保持连接打开。 这意味着更少的请求和更长的套接字打开时间。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Open source | Official | Official |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
开源的 | 官方 | 官方 |
There are many open source Beanstalkd client libraries available in a myriad of programming languages. These are all independent projects from Beanstalkd.
有许多可用的编程语言提供的开源Beanstalkd客户端库 。 这些都是Beanstalkd的独立项目。
The IronMQ client libraries are provided by Iron.IO and can be downloaded from the Dev Center.
IronMQ客户端库由Iron.IO提供,可以从开发中心下载。
You can also use a Beanstalkd client library with IronMQ if you'd like the flexibility of switching between the two services; however some commands (e.g.: kick, bury) are not supported. You also may need to implement the oauth command manually to connect to the service.
如果您希望在两种服务之间切换的灵活性,还可以将Beanstalkd客户端库与IronMQ一起使用 。 但是不支持某些命令(例如:kick,bury)。 您可能还需要手动实现oauth命令才能连接到服务。
The AWS client libraries include the SQS client libraries. These are provided by Amazon and are available in many programming languages.
AWS客户端库包括SQS客户端库。 这些由Amazon提供,并且可用多种编程语言提供。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Open source | Dashboard | Console |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
开源的 | 仪表板 | 安慰 |
No graphical management interface is distributed by default. There are some open source projects to help with debugging and administration which can be found on the Beanstalkd tools page.
默认情况下,不分发图形管理界面。 在Beanstalkd工具页面上可以找到一些开源项目来帮助调试和管理。
The IronMQ dashboard manages queues. It contains a helpful tutorial describing how to setup queues and shows you how to add jobs (IronMQ: messages) to a queue via cURL.
IronMQ仪表板管理队列。 它包含有用的教程,描述了如何设置队列,并向您展示了如何通过cURL将作业(IronMQ:消息)添加到队列中。
The interface allows you to manage your queues in an AJAX-driven website. You can create, read and delete jobs, view historical information and manage queue configuration from the dashboard view.
该界面允许您管理AJAX驱动的网站中的队列。 您可以从仪表板视图创建,读取和删除作业,查看历史信息以及管理队列配置。
The AWS Management Console allows you to manage SQS. The interface is built on top of a stateless protocol so you need to press the refresh button to get up-to-date information.
AWS管理控制台可让您管理SQS。 该界面建立在无状态协议的基础上,因此您需要按刷新按钮以获取最新信息。
You can create, read and delete jobs (SQS: messages) and manage queue configuration.
您可以创建,读取和删除作业(SQS:消息)并管理队列配置。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Client-side | Cloud-based | Cloud-based |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
客户端 | 基于云的 | 基于云的 |
Redundancy is handled on the client side and if a server goes down you will lose jobs.
冗余是在客户端处理的,如果服务器出现故障,您将失去工作。
Beanstalkd does include an option to store jobs in a binary log. You must launch Beanstalkd with the -b
option, however restoring the queue is a manual task and requires access to the server disks.
Beanstalkd确实包含将作业存储在二进制日志中的选项。 您必须使用-b
选项启动Beanstalkd,但是还原队列是一项手动任务,需要访问服务器磁盘。
IronMQ is a cloud-based service with high persistence, availability and redundancy.
IronMQ是一项基于云的服务,具有很高的持久性,可用性和冗余性。
Jobs are stored on multiple servers in a hosted zone. This approach ensures the availability of the service and jobs should never be lost.
作业存储在托管区域中的多台服务器上。 这种方法确保了服务的可用性,并且工作绝不会丢失。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
None | Token | Key & secret |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
没有 | 代币 | 关键与秘密 |
No authentication is required to connect to Beanstalkd. Providers are able to enqueue jobs and workers are able to reserve jobs without passing through a security model. For this reason it is highly recommended to create a firewall blocking external connections to the port that Beanstalkd is running on.
连接到Beanstalkd不需要身份验证。 提供者可以征用工作,而工作人员可以保留工作而无需通过安全模型。 因此,强烈建议创建一个防火墙,以阻止与Beanstalkd运行所在端口的外部连接。
You can invite collaborators via the project settings to use your message queues. Authentication to the application is done via an Iron.IO token and a project ID.
您可以通过项目设置邀请协作者使用您的消息队列。 通过Iron.IO令牌和项目ID对应用程序进行身份验证。
Authentication to SQS is realised through the Amazon API key and secret. Permissions can be granted and revoked for other AWS accounts to access your queues via the AWS Management Console.
通过Amazon API密钥和机密实现对SQS的身份验证。 可以授予和撤销其他AWS账户的权限,以通过AWS管理控制台访问您的队列。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Fast | Internet Latency | Internet Latency |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
快速 | 互联网延迟 | 互联网延迟 |
Beanstalkd is very fast as it should be on the same network as its providers and workers. Beanstalkd can sometimes be so fast that if a provider puts a job in a queue and follows it with a call to MySQL, a worker may pick up your job before MySQL has finished executing.
Beanstalkd速度非常快,因为它应该与其提供者和工作人员位于同一网络上。 Beanstalkd有时可能会非常快,以至于如果提供程序将作业放在队列中并在其后调用MySQL,那么工作人员可能会在MySQL完成执行之前接您的作业。
Requests have an increased latency as they are sent to the IronMQ RESTful web service via HTTP.
通过HTTP将请求发送到IronMQ RESTful Web服务时,请求的延迟增加。
Requests have an increased latency as they are sent to the SQS web service via HTTP.
通过HTTP将请求发送到SQS Web服务时,请求的延迟增加了。
Jobs may not be picked up straight away as they need to be distributed across different servers and data centres. This latency should be negligible if the application, a provider or a worker is hosted on an EC2 instance.
由于需要将作业分布在不同的服务器和数据中心中,因此可能无法立即将其拾取。 如果应用程序,提供程序或工作程序托管在EC2实例上,则此延迟应可以忽略不计。
When you enqueue a job to SQS, it might not be immediately available. Jobs must be propagated to other servers. There is generally a one second wait at most.
将作业加入SQS时,它可能不会立即可用。 作业必须传播到其他服务器。 通常最多等待一秒钟。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
FIFO | FIFO | No guarantees |
Prioritisable | No priority | No priority |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
先进先出 | 先进先出 | 没有保证 |
优先 | 没有优先权 | 没有优先权 |
Queues are FIFO (first in, first out). Jobs with higher importance can be prioritised which will affect the order in which jobs are dequeued.
队列是FIFO(先进先出)。 优先级较高的作业可以优先处理,这将影响作业出队的顺序。
Queues are FIFO (first in, first out). Jobs cannot be prioritised.
队列是FIFO(先进先出)。 不能优先考虑工作。
Jobs will not come out in the same order that they entered the queue. Because SQS is a distributed service, jobs will be available on each server at different times. This is something to be acutely aware of when designing for SQS.
作业将不会按进入队列的顺序出现。 由于SQS是分布式服务,因此作业将在不同时间在每台服务器上可用。 在为SQS设计时,需要牢记这一点。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Guaranteed | Guaranteed | Not guaranteed |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
保证的 | 保证的 | 不保证 |
One-time pickup describes the restriction that unless a worker has timed out, two or more workers will never run the same job in parallel.
一次性接班描述了这样的限制:除非一个工人超时,否则两个或多个工人将永远不会并行运行同一作业。
The socket-based architecture of Beanstalkd ensures one-time pickup.
Beanstalkd基于套接字的体系结构可确保一次性提取。
IronMQ guarantees one-time pickup.
IronMQ保证一次性领取。
Because SQS is a distributed service, there is no guarantee for one-time pickup (but it is unlikely).
由于SQS是分布式服务,因此无法保证一次性取件(但这不太可能)。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Zombie socket | Timeout | Timeout |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
僵尸插座 | 超时 | 超时 |
Jobs are automatically returned to the queue if a worker doesn't respond to Beanstalkd within a set amount of time or if the socket closes without responding to the job.
如果工作人员在设定的时间内未响应Beanstalkd,或者套接字在没有响应工作的情况下关闭,则工作将自动返回到队列。
It's then ready for immediate pick-up by the next requesting worker (it doesn't need to be kicked).
然后准备好由下一个发出请求的工作人员立即提货(不需要将其踢开)。
Workers connect to a queue and reserve a job. From this moment, the worker has a set amount of time to delete the job from the queue before it is released and becomes available for workers to reserve again.
工人连接到队列并保留作业。 从这一刻起,工作人员在释放作业之前有一定的时间从队列中删除作业,并可供工作人员再次保留。
Beanstalkd | IronMQ | Amazon SQS |
---|---|---|
Automatic | Auto & manual | Manual |
豆茎 | IronMQ | 亚马逊SQS |
---|---|---|
自动 | 自动和手动 | 手册 |
Queues (Beanstalkd: tubes) are automatically created when jobs are enqueued. They do not need to be created manually.
作业入队时自动创建队列(Beanstalkd:试管)。 它们不需要手动创建。
Requires you to create a project in the dashboard. One project contains many queues. Queues can either be created automatically when jobs are enqueued or manually created with configuration from the dashboard.
要求您在仪表板中创建一个项目 。 一个项目包含许多队列。 队列入队时可以自动创建队列,也可以通过仪表板中的配置手动创建队列。
Queues must be manually setup from the AWS management console for SQS. Each queue will generate a unique URL which acts as the queue name.
必须从AWS管理控制台为SQS手动设置队列。 每个队列将生成一个唯一的URL,该URL作为队列名称。
Note the region (e.g.: us-west-1, eu-west-1, etc.) that the queue belongs to as it's required to connect to SQS.
请注意该队列所属的区域(例如:us-west-1,eu-west-1等),以连接到SQS。
The Laravel framework has an excellent built-in wrapper which encapsulates message queues for Beanstalkd, IronMQ and Amazon SQS. You can change servers through configuration without altering any of your application.
Laravel框架具有出色的内置包装器,该包装器封装了Beanstalkd,IronMQ和Amazon SQS的消息队列 。 您可以通过配置更改服务器,而无需更改任何应用程序。
These code examples show you how you can connect to a server, enqueue, reserve and dequeue a job from a queue. If an exception is thrown, it will bury the job (if the server supports it).
这些代码示例向您展示如何连接到服务器,如何从队列中入队,保留和出队作业。 如果引发异常,它将掩埋该作业(如果服务器支持)。
Try stopping the execution after a job has been enqueued and using a management tool to debug your queue.
将作业排入队列并尝试使用管理工具调试队列后,尝试停止执行。
composer.json
composer.json
{
"require": {
"pda/pheanstalk": "dev-master"
}
}
beanstalkd.php
beanstalkd.php
<?php
/* 1. Setup & connect */
// Include composer libraries
require 'vendor/autoload.php';
$queue_name = 'default';
$job_data = 'lorem ipsum';
$beanstalkd = new Pheanstalk_Pheanstalk('127.0.0.1:11300');
/* 2. Provider */
// Enqueue a job
$beanstalkd
->useTube($queue_name)
->put($job_data);
/* 3. Worker */
// Loop through all jobs
while ($job = $beanstalkd->watch($queue_name)->reserve(5)) {
try {
$job_data = $job->getData();
echo $job_data . PHP_EOL;
// Dequeue a job
$beanstalkd->delete($job);
} catch (Exception $e) {
// Bury a job
$beanstalkd->bury($job);
echo $e->getMessage();
}
}
composer.json
composer.json
{
"require": {
"iron-io/iron_mq": "dev-master"
}
}
iron_mq.php
iron_mq.php
<?php
/* 1. Setup & connect */
// Include composer libraries
require 'vendor/autoload.php';
$queue_name = 'default';
$job_data = 'lorem ipsum';
$iron_mq = new IronMQ(array(
'token' => '{token}',
'project_id' => '{project_id}'
));
/* 2. Provider */
// Enqueue a job
$iron_mq->postMessage($queue_name, $job_data);
/* 3. Worker */
// Loop through all jobs
while ($job = $iron_mq->getMessage($queue_name)) {
try {
$job_data = $job->body;
echo $job_data . PHP_EOL;
// Dequeue a job
$iron_mq->deleteMessage($queue_name, $job->id);
} catch (Exception $e) {
// Bury a job
// There is no bury in IronMQ
echo $e->getMessage();
}
}
composer.json
composer.json
{
"require": {
"aws/aws-sdk-php": "2.4.*@dev"
}
}
sqs.php
sqs.php
<?php
/* 1. Setup & connect */
// Include composer libraries
require 'vendor/autoload.php';
$queue_name = 'https://sqs.{region}.amazonaws.com/{id}/{queue_name}';
$job_data = 'lorem ipsum';
$aws = \Aws\Common\Aws::factory(array(
'key' => '{key}',
'secret' => '{secret}',
'region' => '{region}'
));
$sqs = $aws->get('sqs');
/* 2. Provider */
// Enqueue a job
$sqs->sendMessage(array(
'QueueUrl' => $queue_name,
'MessageBody' => $job_data
));
/* 3. Worker */
// Handle one job
$result = $sqs->receiveMessage(array(
'QueueUrl' => $queue_name
));
if (!$result) {
// No jobs
exit;
}
$messages = $result->getPath('Messages');
if (!$messages) {
// No jobs
exit;
}
foreach ($messages as $message) {
try {
$job_data = $message['Body'];
echo $job_data . PHP_EOL;
// Dequeue a job
$sqs->deleteMessage(array(
'QueueUrl' => $queue_name,
'ReceiptHandle' => $message['ReceiptHandle']
));
} catch (Exception $e) {
// Bury a job
// There is no bury in SQS
echo $e->getMessage();
}
}
Regardless of which service you select, here are some tips for keeping your queues robust:
无论您选择哪种服务,以下都是一些使队列稳定的提示:
Your job can contain whatever data you like, provided it's within the limit of the server's job data size. Use JSON in your job body to make metadata easy to transmit.
您的作业可以包含所需的任何数据,只要它们在服务器的作业数据大小的限制内即可。 在工作正文中使用JSON可使元数据易于传输。
// Encode for enqueuing:
$raw_data = (object) array('id' => 100);
$job_data = json_encode($raw_data);
// Decode from dequeuing:
$raw_data = '{"id":100}';
$job_data = json_decode($raw_data);
Try not to crowd jobs with too much metadata. If you can can store some information in a database and only queue an ID for later processing, your queue will be more robust and easier to debug.
尽量不要将太多的元数据挤在工作上。 如果您可以将一些信息存储在数据库中,并且仅将ID排队以供以后处理,则您的队列将更健壮且更易于调试。
// Good:
$raw_data = (object) array('id' => 100);
// Not as good ...
// But sometimes necessary when there is
// no database access on a worker:
$raw_data = (object) array(
'id' => 100,
'color' => 'black',
'background' => 'white'
);
If for some reason an item which has already been processed re-enters a queue, you probably don't want it to be reprocessed. Unfortunately the job data is not forced to be unique and it's important that you keep track of the state of a job in a database.
如果由于某种原因已经处理过的项目重新进入队列,则您可能不希望对其进行重新处理。 不幸的是,作业数据并没有被强制为唯一的,因此重要的是要跟踪数据库中作业的状态。
This can be as simple as having a column on your jobs table to mark an item as processed. You can deleting the job from the queue if it already has been handled.
这可以很简单,就像在作业表上有一列将项目标记为已处理一样。 您可以从队列中删除该作业(如果已经处理过)。
Some words are used differently between Beanstalkd and Amazon SQS. There's a quick list of translations:
Beanstalkd和Amazon SQS之间使用的某些词有所不同。 有一个快速的翻译清单:
Beanstalkd | Amazon SQS | IronMQ |
---|---|---|
Tube | Queue | Queue |
Job | Message | Message |
Job data | Message body | Message body |
Put | Send message | POST |
Reserve | Receive message | GET |
Delete | Delete message | DELETE |
TTR (time-to-run) | Visibility timeout | Timeout |
Delay | Delivery delay | Delay |
– | Retention Period | Expires in |
豆茎 | 亚马逊SQS | IronMQ |
---|---|---|
管 | 队列 | 队列 |
工作 | 信息 | 信息 |
工作数据 | 邮件正文 | 邮件正文 |
放 | 发信息 | 开机自检 |
保留 | 接收讯息 | 得到 |
删除 | 删除留言 | 删除 |
TTR(运行时间) | 可见性超时 | 超时 |
延迟 | 交货延迟 | 延迟 |
– | 保留期 | 过期日期在 |
When working with queues you may come across these terms:
使用队列时,您可能会遇到以下术语:
Bury (a job)
– puts a job in a failed state. The job cannot be reprocessed until it is manually kicked back into the queue. Not supported by IronMQ and SQS.
Bury (a job)
–将工作置于失败状态。 在手动将作业踢回队列之前,无法对其进行重新处理。 IronMQ和SQS不支持。
Consumer
– see Worker.
Consumer
–参见工人。
Delay
– defer a job from being sent to a worker for a predetermined amount of time.
Delay
–将工作推迟预定时间发送给工人。
Delete (a job)
– see Dequeue.
Delete (a job)
–请参阅出队。
Dequeue
– marks a job as completed and removes it from the queue.
Dequeue
–将作业标记为已完成并将其从队列中删除。
Enqueue
– adds a job to a queue ready for a worker.
Enqueue
–将作业添加到队列中以供工作者使用。
FIFO
– describes the way jobs are handled in a queue as First In, First Out. This is the most common type of message queue.
FIFO
–描述在队列中以FIFO
的方式处理作业的方式。 这是最常见的消息队列类型。
FILO
– describes the way jobs are handled in a queue as First In, Last Out.
FILO
–将作业在队列中的处理方式描述为先进先出。
Job
– a deferred task in a queue containing metadata to identify what task is waiting to be processed. Akin to database rows.
Job
–包含元数据的队列中的延迟任务,用于标识正在等待处理的任务。 类似于数据库行。
Kick (a job)
– returns a previously buried job to the queue ready for workers to pick up. Not supported by IronMQ and SQS.
Kick (a job)
–将先前埋藏的工作返回到队列中,以供工人拿起。 IronMQ和SQS不支持。
Provider
– a client which connects to the message server to create jobs.
Provider
–连接到消息服务器以创建作业的客户端。
Queue
– a way to group similar jobs into a queue. Akin to database tables.
Queue
–一种将相似作业分组到队列中的方法。 类似于数据库表。
Reserve (a job)
– delivers a job to a worker and locks it from being delivered to another worker.
Reserve (a job)
–将工作交付给工人,并阻止其交付给其他工人。
Worker
– a client which connects to the message server to reserve, delete and bury jobs. These perform the labour intensive part of the processing.
Worker
-连接到消息服务器以保留,删除和掩埋作业的客户端。 这些执行处理的劳动密集型部分。
There is no silver bullet for message queue services. Beanstalkd, IronMQ and Amazon SQS all have their strengths and weaknesses which can be used to your advantage. This article should provide you with enough information to help you make an informed decision as to which service is best for your skill level and project needs.
消息队列服务没有灵丹妙药。 Beanstalkd,IronMQ和Amazon SQS都有其优点和缺点,可以利用这些优点和缺点。 本文应为您提供足够的信息,以帮助您做出明智的决定,以决定哪种服务最适合您的技能水平和项目需求。
Which message queue service will you be using? If you currently use queues, Will you consider switching? Have you used message queues in an unconventional way that could help others? Leave a comment and let everyone know.
您将使用哪种消息队列服务? 如果您当前使用队列,是否考虑切换? 您是否以非常规的方式使用消息队列来帮助他人? 发表评论,让大家知道。
翻译自: https://www.sitepoint.com/message-queues-comparing-beanstalkd-ironmq-amazon-sqs/