| |
| |
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| |
| <meta name="description" content="Apache Ozone Documentation"> |
| |
| <title>Documentation for Apache Ozone</title> |
| |
| |
| <link href="../../css/bootstrap.min.css" rel="stylesheet"> |
| |
| |
| <link href="../../css/ozonedoc.css" rel="stylesheet"> |
| |
| </head> |
| |
| |
| <body> |
| |
| |
| <nav class="navbar navbar-inverse navbar-fixed-top"> |
| <div class="container-fluid"> |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar" aria-expanded="false" aria-controls="navbar"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a href="../../zh/index.html" class="navbar-left ozone-logo"> |
| <img src="../../ozone-logo-small.png"/> |
| </a> |
| <a class="navbar-brand hidden-xs" href="../../zh/index.html"> |
| Apache Ozone/HDDS documentation |
| </a> |
| <a class="navbar-brand visible-xs-inline" href="#">Apache Ozone</a> |
| </div> |
| <div id="navbar" class="navbar-collapse collapse"> |
| <ul class="nav navbar-nav navbar-right"> |
| <li><a href="https://github.com/apache/hadoop-ozone">Source</a></li> |
| <li><a href="https://hadoop.apache.org">Apache Hadoop</a></li> |
| <li><a href="https://apache.org">ASF</a></li> |
| </ul> |
| </div> |
| </div> |
| </nav> |
| |
| |
| <div class="wrapper"> |
| <div class="container-fluid"> |
| <div class="row"> |
| |
| <div class="col-sm-2 col-md-2 sidebar" id="sidebar"> |
| <ul class="nav nav-sidebar"> |
| |
| |
| |
| <li class=""> |
| |
| <a href="../../zh/index.html"> |
| |
| |
| |
| <span>概述</span> |
| </a> |
| </li> |
| |
| |
| |
| <li class=""> |
| |
| <a href="../../zh/start.html"> |
| |
| |
| |
| <span>快速入门</span> |
| </a> |
| </li> |
| |
| |
| |
| <li class=""> |
| <a href="../../zh/concept.html"> |
| |
| <span>概念</span> |
| </a> |
| <ul class="nav"> |
| |
| <li class=""> |
| |
| <a href="../../zh/concept/overview.html">概览</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/concept/ozonemanager.html">Ozone Manager</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/concept/storagecontainermanager.html">Storage Container Manager</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/concept/datanodes.html">数据节点</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/concept/containers.html">Containers</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/concept/recon.html">Recon</a> |
| |
| </li> |
| |
| </ul> |
| </li> |
| |
| |
| |
| <li class=""> |
| <a href="../../zh/feature.html"> |
| |
| <span>特点</span> |
| </a> |
| <ul class="nav"> |
| |
| <li class=""> |
| |
| <a href="../../zh/feature/ha.html">高可用</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/security/gdpr.html">Ozone 中的 GDPR</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/feature/quota.html">Ozone中的配额</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/feature/recon.html">Recon 服务器</a> |
| |
| </li> |
| |
| </ul> |
| </li> |
| |
| |
| |
| <li class=""> |
| <a href="../../zh/security.html"> |
| |
| <span>安全</span> |
| </a> |
| <ul class="nav"> |
| |
| <li class=""> |
| |
| <a href="../../zh/security/secureozone.html">安全化 Ozone</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/security/securingtde.html">透明数据加密</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/security/securings3.html">安全化 S3</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/security/securitywithranger.html">Apache Ranger</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/security/securityacls.html">Ozone 访问控制列表</a> |
| |
| </li> |
| |
| </ul> |
| </li> |
| |
| |
| |
| <li class=""> |
| <a href="../../zh/interface.html"> |
| |
| <span>编程接口</span> |
| </a> |
| <ul class="nav"> |
| |
| <li class=""> |
| |
| <a href="../../zh/interface/javaapi.html">Java API</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/interface/o3fs.html">Ozone 文件系统</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/interface/csi.html">CSI 协议</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/interface/s3.html">S3 协议接口</a> |
| |
| </li> |
| |
| <li class=""> |
| |
| <a href="../../zh/interface/reconapi.html">Recon API</a> |
| |
| </li> |
| |
| </ul> |
| </li> |
| |
| |
| |
| <li class=""> |
| |
| <a href="../../zh/tools.html"> |
| |
| |
| |
| <span>工具</span> |
| </a> |
| </li> |
| |
| |
| |
| <li class=""> |
| |
| <a href="../../zh/recipe.html"> |
| |
| |
| |
| <span>使用配方</span> |
| </a> |
| </li> |
| |
| |
| <li><a href="../../design.html"><span><b>Design docs</b></span></a></li> |
| <li class="visible-xs"><a href="#">References</a> |
| <ul class="nav"> |
| <li><a href="https://github.com/apache/hadoop"><span class="glyphicon glyphicon-new-window" aria-hidden="true"></span> Source</a></li> |
| <li><a href="https://hadoop.apache.org"><span class="glyphicon glyphicon-new-window" aria-hidden="true"></span> Apache Hadoop</a></li> |
| <li><a href="https://apache.org"><span class="glyphicon glyphicon-new-window" aria-hidden="true"></span> ASF</a></li> |
| </ul></li> |
| </ul> |
| |
| </div> |
| |
| <div class="col-sm-10 col-sm-offset-2 col-md-10 col-md-offset-2 main"> |
| |
| |
| |
| <div class="col-md-9"> |
| <nav aria-label="breadcrumb"> |
| <ol class="breadcrumb"> |
| <li class="breadcrumb-item"><a href="../../zh/index.html">Home</a></li> |
| <li class="breadcrumb-item" aria-current="page"><a href="../../zh/tools.html">工具</a></li> |
| <li class="breadcrumb-item active" aria-current="page">测试工具</li> |
| </ol> |
| </nav> |
| |
| |
| |
| <div class="pull-right"> |
| |
| |
| |
| <a href="../../tools/testtools.html"><span class="label label-success">English</span></a> |
| |
| |
| |
| |
| </div> |
| |
| |
| <div class="col-md-9"> |
| <h1>测试工具</h1> |
| |
| <!--- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <p>测试是开发分布式系统中最重要的部分,我们提供了以下类型的测试。</p> |
| <p>本页面给出了 Ozone 自带的测试工具。</p> |
| <p>注意:我们还进行了其它测试(比如通过 Spark 或 Hive 进行的 TCP-DS、TCP-H),但因为它们是外部工具,所以没有在此列出。</p> |
| <h2 id="单元测试">单元测试</h2> |
| <p>和每个 java 项目一样,我们的每个项目都包含传统的单元测试。</p> |
| <h2 id="集成测试junit">集成测试(JUnit)</h2> |
| <p>传统的单元测试只能测试一个单元,但我们也有更高层次的单元测试。它们使用 <code>MiniOzoneCluster</code> 辅助方法在单元测试中启动守护进程(SCM、OM、数据节点)。</p> |
| <p>从 maven 或 java 的角度来看,集成测试也只是普通的单元测试而已(使用了 JUnit 库),但为了解决一些依赖问题,我们将它们单独放在了 <code>hadoop-ozone/integration-test</code> 目录下。</p> |
| <h2 id="冒烟测试">冒烟测试</h2> |
| <p>我们使用基于 docker-compose 的伪集群来运行不同配置的 Ozone,为了确保这些配置可用,我们在 <a href="https://robotframework.org/">https://robotframework.org/</a> 的帮助下实现了 <em>验收</em> 测试。</p> |
| <p>冒烟测试包含在发行包中(<code>./smoketest</code>),但 robot 文件只定义了运行命令行然后检查输出的测试。</p> |
| <p>为了在不同环境(docker-compose、kubernetes)下运行冒烟测试,你需要定义如何启动容器,然后在正确的容器中执行正确的测试。</p> |
| <p>这部分的测试包含在 <code>compose</code> 目录中(查看 <code>./compose/*/test.sh</code> 或者 <code>./compose/test-all.sh</code>)。</p> |
| <p>例如,一种测试分发包的简单方法是:</p> |
| <pre><code>cd compose/ozone |
| ./test.sh |
| </code></pre><h2 id="blockade">Blockade</h2> |
| <p><a href="https://github.com/worstcase/blockade">Blockade</a> 是一个测试网络故障和分片的工具(灵感来自于大名鼎鼎的<a href="https://jepsen.io/analyses">Jepsen 测试</a>)。</p> |
| <p>Blockade 测试在其它测试的基础上实现,可以在分发包中的 <code>./blockade</code> 目录下进行测试。</p> |
| <pre><code>cd blocakde |
| pip install pytest==2.8.7,blockade |
| python -m pytest -s . |
| </code></pre><p>更多细节查看 blockade 目录下的 README。</p> |
| <h2 id="minichaosozonecluster">MiniChaosOzoneCluster</h2> |
| <p>这是一种在你的机器上获得<a href="https://en.wikipedia.org/wiki/Chaos_engineering">混沌</a>的方法。它可以直接从源码启动一个 MiniOzoneCluster |
| (会启动真实的守护进程),并随机杀死它。</p> |
| <h2 id="freon">Freon</h2> |
| <p>Freon 是 Ozone 发行包中包含的命令行应用,它是一个负载生成器,用于压力测试。</p> |
| <p>随机生成Key:</p> |
| <p>在randomkeys模式下,写入Ozone的数据是随机生成的。每个键的大小为10 KB。</p> |
| <p>volume/bucket/key的数量是可以配置的。副本type和factor(例如: 3个节点使用ratis控制副本)也可以配置。</p> |
| <p>更多信息,可使用如下命令查看:</p> |
| <p>bin/ozone freon –help</p> |
| <p>例如:</p> |
| <pre><code>ozone freon randomkeys --num-of-volumes=10 --num-of-buckets 10 --num-of-keys 10 --replication-type=RATIS --factor=THREE |
| </code></pre><pre><code>*************************************************** |
| Status: Success |
| Git Base Revision: 48aae081e5afacbb3240657556b26c29e61830c3 |
| Number of Volumes created: 10 |
| Number of Buckets created: 100 |
| Number of Keys added: 1000 |
| Ratis replication factor: THREE |
| Ratis replication type: RATIS |
| Average Time spent in volume creation: 00:00:00,035 |
| Average Time spent in bucket creation: 00:00:00,319 |
| Average Time spent in key creation: 00:00:03,659 |
| Average Time spent in key write: 00:00:10,894 |
| Total bytes written: 10240000 |
| Total Execution time: 00:00:16,898 |
| *********************** |
| </code></pre><h2 id="genesis">Genesis</h2> |
| <p>Genesis 是一个微型的基准测试工具,它也包含在发行包中(<code>ozone genesis</code>),但是它不需要一个真实的集群,而是采用一种隔离的方法测试不同部分的代码(比如,将数据存储到本地基于 RocksDB 的键值存储中)。</p> |
| <p>运行示例:</p> |
| <pre><code> ozone genesis -benchmark=BenchMarkRocksDbStore |
| # JMH version: 1.19 |
| # VM version: JDK 11.0.1, VM 11.0.1+13-LTS |
| # VM invoker: /usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java |
| # VM options: -Dproc_genesis -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/var/log/hadoop -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/opt/hadoop -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,console -Dhadoop.policy.file=hadoop-policy.xml -Dhadoop.security.logger=INFO,NullAppender |
| # Warmup: 2 iterations, 1 s each |
| # Measurement: 20 iterations, 1 s each |
| # Timeout: 10 min per iteration |
| # Threads: 4 threads, will synchronize iterations |
| # Benchmark mode: Throughput, ops/time |
| # Benchmark: org.apache.hadoop.ozone.genesis.BenchMarkRocksDbStore.test |
| # Parameters: (backgroundThreads = 4, blockSize = 8, maxBackgroundFlushes = 4, maxBytesForLevelBase = 512, maxOpenFiles = 5000, maxWriteBufferNumber = 16, writeBufferSize = 64) |
| |
| # Run progress: 0.00% complete, ETA 00:00:22 |
| # Fork: 1 of 1 |
| # Warmup Iteration 1: 213775.360 ops/s |
| # Warmup Iteration 2: 32041.633 ops/s |
| Iteration 1: 196342.348 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 2: 41926.816 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 3: 210433.231 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 4: 46941.951 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 5: 212825.884 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 6: 145914.351 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 7: 141838.469 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 8: 205334.438 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 9: 163709.519 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 10: 162494.608 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 11: 199155.793 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 12: 209679.298 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 13: 193787.574 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 14: 127004.147 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 15: 145511.080 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 16: 223433.864 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 17: 169752.665 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 18: 165217.191 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 19: 191038.476 ops/s |
| ?stack: <delayed till summary> |
| |
| Iteration 20: 196335.579 ops/s |
| ?stack: <delayed till summary> |
| |
| |
| |
| Result "org.apache.hadoop.ozone.genesis.BenchMarkRocksDbStore.test": |
| 167433.864 ?(99.9%) 43530.883 ops/s [Average] |
| (min, avg, max) = (41926.816, 167433.864, 223433.864), stdev = 50130.230 |
| CI (99.9%): [123902.981, 210964.748] (assumes normal distribution) |
| |
| Secondary result "org.apache.hadoop.ozone.genesis.BenchMarkRocksDbStore.test:?stack": |
| Stack profiler: |
| |
| ....[Thread state distributions].................................................................... |
| 78.9% RUNNABLE |
| 20.0% TIMED_WAITING |
| 1.1% WAITING |
| |
| ....[Thread state: RUNNABLE]........................................................................ |
| 59.8% 75.8% org.rocksdb.RocksDB.put |
| 16.5% 20.9% org.rocksdb.RocksDB.get |
| 0.7% 0.9% java.io.UnixFileSystem.delete0 |
| 0.7% 0.9% org.rocksdb.RocksDB.disposeInternal |
| 0.3% 0.4% java.lang.Long.formatUnsignedLong0 |
| 0.1% 0.2% org.apache.hadoop.ozone.genesis.BenchMarkRocksDbStore.test |
| 0.1% 0.1% java.lang.Long.toUnsignedString0 |
| 0.1% 0.1% org.apache.hadoop.ozone.genesis.generated.BenchMarkRocksDbStore_test_jmhTest.test_thrpt_jmhStub |
| 0.0% 0.1% java.lang.Object.clone |
| 0.0% 0.0% java.lang.Thread.currentThread |
| 0.4% 0.5% <other> |
| |
| ....[Thread state: TIMED_WAITING]................................................................... |
| 20.0% 100.0% java.lang.Object.wait |
| |
| ....[Thread state: WAITING]......................................................................... |
| 1.1% 100.0% jdk.internal.misc.Unsafe.park |
| |
| |
| |
| # Run complete. Total time: 00:00:38 |
| |
| Benchmark (backgroundThreads) (blockSize) (maxBackgroundFlushes) (maxBytesForLevelBase) (maxOpenFiles) (maxWriteBufferNumber) (writeBufferSize) Mode Cnt Score Error Units |
| BenchMarkRocksDbStore.test 4 8 4 512 5000 16 64 thrpt 20 167433.864 ? 43530.883 ops/s |
| BenchMarkRocksDbStore.test:?stack 4 8 4 512 5000 16 64 thrpt NaN --- |
| </code></pre> |
| |
| |
| </div> |
| |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="push"></div> |
| </div> |
| |
| |
| |
| <footer class="footer"> |
| <div class="container"> |
| <span class="small text-muted"> |
| Version: 1.1.0, Last Modified: October 5, 2020 <a class="hide-child link primary-color" href="https://github.com/apache/ozone/commit/4ad03188ed4fbbe8d6dce1e8e0c8d91518904fc1">4ad03188e</a> |
| </span> |
| </div> |
| </footer> |
| |
| |
| |
| <script src="../../js/jquery-3.5.1.min.js"></script> |
| <script src="../../js/ozonedoc.js"></script> |
| <script src="../../js/bootstrap.min.js"></script> |
| |
| |
| </body> |
| |
| </html> |