问题:
自从从 ES-5.4 升级到 ES-7.2 后,当我尝试从我的多线程 Java 应用程序(使用elasticsearch-rest-high-level-client-7.2.0.jar
java 客户端)写入并发批量请求(或/和搜索请求)时,我开始收到“数据太大”错误到 2-4 个节点的 ES 集群。
我的ES配置:
Elasticsearch version: 7.2
custom configuration in elasticsearch.yml:
thread_pool.search.queue_size = 20000
thread_pool.write.queue_size = 500
I use only the default 7.x circuit-breaker values, such as:
indices.breaker.total.limit = 95%
indices.breaker.total.use_real_memory = true
network.breaker.inflight_requests.limit = 100%
network.breaker.inflight_requests.overhead = 2
Run Code Online (Sandbox Code Playgroud)
来自 elasticsearch.log 的错误:
{
"error": {
"root_cause": [
{
"type": "circuit_breaking_exception",
"reason": "[parent] Data too large, data for [<http_request>] would be [3144831050/2.9gb], which is larger than the limit of …
Run Code Online (Sandbox Code Playgroud) 我想要并发的一组字符串值,按长度最长->最短排序。
这是我的代码(JAVA 8):
private ConcurrentSkipListSet<String> sortedSourceTypeNames = new ConcurrentSkipListSet<>(Comparator.comparing(String::length).reversed());
Run Code Online (Sandbox Code Playgroud)
这是Java 8文档:
/**
* Constructs a new, empty set that orders its elements according to
* the specified comparator.
*
* @param comparator the comparator that will be used to order this set.
* If {@code null}, the {@linkplain Comparable natural
* ordering} of the elements will be used.
*/
public ConcurrentSkipListSet(Comparator<? super E> comparator) {
m = new ConcurrentSkipListMap<E,Object>(comparator);
}
Run Code Online (Sandbox Code Playgroud)
现在这是奇怪的事情:
调试此现象后,我看到ConcurrentSkipListSet拒绝了新的唯一字符串,这些字符串的长度与集合中现有字符串的长度相同。
我就像瓦阿特(Waaaattt)?!?!? …
我有一个很简单的问题:)
根据伪装文档,它们支持通过api函数传递URI参数来动态更改伪装客户端对象的basePath,如下所示:
好例子:
interface MyClient {
@RequestLine("GET /internal-service")
String internalService(URI baseUrl);
}
Run Code Online (Sandbox Code Playgroud)
关键是我正在使用swagger,后者从yaml文件生成我的API,并将@Param注释添加到所有函数参数,这对我不利。
不良示例:
interface MyClient {
@RequestLine("GET {baseUrl}/internal-service")
String internalService(@Param("baseUrl") String host);
}
Run Code Online (Sandbox Code Playgroud)
有没有办法让摇摇欲坠的生成器生成带有URI参数的API,而无需@Param批注?
预期结果示例:
interface MyClient {
@RequestLine("POST /internal-service")
String internalService(URI baseUrl, @Param("someParam") String someParam);
}
Run Code Online (Sandbox Code Playgroud)