* 본 포스팅은 하이퍼레저 캘리퍼 docs를 번역한 내용으로, 번역 과정에서 잘못된 부분이 있을 수 있습니다.

상세 내용은 하단 링크를 참조 부탁드리며, 잘못된 내용에 대한 피드백은 언제든 환영합니다 : ) 

https://hyperledger.github.io/caliper/docs/1_Getting_Started.html

 

Getting Started

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

Caliper Introduction

Caliper는 블록체인 성능 벤치마킹 프레임워크이며, 이는 사용자에게 이미 정의된 유즈케이스로 다른 블록체인 솔루션을 테스트할 수 있게 해주며 성능 테스트 결과를 제공합니다.

 

Currently supported blockchain solutions:

  • Hyperledger Burrow
  • Hyperledger Composer
  • Hyperledger Fabric
  • Hyperledger Iroha
  • Hyperledger Sawtooth

Currently supported performance indicators:

  • Success rate
  • Transaction/Read throughput
  • Transaction/Read latency(minimum, maximum, average, percentile)
  • Resource comsuption(CPU, Memory, Network IO,...)

측정 방법에 대한 정의를 보려면 PSWG를 참고하세요.

https://wiki.hyperledger.org/groups/pswg/performance-and-scale-wg

불러오는 중입니다...

 

Architecture

Architecture Introduection 페이지를 참고하세요.

https://hyperledger.github.io/caliper/docs/2_Architecture.html

 

Architecture

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

 

Pre-requisites

아래 도구들을 설치해주세요.

  • NodeJS 8 (LTX), 9, or 10 (LTS) 상위버전 호환은 지원되지 않습니다.
  • node-gyp
  • Docker
  • Docker-compose

Building Caliper

Caliper는 Lerna에서 여러 패키지로 나뉘어 집니다. Lerna는 여러 패키지로 JavaScript프로젝트를 관리하는 도구입니다. Caliper를 구축하려면 먼저 필요한 기본 종속성을 가져와 Caliper 프로젝트를 실행시켜야 합니다. 기본 코드를 수정하는 경우 프로젝트를 다시 빌드해야 합니다.

  • Caliper root 폴더에서 기본 종속성을 설치하기 위해 npm install을 실행하세요.
  • 패키지들이 빈 상태임을 확실히 하기 위해  npm run repoclean을 실행하세요.
  • Caliper repository에 있는 패키지를 실행하기 위해 npm run bootstrap을 실행하세요. 이 과정은 모든 패키지 종속성과 종속성 간 링크를 설치합니다. 설치에는 시간이 다소 소요될 수도 있습니다. ctrl+c로 중단될 경우, package.json 파일을 먼저 복구한 후 npm run bootstrap 명령어를 다시 실행하세요.

sudo를 사용해 위 명령어를 실행하지 마세요, bootstrap 과정이 실패합니다.

지원되는 블록체인 기술을 대상으로 하는 벤치마크 구성은 다음 링크를 참고하세요.

https://hyperledger.github.io/caliper/docs/Burrow_Configuration.html

 

Burrow Configuration

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

https://hyperledger.github.io/caliper/docs/Composer_Configuration.html

 

Composer Configuration

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

https://hyperledger.github.io/caliper/docs/Fabric_Configuration.html

 

Fabric Configuration

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

https://hyperledger.github.io/caliper/docs/Fabric_Ccp_Configuration.html

 

Fabric CCP Configuration

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

https://hyperledger.github.io/caliper/docs/Iroha_Configuration.html

 

Iroha Configuration

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

https://hyperledger.github.io/caliper/docs/Sawtooth_Configuration.html

 

Sawtooth Configuration

Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.

hyperledger.github.io

 

Running a Benchmark

벤치마크는 Caliper 커맨드 인터페이스를 사용하여 실행할 수 있습니다. 빌드 과정에는 proxy npm 서버에 모든 Caliper 모듈을 게시한 다음 이 서버에서 CLI 패키지를 전체적으로 설치하는 통합테스트가 포함되어 있지만, 우리는 npm으로 Caliper 패키지를 게시할 준비를 하고 있습니다. Caliper CLI를 사용하려면 Caliper 테스트 유틸리티를 사용하는 것이 좋습니다.

 

Intall the Caliper CLI

우리는 아직 npm에 Caliper를 게시하지 않았지만 Caliper CLI는 <CaliperRoot>/packages/caliper-tests-integration/scripts/run-integration-tests.sh에 있는 테스트 스크립트를 통해 얻을 수 있습니다. 테스트 스크립트에는 테스트 할 특정 어댑터를 선택하기 위해 환경변수 세트가 필요합니다. 이것은 단지 CI 시스템의 요구사항일 뿐입니다. 

 

Steps:

1. 위 섹션에서 설명한 Caliper 프로젝트 빌드를 아직 하지 않았다면, 빌드하세요.

2. Caliper CLI를 획득하기 위해 root Caliper 위치에서 아래 명령어를 실행하세요.

export BENCHMARK=fabric-ccp
./packages/caliper-tests-integration/scripts/run-integration-tests.sh

