我正在使用 Kinesis 存储从安装在 EC2 服务器上的 Jmeter 发送的记录。问题是当我启动 7200 个线程并在我的 Kinesis 流上使用 1 个共享时,一切正常。如果我启动 9000 个线程,我会收到此错误
Rate exceeded for shard shardId-000000000001 in stream Jmeter under account 769870455028. (Service: AmazonKinesis; Status Code: 400; Error Code: ProvisionedThroughputExceededException; Request ID: 98f687d9-ffbe-11e4-a897-357ee8c24764)
所以我增加了分片的数量,将其设置为 2 和 3,但它不起作用。所以我认为问题不在于分片号,而在于我的 java 代码,或者我不知道还有什么。这是我的代码:
public MyKinesisClient( String streamName, int partitionKey, String accessKey, String secretKey, String endpoint, String serviceName, String regionId ) {
this.streamName=streamName;
this.partitionKey=partitionKey;
AWSCredentials credentials = null;
credentials = new BasicAWSCredentials(accessKey, secretKey);
kinesisClient = new AmazonKinesisClient(credentials);
kinesisClient.setEndpoint(endpoint,serviceName,regionId);
}
/**
* Metodo utilizzato per l'invio di un json a Kinesis
* @param json: com.amazonaws.util.json.JSONObject da inviare a Kinesis
* @throws UnsupportedEncodingException
* @throws JSONException
*/
public void sendJson(JSONObject json) throws UnsupportedEncodingException, JSONException {
try{
PutRecordRequest putRecordRequest = new PutRecordRequest();
putRecordRequest.setStreamName(streamName);
putRecordRequest.setData(ByteBuffer.wrap(json.toString().getBytes("utf-8")));
//putRecordRequest.setData(ByteBuffer.wrap(String.format("testData-%d", createTime).getBytes()));
putRecordRequest.setPartitionKey(String.format("partitionKey-%d", partitionKey));
kinesisClient.putRecord(putRecordRequest);
}catch(Exception e){
System.out.println(e.getMessage());
}
}
有使用更多分片的说明吗?提前致谢