小编sta*_*max的帖子

过多的ERROR日志使用Spring SockJS和非websocket传输失败

我们使用Spring的SockJS和Stomp将推送消息发送到浏览器.它到目前为止工作正常,但是当客户端(浏览器)断开连接时,我们每次都会收到一个ERROR日志,因为预定的听力会失败:

11:11:18.241 [MessageBroker-1] ERROR [org.springframework.scheduling.support.TaskUtils $ LoggingErrorHandler] - 计划任务中发生意外错误.org.springframework.web.socket.sockjs.SockJsTransportFailureException:无法写入SockJsFrame content ='h'; 嵌套异常是org.apache.catalina.connector.ClientAbortException:java.io.IOException:在org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:339)〜[spring- websocket-4.3.4.RELEASE.jar:4.3.4.RELEASE] at org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession.writeFrame(PollingSockJsSession.java:82)〜[spring-websocket-4.3.4 .RELEASE.jar:4.3.4.RELEASE]在org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:255)〜[spring-websocket-4.3.4.RELEASE.jar: 4.3.4.RELEASE]在org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession $ HeartbeatTask.run(AbstractSockJsSession.java:451)〜[spring-websocket-4.3.4.RELEASE.jar:4.3.4 .RELEASE] org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)〜[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]

但只有当客户端使用XHR-Polling后备时,websocket才会导致任何错误.我们在tomcat 8.0.39前面使用nginx作为反向代理.Nginx在SockJsTransportFailureException上升前几秒记录499(客户端关闭连接)

当心跳失败时,有没有办法摆脱ERROR日志?我不想禁用org.springframework.scheduling.support.TaskUtils中的所有日志记录,因为我们可能会错过重要的错误.

spring spring-websocket

7
推荐指数
0
解决办法
1037
查看次数

使用svn 1.8创建的存储库具有格式5而不是6

我刚刚从wandisco安装了svn 1.8.1以使用1.8的新功能.当我使用创建新的存储库时

svnadmin create test6
Run Code Online (Sandbox Code Playgroud)

文件test6/format中的格式仍为5(如<= 1.7).

# svnadmin --version
svnadmin, Version 1.8.1 (r1503906)
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?或者我在寻找新格式的错误位置?

svn

6
推荐指数
1
解决办法
3369
查看次数

列出ThreadPoolTask​​Executor中所有正在运行/排队的线程

我在Spring中使用ThreadPoolTask​​Executor来安排我的任务.

有没有办法获得该任务执行器/池的每个运行和排队线程的列表或内容?

java java.util.concurrent threadpool threadpoolexecutor

6
推荐指数
1
解决办法
5899
查看次数

如何在Elasticsearch集群上最大化CPU核心

我必须设置多少个分片和副本才能在我的群集中使用每个cpu核心(我想要100%加载,最快的查询结果)?

我想使用Elasticsearch进行聚合.我读到Elasticsearch使用多个cpu内核,但没有找到关于分片和副本的cpu内核的确切细节.

我的观察是,单个分片在查询时不使用超过1个核心/线程(考虑到一次只有一个查询).对于副本,1-shard索引的查询速度不快,因为Elasticsearch似乎不使用其他节点在分片上分配负载.

我的问题(一次一个查询):

  • 分片不使用多个cpu核心?
  • 必须始终完全扫描碎片,复制品不能用于划分节点之间的碎片内负载?
  • 最佳性能的公式是SUM(每个节点的CPU_CORES)*PRIMARY_SHARDS?

elasticsearch

6
推荐指数
1
解决办法
3540
查看次数

如何在 Apache Flink 中并行写入接收器

我有一个并行度为 8 的映射数据流。我向数据流添加了两个接收器。一种是慢速(Elasticsearch),另一种是快速(HDFS)。然而,我的事件只有在刷新到 ES 后才会写入 HDFS,因此使用 ES 比不使用 ES 需要更长的时间。

