我使用 NodeJS 和Express作为代理来处理 HTTP GET 请求,对数据进行一些小的调整,并将数据提交给 Amazone Kinesis。这是我的代码的摘录:
var express = require('express');
var app = express();
app.get('/proxy-test', function(req, res){
var data = req.query;
// perform some light data processing
// send results to kinesis
kinesis.putRecord({
StreamName : MY_STREAM_NAME,
Data : data,
PartitionKey : MY_PARTITION_KEY
}, function(err, data) {
if (err) {
console.log(err, err.stack); // an error occurred
} else {
console.log(data);
}
});
res.send(200);
});
在为 200 个并发用户(循环 100 次)运行 JMeter 测试后,5 分钟后,我收到此错误:
10)\n 在 Request.emit (/Users/me/proxy/node_modules/aws-sdk/lib/request.js:578:14)\n 在 Request.transition (/Users/me/proxy/node_modules/aws- sdk/lib/request.js:12:12)\n 在 AcceptorStateMachine.runTo (/Users/me/proxy/node_modules/aws-sdk/lib/state_machine.js:14:12)\n 在 /Users/me/ proxy/node_modules/aws-sdk/lib/state_machine.js:26:10\n 在请求。(/Users/me/proxy/node_modules/aws-sdk/lib/request.js:28:9)\n 在请求。(/Users/me/proxy/node_modules/aws-sdk/lib/request.js:580:12)\n 在 Request.callListeners (/Users/me/proxy/node_modules/aws-sdk/lib/sequential_executor.js: 90:20)' runTo (/Users/me/proxy/node_modules/aws-sdk/lib/state_machine.js:14:12)\n 在 /Users/me/proxy/node_modules/aws-sdk/lib/state_machine.js:26:10 \n 在请求中。(/Users/me/proxy/node_modules/aws-sdk/lib/request.js:28:9)\n 在请求。(/Users/me/proxy/node_modules/aws-sdk/lib/request.js:580:12)\n 在 Request.callListeners (/Users/me/proxy/node_modules/aws-sdk/lib/sequential_executor.js: 90:20)' runTo (/Users/me/proxy/node_modules/aws-sdk/lib/state_machine.js:14:12)\n 在 /Users/me/proxy/node_modules/aws-sdk/lib/state_machine.js:26:10 \n 在请求中。(/Users/me/proxy/node_modules/aws-sdk/lib/request.js:28:9)\n 在请求。(/Users/me/proxy/node_modules/aws-sdk/lib/request.js:580:12)\n 在 Request.callListeners (/Users/me/proxy/node_modules/aws-sdk/lib/sequential_executor.js: 90:20)'
我可以做些什么(配置或代码更改)以确保发送和保存所有 Kinesis 记录?