위 명령어는 npm 프록시 서버 (Verdaccio)를 시작하고, Caliper 모듈을 서버에 게시하고, 패키지를 전역 설치하고, 마지막으로 traget 벤치마크를 실행합니다. 현재 벤치마크 결과는 중요하지 않습니다. 벤치마크가 시작되면 명령을 발행한 스템에 Caliper 패키지가 전역으로 설치됩니다.

 

현재 Caliper 패키지는 다음 어댑터 클라이언트 라이브러리를 지원하도록 설정되어 있습니다:

  • Burrow: @monax/burrow@0.23.0
  • Composer: composer@0.20.8
  • Fabric: fabric-client@1.4.0
  • Iroha: iroha-helpers@0.6.3
  • Sawtooth: sawtooth-sdk@1.0.5

위와 다른 클라리언트 종속성이 있는 어댑터를 사용하여 벤치마크를 실행해야하는 경우 통합 테스트 스크립트를 실행하기 전 해당 package.json 파일을 수정한 다음 Caliper 프로젝트를 다시 빌드해야 합니다. 알려진 호환성 목록은 아래와 같습니다.

Fabric v1.0 grpc@1.10.1 fabric-ca-client@1.1.0 fabric-client@1.1.0
Fabric v1.1 grpc@1.10.1 fabric-ca-client@1.1.0 fabric-client@1.1.0
Fabric v1.2 fabric-ca-client@1.4.0 fabric-client@1.4.0 fabric-network@1.4.0
Fabric v1.3 fabric-ca-client@1.4.0 fabric-client@1.4.0 fabric-network@1.4.0
Fabric v1.4 fabric-ca-client@1.4.0 fabric-client@1.4.0 fabric-network@1.4.0

예를 들어, Hyperledger Fabric v1.1을 테스트하려면 grpc@1.10.1, fabric-ca-client@1.1.0, fabric-client@1.1.0을 사용하도록 caliper-fabric-ccp 어댑터를 수정해야합니다.

참고: Caliper 패키지가 npm으로 게시되면 위의 호환성 요구사항에 대한 버전을 게시하게 되며 npm install -g caliper-<package>@<version>을 사용하여 얻을 수 있는 Caliper버전으로 표가 업데이트 됩니다.

 

Run a Sample Benchmark

미리 정의된 벤치마크는 벤치마크 폴더에서 볼 수 있습니다. Caliper CLI에는 벤치마크 구성 및 테스트 파일이 포함된 workspace라는 개념이 있습니다.

 

벤치마크는 Caliper CLI command를 사용해 실행됩니다.

caliper benchmark run -w <path to workspace> -c <benchmark config> -n <blockchain config>
  • -w : workspace 디렉토리 경로 (필수)
  • -c : workspace에서 벤치마크 configuration 파일 상대경로 (필수)
  • -n : workspace에서 테스트할 블록체인 네트워크 config 파일의 상대경로

root Caliper 폴더에 있다고 가정하면, 아래 명령어는 Caliper 샘플에 있는 내용을 사용해 테스를 실행합니다.

caliper benchmark run -w ./packages/caliper-samples -c benchmark/simple/config.yaml -n network/fabric-v1.4/2org1peercouchdb/fabric-ccp-node.yaml

원하는 벤치마크를 수행하기 위해 caliper-sampls 디렉토리에 있는 파일을 수정하거나 추가할 수 있습니다. 벤치마크를 추가하기 전에 샘플 벤치마크 컨텐츠 및 구조를 확인하세요. 테스느 중인 블록체인 시스템, 벤치마크 구성, 스마트 계약 및 배포된 스마트 계약과 상호작용하는 테스트 파일(콜백)에 대한 고유 구성파일을 추가해야 합니다.

 

 

Run Benchmark with Distributed Clients (Experimental)

이 방식에서는, 여러 클라이언트가 동일한 벤치마크 수행을 위해 분산 호스트에서 실행될 수 있습니다.

1. Caliper CLI를 사용해 ZooKeeper 서비스를 시작하세요.

caliper zooservice start

2. Caliper CLI를 사용해 각 대상 머신에 caliper-zoo-client를 실행하세요.

caliper zooclient start -w ~/myCaliperProject -a <host-address>:<port>  -n my-sut-config.yaml

3. configuration 파일에 있는 클라이언트 타입 설정을 zookeeper로 변경하세요.

 "clients": {
   "type": "zookeeper",
   "zoo" : {
     "server": "10.229.42.159:2181",
     "clientsPerHost": 5
   }
 }

4. 벤치마크를 실행합니다.

 

참고:
  • Zookeeper는 클라이언트를 등록하고 메시지를 교환하는 데 사용됩니다. 시작된 클라이언트는 /caliper/clients/ 아래에 새로운 znode를 추가합니다. 벤치마크에서는 디렉토리를 점검하여 얼마나 많은 클라이언트가 있는지 알아보고 작업 부하에 따라 각 클라이언트에 작업을 할당합니다.
  • 클라이언트 간에는 자동 시간 동기화가 없습니다. 'ntpdate'를 사용하는 것과 같이 대상 시스템 간의 시간을 수동으로 동기화해야 합니다.
  • 블록체인 구성파일은 클라이언트를 실행하는 시스템에 있어야 하며 파일의 상대 경로 (캘리퍼 폴더에 상대적인) 가 일치해야 합니다. 구성의 모든 참조 파일도 존재해야 합니다.

+ Recent posts