Redis队列在Node.js集群环境中(Redis queue in Node.js cluster environment)
使用Node.js集群支持,我希望主进程生成添加到Redis队列的数据项。 然后,我想运行多个读取Redis队列的工作进程。 当然,只有一个工作进程应该使用从队列中检索的数据项。
为了让我开始,你能建议在哪里查看Node包支持或原始Redis命令来实现这一目标? 让我强调消费者是Node.js集群环境中的独立进程,我们可以调整竞争从单个Redis队列读取的工作进程数,以调整整体系统性能。
Using Node.js cluster support, I would like the master process to produce data items that are added to a Redis queue. I would then like to run multiple worker processes that read the Redis queue. Naturally, only one of the worker processes should consume the data item retrieved from the queue.
To get me started, can you suggest where to look in terms of Node package support or raw Redis commands to accomplish this? Let me emphasize the consumers are separate processes in a Node.js cluster environment, where we may adjust the number of worker processes competing to read from the single Redis queue to tune overall system performance.
原文:https://stackoverflow.com/questions/23529635
最满意答案
我建议您使用此 Chrome扩展程序向REST调用添加请求标头。
它被称为高级REST客户端 ,我能够轻松地将提到的标题添加到GET中。
您只需要粘贴URL,选择GET ,以两种可用方式之一添加标题 (Raw of Form),然后单击Send 。
编辑:本文一定会帮助您解决206响应代码问题。
Accept-Ranges:字节
Accept-Ranges标头指示服务器接受对资源的范围请求。 远程Web服务器使用的单位是以字节为单位。 此标题告诉我们,服务器支持下载恢复或同时下载较小部分的文件,以便下载管理器应用程序可以加快下载速度。 Accept-Ranges:无响应标头表示下载不可恢复。
我使用文章中的以下URL尝试了Range标头,并获得了第206个响应代码: http : //s0.cyberciti.org/images/misc/static/2012/11/ifdata-welcome-0.png
I suggest you using this Chrome extension to add request headers to REST calls.
It is called Advanced REST Client and I was able to add the mentioned header to the GET easily there.
You need just to paste the URL, select GET, add the Header in one of two available ways (Raw of Form) and click Send.
EDIT: This article will surely help you with the 206 response code question.
Accept-Ranges: bytes
The Accept-Ranges header indicate that the server accept range requests for a resource. The unit used by the remote web servers is in bytes. This header tell us that either server support download resume or downloading files in smaller parts simultaneously so that download manager applications can speed up download for you. The Accept-Ranges: none response header indicate that the download is not resumable.
I tried the Range header with the following URL from the article and got the 206th response code: http://s0.cyberciti.org/images/misc/static/2012/11/ifdata-welcome-0.png
相关问答
更多-
HTTP范围标题(HTTP Range header)[2023-11-27]
这是一个语法上有效的请求,但不是可满足的请求。 如果您在该部分中进一步看到: 如果语法有效的字节范围集包含至少一个字节范围规范,其第一个字节数小于实体的当前长度,或至少一个后缀字节范围规范, - 零后缀长度,则字节范围集合是可满足的。 否则,字节范围集不能令人满意。 如果字节范围集不能令人满意,服务器应返回状态为416(请求范围不可满足)的响应 。 否则,服务器应该返回状态为206(部分内容)的响应,其中包含entity-body的可满足的范围。 所以我想在你的例子中,服务器应该返回一个416,因为它不是该 ... -
您可以使用可选的非捕获组(?:...)? : bytes=(?
\d+)(?:-(? \d+))? 其中\d+匹配1+位数。 或者使用内置的Grok模式: bytes=%{INT:start_range}(?:-%{INT:end_range})? You may use an optional non-capturing group (?:...)?: bytes=(? \d+)(?:-(? \d+))? whe ... -
我能够使用下面的代码传递一个头文件: jQuery.ajax({ type: 'DELETE', // must set api key url: 'https://www.googleapis.com/youtube/v3/videos?id='+ thisUniqueID +'&key=api_key_here', beforeSend: function(xhr){xhr.setRequestHeader('Authorization', 'Be ...
-
你使用什么服务器? 这是mod_headers的apache文档。 您可以将Accept-Ranges标头设置为none http://httpd.apache.org/docs/2.2/mod/mod_headers.html 尝试在httpd.conf文件中设置“Accept-Ranges none”。 mod_headers模块也必须加载到服务器中。 另外,当通过chrome或Adobe插件(其他插件)完成pdf或通常流式传输文件的请求时,它们将始终尝试使用Range:0执行GET请求,并尝试部分请求 ...
-
如何在FineUploader Azure请求中包含Content-MD5标头?(How to include Content-MD5 header in FineUploader Azure request?)[2023-02-20]
Fine Uploader通过getFile(id) API方法提供对底层File或Blob对象的直接访问。 一旦有权访问它,就可以使用FileReader读取文件/ blob字节并生成哈希。 为了使散列更容易,请考虑使用像SparkMD5这样的JS库。 计算此哈希的最佳位置可能是onSubmit回调处理程序 。 由于读取文件的过程是异步的,因此您必须在处理程序中返回一个承诺,Fine Uploader支持该承诺。 计算完哈希后,使用Fine Uploader的setParams API方法解析promis ... -
我建议您使用此 Chrome扩展程序向REST调用添加请求标头。 它被称为高级REST客户端 ,我能够轻松地将提到的标题添加到GET中。 您只需要粘贴URL,选择GET ,以两种可用方式之一添加标题 (Raw of Form),然后单击Send 。 编辑:本文一定会帮助您解决206响应代码问题。 Accept-Ranges:字节 Accept-Ranges标头指示服务器接受对资源的范围请求。 远程Web服务器使用的单位是以字节为单位。 此标题告诉我们,服务器支持下载恢复或同时下载较小部分的文件,以便下载管理 ...
-
1.在哪里添加“Range”标头值? PDF.js检测服务器是否返回“ Accept-Ranges:Bytes ”如果服务器返回有效的HTTP请求标头( 按规格 ),则PDF.js(将中止对不允许增量XHR的平台的主要请求)将发出范围请求。 2.如何向客户发送范围请求? 当PDF.js决定服务器可以处理范围请求时,它会自动通过XHR执行此操作。 3.从哪里打电话? 请参见network.js文件。 我应该包括viewer.html吗? 没有 看起来当前提供PDF数据的servlet不支持有效的HTTP范围请 ...
-
没有获得Range标头(Not getting Range header)[2021-09-29]
Content-Range指示原始实体的哪个范围包含在请求(如PUT请求)或206部分响应的正文中。 Range由客户端而不是服务器设置,以便请求子范围。 我假设您正在与之交谈的服务器不会响应上传的块,因此Content-Range (并且在任何情况下都不会)将不会作为响应头存在。 在您的代码段中, Content-Range缺少实际的上传Content-Range (请参阅更新的HTTP RFC )。 它必须具有以下形式: Content-Range: bytes 42-1233/1234 这意味着:上 ... -
get_response是提出请求的简写,当您需要更多的控制时 - 自己完成一个完整的请求。 这里有一个ruby标准库的例子: uri = URI.parse("http://www.ncdc.noaa.gov/cdo-web/api/v2/datasets/") req = Net::HTTP::Get.new(uri) req['token'] = 'fjhKJFSDHKJHjfgsdfdsljh' res = Net::HTTP.start(uri.hostname, uri.port) {|htt ...
-
AWS Canonical Request标头列表的更具体规则?(More specific rules for an AWS Canonical Request header list?)[2022-05-29]
如果我们应该只有Content-Type,Host和x-amz- *标题,那么列表标题在列表中的作用是什么? 您只需要具有Content-Type,Host和x-amz- *,但您可以添加要添加到要验证的签名的其他标头。 请参阅文档中的说明:“为了计算签名,只需要主机和任何x-amz- *标头;但是,为了防止数据被篡改,您应该考虑包括所有标头。签名计算。“ 如果我们只是想采取所有标题,那么为什么列表中没有Date标题? Date标头是特殊的,因为它是由浏览器根据可能不正确的客户端系统时间添加的。 因此,您可 ...