- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
更新 2018 年 8 月 15 日我执行strace监控系统调用mprotect,发现确实被阻塞了几秒。
strace -f -e trace=mprotect,mmap,munmap -T -t -p `pidof java` 2>&1 |tee mp1.txt
[pid 27007] 03:52:48 mprotect(0x7f9766226000, 4096, PROT_NONE) = 0 <3.631704>
但我没有确定原因。
更新 2018 年 8 月 14 日我发现这是一个 JVM STW 事件。我使用以下选项调试了 JVM
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintSafepointStatistics
-XX:PrintSafepointStatisticsCount=1
-XX:+SafepointTimeout
-XX:SafepointTimeoutDelay=500
下面有一些日志
vmop [threads: total initially_running wait_to_block] [time: spin block sync cleanup vmop] page_trap_count
488.188: no vm operation [ 73 1 1 ] [ 1 0 3301 0 0 ] 1
2018-08-13T22:16:09.744-0400: 491.491: Total time for which application threads were stopped: 3.3021375 seconds, Stopping threads took: 3.3018193 seconds
奇怪的是自旋/阻塞时间为零,而同步时间为 3301。我基于open jdk 1.8 编译了一个JVM,并添加了一些调试日志,我发现它被阻止在下面的代码上,
void SafepointSynchronize::begin() {
... ...
if (UseCompilerSafepoints && DeferPollingPageLoopCount < 0) {
// Make polling safepoint aware
guarantee (PageArmed == 0, "invariant") ;
PageArmed = 1 ;
os::make_polling_page_unreadable();
}
... ...
}
在os::make_polling_page_unreadable函数中,调用::mprotect有信号量依赖,
down_write(¤t->mm->mmap_sem);
我怀疑信号量 mmap_sem 争用会导致此 STW 事件。但是不知道是哪个函数导致的?有什么帮助吗?
原始问题
我现在正在测试 Kafka 的性能。我在具有 6 个节点的集群中创建了一个主题,该集群具有 36 个分区和 4 个副本。一个 zookeeper 节点运行在一个单独的节点上。
kafka-topics --create --topic kf.p36.r4 --zookeeper l2 --partitions 36 --replication-factor 4
[root@g9csf002-0-0-3 kafka]# kafka-topics --describe --zookeeper l2 --topic kf.p36.r4
Topic:kf.p36.r4 PartitionCount:36 ReplicationFactor:4 Configs:
Topic: kf.p36.r4 Partition: 0 Leader: 1 Replicas: 1,5,6,2 Isr: 5,2,6,1
Topic: kf.p36.r4 Partition: 1 Leader: 2 Replicas: 2,6,1,3 Isr: 1,3,6,2
Topic: kf.p36.r4 Partition: 2 Leader: 3 Replicas: 3,1,2,4 Isr: 3,4,2,1
Topic: kf.p36.r4 Partition: 3 Leader: 4 Replicas: 4,2,3,5 Isr: 3,2,4,5
Topic: kf.p36.r4 Partition: 4 Leader: 5 Replicas: 5,3,4,6 Isr: 3,6,4,5
Topic: kf.p36.r4 Partition: 5 Leader: 6 Replicas: 6,4,5,1 Isr: 4,5,6,1
Topic: kf.p36.r4 Partition: 6 Leader: 1 Replicas: 1,6,2,3 Isr: 3,6,2,1
Topic: kf.p36.r4 Partition: 7 Leader: 2 Replicas: 2,1,3,4 Isr: 3,4,2,1
Topic: kf.p36.r4 Partition: 8 Leader: 3 Replicas: 3,2,4,5 Isr: 3,2,4,5
Topic: kf.p36.r4 Partition: 9 Leader: 4 Replicas: 4,3,5,6 Isr: 3,6,4,5
Topic: kf.p36.r4 Partition: 10 Leader: 5 Replicas: 5,4,6,1 Isr: 4,5,6,1
Topic: kf.p36.r4 Partition: 11 Leader: 6 Replicas: 6,5,1,2 Isr: 5,2,6,1
Topic: kf.p36.r4 Partition: 12 Leader: 1 Replicas: 1,2,3,4 Isr: 3,4,2,1
Topic: kf.p36.r4 Partition: 13 Leader: 2 Replicas: 2,3,4,5 Isr: 3,2,4,5
Topic: kf.p36.r4 Partition: 14 Leader: 3 Replicas: 3,4,5,6 Isr: 3,6,4,5
Topic: kf.p36.r4 Partition: 15 Leader: 4 Replicas: 4,5,6,1 Isr: 4,5,6,1
Topic: kf.p36.r4 Partition: 16 Leader: 5 Replicas: 5,6,1,2 Isr: 5,2,6,1
Topic: kf.p36.r4 Partition: 17 Leader: 6 Replicas: 6,1,2,3 Isr: 3,2,6,1
Topic: kf.p36.r4 Partition: 18 Leader: 1 Replicas: 1,3,4,5 Isr: 3,4,5,1
Topic: kf.p36.r4 Partition: 19 Leader: 2 Replicas: 2,4,5,6 Isr: 6,2,4,5
Topic: kf.p36.r4 Partition: 20 Leader: 3 Replicas: 3,5,6,1 Isr: 3,5,6,1
Topic: kf.p36.r4 Partition: 21 Leader: 4 Replicas: 4,6,1,2 Isr: 4,2,6,1
Topic: kf.p36.r4 Partition: 22 Leader: 5 Replicas: 5,1,2,3 Isr: 3,5,2,1
Topic: kf.p36.r4 Partition: 23 Leader: 6 Replicas: 6,2,3,4 Isr: 3,6,2,4
Topic: kf.p36.r4 Partition: 24 Leader: 1 Replicas: 1,4,5,6 Isr: 4,5,6,1
Topic: kf.p36.r4 Partition: 25 Leader: 2 Replicas: 2,5,6,1 Isr: 1,6,2,5
Topic: kf.p36.r4 Partition: 26 Leader: 3 Replicas: 3,6,1,2 Isr: 3,2,6,1
Topic: kf.p36.r4 Partition: 27 Leader: 4 Replicas: 4,1,2,3 Isr: 3,4,2,1
Topic: kf.p36.r4 Partition: 28 Leader: 5 Replicas: 5,2,3,4 Isr: 3,2,4,5
Topic: kf.p36.r4 Partition: 29 Leader: 6 Replicas: 6,3,4,5 Isr: 3,6,4,5
Topic: kf.p36.r4 Partition: 30 Leader: 1 Replicas: 1,5,6,2 Isr: 5,2,6,1
Topic: kf.p36.r4 Partition: 31 Leader: 2 Replicas: 2,6,1,3 Isr: 1,3,6,2
Topic: kf.p36.r4 Partition: 32 Leader: 3 Replicas: 3,1,2,4 Isr: 3,4,2,1
Topic: kf.p36.r4 Partition: 33 Leader: 4 Replicas: 4,2,3,5 Isr: 3,2,4,5
Topic: kf.p36.r4 Partition: 34 Leader: 5 Replicas: 5,3,4,6 Isr: 3,6,4,5
Topic: kf.p36.r4 Partition: 35 Leader: 6 Replicas: 6,4,5,1 Isr: 4,5,6,1
我运行了两个生产者实例,kafka-producer-perf-test
kafka-producer-perf-test --topic kf.p36.r4 --num-records 600000000 --record-size 1024 --throughput 120000 --producer-props bootstrap.servers=b3:9092,b4:9092,b5:9092,b6:9092,b7:9092,b8:9092 acks=1
总流量为 240k tps,每条消息为 1024 字节。当我跑240k tps的流量时,一开始一切正常,但过了一段时间,出现了一些错误信息。
[root@g9csf002-0-0-1 ~]# kafka-producer-perf-test --topic kf.p36.r4 --num-records 600000000 --record-size 1024 --throughput 120000 --producer-props bootstrap.servers=b3:9092,b4:9092,b5:9092,b6:9092,b7:9092,b8:9092 acks=1
599506 records sent, 119901.2 records/sec (117.09 MB/sec), 4.8 ms avg latency, 147.0 max latency.
600264 records sent, 120052.8 records/sec (117.24 MB/sec), 2.0 ms avg latency, 13.0 max latency.
599584 records sent, 119916.8 records/sec (117.11 MB/sec), 1.9 ms avg latency, 13.0 max latency.
600760 records sent, 120152.0 records/sec (117.34 MB/sec), 1.9 ms avg latency, 13.0 max latency.
599764 records sent, 119904.8 records/sec (117.09 MB/sec), 2.0 ms avg latency, 35.0 max latency.
276603 records sent, 21408.9 records/sec (20.91 MB/sec), 103.0 ms avg latency, 10743.0 max latency.
org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition.
org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition.
org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition.
org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition.
org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition.
我研究了kafka broker的日志,发现broker和zookeeper之间的通信有问题。
[2018-08-06 01:28:02,562] WARN Client session timed out, have not heard from server in 7768ms for sessionid 0x164f8ea86020062 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,562] INFO Client session timed out, have not heard from server in 7768ms for sessionid 0x164f8ea86020062, clo
zookeeper客户端是zookeeper-3.4.10.jar,我下载了代码并添加了一些日志到src/java/main/org/apache/zookeeper/ClientCnxn.java
发现SendThread访问变量state时有时会被阻塞
[2018-08-06 01:27:54,793] INFO ROVER: start of loop. (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:27:54,793] INFO ROVER: state = CONNECTED (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:27:54,793] INFO ROVER: to = 4000 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:27:54,793] INFO ROVER: timeToNextPing = 2000 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:27:54,793] INFO ROVER: before clientCnxnSocket.doTransport, to = 2000 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:27:56,795] INFO ROVER: after clientCnxnSocket.doTransport (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: state = CONNECTED (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: start of loop. (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: state = CONNECTED (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: to = 1998 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: timeToNextPing = -1002 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: sendPing has done. (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: before clientCnxnSocket.doTransport, to = 1998 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: after clientCnxnSocket.doTransport (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: state = CONNECTED (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: start of loop. (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: state = CONNECTED (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,561] INFO ROVER: to = -3768 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,562] WARN Client session timed out, have not heard from server in 7768ms for sessionid 0x164f8ea86020062 (org.apache.zookeeper.ClientCnxn)
[2018-08-06 01:28:02,562] INFO Client session timed out, have not heard from server in 7768ms for sessionid 0x164f8ea86020062, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
可以发现在2018-08-06 01:27:56和2018-08-06 01:28:02之间,线程被阻塞了,什么都不做.更改后的代码如下所示,
// If we are in read-only mode, seek for read/write server
if (state == States.CONNECTEDREADONLY) {
long now = System.currentTimeMillis();
int idlePingRwServer = (int) (now - lastPingRwServer);
if (idlePingRwServer >= pingRwTimeout) {
lastPingRwServer = now;
idlePingRwServer = 0;
pingRwTimeout =
Math.min(2*pingRwTimeout, maxPingRwTimeout);
pingRwServer();
}
to = Math.min(to, pingRwTimeout - idlePingRwServer);
}
LOG.info("ROVER: before clientCnxnSocket.doTransport, to = " + to );
clientCnxnSocket.doTransport(to, pendingQueue, outgoingQueue, ClientCnxn.this);
LOG.info("ROVER: after clientCnxnSocket.doTransport");
LOG.info("ROVER: state = " + state);
} catch (Throwable e) {
安装的kafka是confluent-kafka-2.11,而java是
[root@g9csf0002-0-0-12 kafka]# java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
现在我不知道如何解决这个问题,任何人都可以对此有所了解吗?
最佳答案
我以前遇到过这个问题,有时 Kafka JVM 会长时间进行垃圾收集,或者内部网络发生了一些奇怪的事情。我注意到在我们的案例中超时都在 6 秒或 7 秒左右(这看起来与您的相似)。问题是,如果 Kafka 不能在指定的时间段内访问 zookeeper,它就会崩溃,它开始报告复制不足的分区,时不时地导致整个集群宕机。因此,如果我没记错的话,我们将超时时间增加到 15 秒,之后一切正常,错误为零。
这些是kafka broker的相应设置:
zookeeper.session.timeout.ms Default: 6000ms
zookeeper.connection.timeout.ms
我们都改变了,IIRC,但你应该先尝试改变 session
配置。
关于java - 运行 Kafka 性能流量时出现错误 "This server is not the leader for that topic-partition",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51705961/
本周我将在 Windows Server 2008 上设置一个专用的 SQL Server 2005 机器,并希望将其精简为尽可能简单,同时仍能发挥全部功能。 为此,“服务器核心”选项听起来很有吸引力
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 已关闭 8 年前。 Improve
我获取了 2014 版本数据库的备份,并尝试在另一台服务器中将其恢复到具有相同名称和登录名的数据库中。此 SQL Server 版本是 2016。 恢复备份文件时,出现此错误: TITLE: Micr
我获取了 2014 版本数据库的备份,并尝试在另一台服务器中将其恢复到具有相同名称和登录名的数据库中。此 SQL Server 版本是 2016。 恢复备份文件时,出现此错误: TITLE: Micr
TFS 是否提供任何增强的方法来存储对 sql server 数据库所做的更改,而不是使用它来对在数据库上执行的 sql 语句的文本文件进行版本控制? 或者我正在寻找的功能是否仅在第 3 方工具(如
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 9 年前。 Improve this ques
我即将将我的 SQL Server 2012 实例升级到 SQL Server 2014。 我已经克隆了主机 Windows VM 并将其重命名为 foo-2012至 foo-2014 . 重新启动时
我想为 SQL Server 登录授予对数据库的访问权限。我知道 sp_grantdbaccess,但它已被弃用。我可以改用什么以及如何检查登录名是否还没有访问数据库的权限? 场景:UserA 创建数
客户别无选择,只能在接下来的几天内从 sql server 2000 迁移到 2008。测试显示 2005 年的重要功能出现了 Not Acceptable 性能下降,但 2008 年却没有。好消息是
我有一个测试数据库,我需要将其导出到我们客户的测试环境中。 这将是一次性的工作。 我正在使用 SQL Server 2005(我的测试数据库是 SQL Server 2005 Express) 执行此
我需要将一个 CSV 文件导入到 mongoDB 不幸的是我遇到了以下错误: error connecting to host: could not connect to server: se
我以为 R2 是一个补丁/服务包。我一直在寻找下载,但没有看到。因此,我假设 R2 是一个新版本,并且我需要 sqlserver 2008 r2 的安装介质来进行升级? 另外,我需要为新许可证付费吗?
我无法使用 SQL Server Management Studio 连接到 SQL Server。 我有一个连接字符串: 我尝试通过在服务器名中输入 myIP、在登录名中输入 MyID、在密码中
我们希望使用 SQL Server 加密来加密数据库中的几个列。我们还需要在生产和测试环境之间传输数据。看来最好的解决方案是在生产和测试服务器上使用相同的主 key 、证书和对称 key ,以便我可以
有没有可以分析 SQL Server 数据库潜在问题的工具? 例如: a foreign key column that is not indexed 没有 FILL FACTOR 的 uniquei
我正在尝试从我的 SQL 2012 BI 版本建立复制,但我收到一条奇怪的错误消息! "You cannot create a publication from server 'X' because
如果您使用 SQL Server 身份验证 (2005),登录详细信息是否以明文形式通过网络发送? 最佳答案 如您所愿,安全无忧... 您可以相当轻松地配置 SSL,如果您没有受信任的证书,如果您强制
我想将数据从一个表复制到不同服务器之间的另一个表。 如果是在同一服务器和不同的数据库中,我使用了以下 SELECT * INTO DB1..TBL1 FROM DB2..TBL1 (to copy w
我希望得到一些帮助,因为我在这个问题上已经被困了 2 天了! 场景:我可以从我的开发计算机(和其他同事)连接到 SERVER\INSTANCE,但无法从另一个 SQL Server 连接。我得到的错误
我正在尝试从我的 SQL 2012 BI 版本建立复制,但我收到一条奇怪的错误消息! "You cannot create a publication from server 'X' because
我是一名优秀的程序员,十分优秀!