阅读背景:

使用AWS JavaScript SDK和agent = false进行快速S3操作

来源:互联网 

I need to perform thousands of operations in S3 as rapidly as possible. I have created a Node.js application that will attempt up to 500 operations at a time with the S3 SDK. Example operations are s3.copyObject(), s3.listObjects, etc.

我需要尽快在S3中执行数千次操作。我创建了一个Node.js应用程序,它将使用S3 SDK一次尝试多达500个操作。示例操作是s3.copyObject(),s3.listObjects等。

In my testing, I found that only a few requests were actually occurring over the wire simultaneously because the agent sees that it's on the same host, and shoves all the requests down the same TCP connection. I've gotten around it by disabling the agent:

在我的测试中,我发现只有少数请求实际上同时通过线路发生,因为代理看到它在同一主机上,并将所有请求推送到同一TCP连接。我通过禁用代理来解决这个问题:

AWS.config.httpOptions.agent = false;

However to do this I also had to disable SSL:

但是要做到这一点,我还必须禁用SSL:

AWS.config.sslEnabled = false;

The SDK docs say that a special agent is used for SSL operations.

SDK文档说特殊代理用于SSL操作。

How can I override the agent for SSL behavior, disabling keep-alive or at least enabling ~500 keep-alive simultaneous connections?

如何覆盖SSL代理行为,禁用keep-alive或至少启用~500 keep-alive同时连接?

1 个解决方案

#1


It turned out that I hadn't upgraded my copy of Node to v0.12 so I had to set the global agent maxSockets. Cranking that up took care of this problem. So did upgrading to Node.js v0.12.02 for the same reason.

事实证明我没有将我的Node副本升级到v0.12所以我不得不设置全局代理maxSockets。起来解决了这个问题。因此出于同样的原因升级到Node.js v0.12.02。


分享到: