zookeeper

构建一个可编译的全 Java 环境

datadir 存放什么

服务器启动时做了什么

  • JettyAdminServer
  • NIOServerCnxnFactory
  • SessionTrackerImpl
  • 加载/创建 snapshot
  • ContainerManager

如何计算平均延迟

1
2
3
4
5
6
7
8
9
10
11
synchronized void updateLatency(long requestCreateTime) {
long latency = System.nanoTime() / 1000000 - requestCreateTime;
totalLatency += latency;
count++;
if (latency < minLatency) {
minLatency = latency;
}
if (latency > maxLatency) {
maxLatency = latency;
}
}

If you are interested in measuring/calculating elapsed time, then always use System.nanoTime().

推荐文章