[英]Elasticsearch Performance Analysis
We are currently evaluating Elasticsearch as our solution for Analytics. 我们目前正在评估Elasticsearch作为我们的Analytics解决方案。 The main driver is the fact that once the data is populated into Elasticsearch, the reporting comes for free with Kibana. 主要驱动因素是,一旦将数据填充到Elasticsearch中,Kibana便会免费提供报告。
Before adopting it, I am tasked to do a performance analysis of the tool. 在采用它之前,我受命对工具进行性能分析。
The main requirement is supporting a PUT rate of 500 evt/sec. 主要要求是支持500 evt / sec的PUT速率。
I am currently starting with a small setup as follows just to get a sense of the API before I upload that to a more serious lab. 我目前从一个小的设置开始,如下所示,目的是在将其上传到更严格的实验室之前先了解一下API。
My Strategy is basically, going over CSVs of analytics that correspond to the format I need and putting them into elasticsearch. 我的策略基本上是,遍历与我需要的格式相对应的分析CSV并将其放入elasticsearch。 I am not using the bulk API because in reality the events will not arrive in a bulk fashion. 我没有使用批量API,因为实际上事件不会以批量方式到达。
Following is the main code that does this: 以下是执行此操作的主要代码:
// Created once, used for creating a JSON from a bean
ObjectMapper mapper = new ObjectMapper();
// Creating a measurement for checking the count of sent events vs
// ES stored events
AnalyticsMetrics metrics = new AnalyticsMetrics();
metrics.startRecording();
File dir = new File(mFolder);
for (File file : dir.listFiles()) {
CSVReader reader = new CSVReader(new FileReader(file.getAbsolutePath()), '|');
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
AnalyticRecord record = new AnalyticRecord();
record.serializeLine(nextLine);
// Generate json
String json = mapper.writeValueAsString(record);
IndexResponse response = mClient.getClient().prepareIndex("sdk_sync_log", "sdk_sync")
.setSource(json)
.execute()
.actionGet();
// Recording Metrics
metrics.sent();
}
}
metrics.stopRecording();
return metrics;
I have the following questions: 我有以下问题:
Thx in advance. 提前谢谢。
PS: the Elasticsearch version I am using on both client and server is 1.0.0. PS:我在客户端和服务器上使用的Elasticsearch版本是1.0.0。
Elasticsearch index response has isCreated()
method that returns true
if the document is a new one or false
if it has been updated and can be used to see if the document was successfully inserted/updated. Elasticsearch索引响应具有isCreated()
方法,如果文档是新文档,则返回true
如果文档已更新,则返回false
,可用于查看文档是否已成功插入/更新。
If bulk indexing is not an option there are other areas that could be tweaked to improve performance like 如果不能选择批量索引,则可以对其他领域进行调整以提高性能,例如
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.