dataStream.setParallelism(8);
dataStream.addSink(elasticsearchSink);
dataStream.addSink(hdfsSink);
Run Code Online (Sandbox Code Playgroud)

在我看来,两个水槽都使用相同的线程。是否可以通过使用具有两个接收器的相同源来实现,或者我是否必须添加另一项工作(每个接收器一个)来并行写入输出?

我在日志中检查了 Map(1/8) 到 Map(8/8) 正在部署并接收数据。

apache-flink flink-streaming

6
推荐指数
1
解决办法
5534
查看次数

通过spring-security和ldap进行集成测试

单元测试中的Spring嵌入式ldap服务器与之类似,但是没有给出适合我的答案。

我可以使用spring和spring-security的嵌入式ldap服务器运行集成测试,而不会出现任何问题。但是,我还没有找到清除嵌入式ldap服务器并再次加载ldif以提供通用测试环境的方法。

spring-ldap的LdapTestUtils提供了cleanAndSetup()方法。但是,这不适用于apache-ds的建议版本(1.5.5),因为LdifFileLoader现在需要CoreSession而不是LdapTestUtils提供的DirContext。这导致

java.lang.NoSuchMethodError:
org.apache.directory.server.protocol.shared.store.LdifFileLoader.<init>(Ljavax/naming/directory/DirContext;Ljava/lang/String;)
Run Code Online (Sandbox Code Playgroud)

我只想要一种清除嵌入式ldap服务器并再次用ldif文件填充它的方法(如启动时所做的那样)。有人对此有想法吗?

版本:spring 3.1,spring-ldap 1.3,spring-security 3.1,apache-ds 1.5.5

解决方案(感谢卢克·泰勒):

@Inject
private ApplicationContext applicationContext;

@Before
public void reloadLdapDirectory() throws NamingException, IOException{
    ApacheDSContainer apacheDSContainer = (ApacheDSContainer) applicationContext.getBean(BeanIds.EMBEDDED_APACHE_DS);
    LdapTestUtils.clearSubContexts(contextSource, DistinguishedName.EMPTY_PATH);

    ClassPathResource classPathResource = new ClassPathResource("ldap.ldif");

    File tempFile = File.createTempFile("spring_ldap_test", ".ldif");
    try {
        InputStream inputStream = classPathResource.getInputStream();
        IOUtils.copy(inputStream, new FileOutputStream(tempFile));
        LdifFileLoader fileLoader = new LdifFileLoader(apacheDSContainer.getService().getAdminSession(), tempFile.getAbsolutePath());
        fileLoader.execute();
    }
    finally {
        try {
            tempFile.delete();
        }
        catch (Exception e) {
            // Ignore this
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

integration-testing spring-security spring-ldap

5
推荐指数
1
解决办法
7485
查看次数

Elasticsearch - 计算嵌套聚合相对于父存储桶的百分比

更新的问题

在我的查询中,我先聚合日期,然后聚合传感器名称。是否可以根据父存储桶的嵌套聚合和文档总数(或任何其他聚合)计算比率?查询示例:

{
  "size": 0,
  "aggs": {
    "over_time": {
      "aggs": {
        "by_date": {
          "date_histogram": {
            "field": "date",
            "interval": "1d",
            "min_doc_count": 0
          },
          "aggs": {
            "measure_count": {
              "cardinality": {
                "field": "date"
              }
            },
            "all_count": {
              "value_count": {
                "field": "name"
              }
            },
            "by_name": {
              "terms": {
                "field": "name",
                "size": 0
              },
              "aggs": {
                "count_by_name": {
                  "value_count": {
                    "field": "name"
                  }
                },
                "my ratio": count_by_name / all_count * 100 <-- How to do that?
              }
            }
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我想要一个自定义指标,它可以给出count_by_name …

aggregation bucket elasticsearch date-histogram

5
推荐指数
1
解决办法
4002
查看次数