Fabric1.4性能测试

环境:虚拟机ubuntu16.04,内存4GB,处理器数量2,每个处理器内核数2
测试工具:Tape
Tape介绍:https://github.com/guoger/tape/blob/master/docs/whatis.md
项目地址:https://github.com/guoger/tape
按项目说明进行操作,记录如下:

wang@wang:~/go/src/github.com/hyperledger$ git clone https://github.com/guoger/stupid
Cloning into 'stupid'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 376 (delta 7), reused 16 (delta 6), pack-reused 352
Receiving objects: 100% (376/376), 384.64 KiB | 24.00 KiB/s, done.
Resolving deltas: 100% (213/213), done.
Checking connectivity... done.
wang@wang:~/go/src/github.com/hyperledger$ cd stupid/
wang@wang:~/go/src/github.com/hyperledger/stupid$ ls
azure-pipelines.yml  cmd  config.yaml  Dockerfile  docs  e2e  go.mod  go.sum  LICENSE  pkg  README.md  tape.jpeg  test
wang@wang:~/go/src/github.com/hyperledger/stupid$ go version
go version go1.15 linux/amd64
wang@wang:~/go/src/github.com/hyperledger/stupid$ go env
GO111MODULE="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/wang/.cache/go-build"
GOENV="/home/wang/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/wang/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/wang/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build888727420=/tmp/go-build -gno-record-gcc-switches"
wang@wang:~/go/src/github.com/hyperledger/stupid$ go env -w GO111MODULE=on
wang@wang:~/go/src/github.com/hyperledger/stupid$ go env -w GOPROXY=https://goproxy.cn
wang@wang:~/go/src/github.com/hyperledger/stupid$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/wang/.cache/go-build"
GOENV="/home/wang/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/wang/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/wang/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/wang/go/src/github.com/hyperledger/stupid/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build528024456=/tmp/go-build -gno-record-gcc-switches"
wang@wang:~/go/src/github.com/hyperledger/stupid$ go build ./cmd/tape
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/hyperledger/fabric v2.0.1+incompatible
go: downloading github.com/gogo/protobuf v1.2.1
go: downloading github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e
go: downloading github.com/golang/protobuf v1.4.2
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading google.golang.org/protobuf v1.23.0
go: downloading google.golang.org/grpc v1.24.0
go: downloading golang.org/x/net v0.0.0-20200625001655-4c5254603344
go: downloading golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed
go: downloading google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6
go: downloading golang.org/x/text v0.3.2
go: downloading github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
go: downloading go.uber.org/zap v1.10.0
go: downloading github.com/sykesm/zap-logfmt v0.0.2
go: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
go: downloading github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a
go: downloading go.uber.org/multierr v1.1.0
go: downloading go.uber.org/atomic v1.4.0
wang@wang:~/go/src/github.com/hyperledger/stupid$ ls
azure-pipelines.yml  cmd  config.yaml  Dockerfile  docs  e2e  go.mod  go.sum  LICENSE  pkg  README.md  tape  tape.jpeg  test

一、Fabric网络:fabric-samples 1.4里的first-network

wang@wang:~/go/src/github.com/hyperledger/fabric-samples$ git branch
  master
* release-1.4

二、Tape配置文件修改如下:

wang@wang:~/go/src/github.com/hyperledger/stupid$ cat config.yaml
# Definition of nodes
peer0: &peer0
  addr: localhost:7051
  tls_ca_cert: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

peer1: &peer1
  addr: localhost:8051
  tls_ca_cert: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem



#peer2: &peer2
#  addr: localhost:9051
#  tls_ca_cert: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem

#peer3: &peer3
#  addr: localhost:10051
#  tls_ca_cert: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem

orderer1: &orderer1
  addr: localhost:7050
  tls_ca_cert: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem

# Nodes to interact with
endorsers:
  - *peer0
  - *peer1
#  - *peer2
#  - *peer3
# we might support multi-committer in the future for more complex test scenario,
# i.e. consider tx committed only if it's done on >50% of nodes. But for now,
# it seems sufficient to support single committer.
committer: *peer0
orderer: *orderer1

# Invocation configs
channel: mychannel
chaincode: mycc
args: ["invoke","a","b","1"]
#args: ["query","a"]
mspid: Org1MSP
private_key: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/20a9e747f5d0b2b2055a41a28b9cab90c4545090f90b6cdf805421edb7f125d5_sk
sign_cert: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]
num_of_conn: 10
client_per_conn: 10

注意config.yaml文件中的private_key字段的值,不是…/priv_sk;并且在每次重启Fabirc网络的时候如果是重新生成的证书,需要将此字段重新赋值。

三、$GOPATH/src/github.com/hyperledger/fabric-samples/first-network/scripts/script.sh中添加:

        ## Install chaincode on peer0.org2
        echo "Installing chaincode on peer0.org2..."
        installChaincode 0 2

四、$GOPATh/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml中修改MaxMessageCount值为500:

Orderer: &OrdererDefaults

    # Orderer Type: The orderer implementation to start
    # Available types are "solo","kafka"  and "etcdraft"
    OrdererType: solo

    Addresses:
        - orderer.example.com:7050

    # Batch Timeout: The amount of time to wait before creating a batch
    BatchTimeout: 2s

    # Batch Size: Controls the number of messages batched into a block
    BatchSize:

        # Max Message Count: The maximum number of messages to permit in a batch
        MaxMessageCount: 500

        # Absolute Max Bytes: The absolute maximum number of bytes allowed for
        # the serialized messages in a batch.
        AbsoluteMaxBytes: 99 MB

        # Preferred Max Bytes: The preferred maximum number of bytes allowed for
        # the serialized messages in a batch. A message larger than the preferred
        # max bytes will result in a batch larger than preferred max bytes.
        PreferredMaxBytes: 512 KB

五、使用默认共识solo启动网络:

wang@wang:~/go/src/github.com/hyperledger/fabric-samples/first-network$ ./byfn.sh up
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
LOCAL_VERSION=1.4.5
DOCKER_IMAGE_VERSION=1.4.8
=================== WARNING ===================
  Local fabric binaries and docker images are  
  out of  sync. This may cause problems.       
===============================================
/usr/local/bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x

Generate CCP files for Org1 and Org2
/usr/local/bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
CONSENSUS_TYPE=solo
+ '[' solo == solo ']'
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
2020-10-23 15:26:51.897 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-10-23 15:26:52.057 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo
2020-10-23 15:26:52.058 CST [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:52.223 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 orderer type: solo
2020-10-23 15:26:52.224 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 005 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:52.226 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block
2020-10-23 15:26:52.227 CST [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
+ res=0
+ set +x

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2020-10-23 15:26:52.293 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-10-23 15:26:52.473 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:52.636 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-10-23 15:26:52.636 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:52.636 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 005 Generating new channel configtx
2020-10-23 15:26:52.639 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 006 Writing new channel tx
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2020-10-23 15:26:52.715 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-10-23 15:26:52.880 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:53.046 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-10-23 15:26:53.046 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:53.046 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2020-10-23 15:26:53.046 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2020-10-23 15:26:53.107 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-10-23 15:26:53.267 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:53.438 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-10-23 15:26:53.438 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/configtx.yaml
2020-10-23 15:26:53.438 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2020-10-23 15:26:53.439 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update
+ res=0
+ set +x

Creating network "net_byfn" with the default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_orderer.example.com" with default driver
Creating peer1.org2.example.com
Creating orderer.example.com
Creating peer1.org1.example.com
Creating peer0.org1.example.com
Creating peer0.org2.example.com
Creating cli
CONTAINER ID        IMAGE                               COMMAND             CREATED             STATUS                  PORTS                      NAMES
cc0965bd478e        hyperledger/fabric-tools:latest     "/bin/bash"         1 second ago        Up Less than a second                              cli
87c5db972c3d        hyperledger/fabric-peer:latest      "peer node start"   4 seconds ago       Up 1 second             0.0.0.0:9051->9051/tcp     peer0.org2.example.com
2986ab067dfb        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up 2 seconds            0.0.0.0:8051->8051/tcp     peer1.org1.example.com
cf5ed6dd19bf        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up 2 seconds            0.0.0.0:7051->7051/tcp     peer0.org1.example.com
b41102f936f4        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up 1 second             0.0.0.0:10051->10051/tcp   peer1.org2.example.com
8246bc4d3acb        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up 2 seconds            0.0.0.0:7050->7050/tcp     orderer.example.com

 ____    _____      _      ____    _____ 
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |  
 ___) |   | |    / ___ \  |  _ <    | |  
|____/    |_|   /_/   \_\ |_| \_\   |_|  

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-10-23 07:26:59.704 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:26:59.755 UTC [cli.common] readBlock -> INFO 002 Received block: 0
===================== Channel 'mychannel' created ===================== 

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-10-23 07:26:59.874 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:26:59.947 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org1 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-10-23 07:27:03.094 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:27:03.174 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org1 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-10-23 07:27:06.321 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:27:06.394 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org2 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-10-23 07:27:09.528 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:27:09.597 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel 'mychannel' ===================== 

Updating anchor peers for org1...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-10-23 07:27:12.743 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:27:12.759 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' ===================== 

Updating anchor peers for org2...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-10-23 07:27:15.922 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-10-23 07:27:15.945 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' ===================== 

+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
Installing chaincode on peer0.org1...
+ res=0
+ set +x
2020-10-23 07:27:19.131 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-23 07:27:19.131 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-10-23 07:27:19.521 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org1 ===================== 

Install chaincode on peer0.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-10-23 07:27:19.651 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-23 07:27:19.651 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-10-23 07:27:20.000 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org2 ===================== 

Instantiating chaincode on peer0.org2...
+ peer chaincode instantiate -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P 'AND ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
+ res=0
+ set +x
2020-10-23 07:27:20.130 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-23 07:27:20.130 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
===================== Chaincode is instantiated on peer0.org2 on channel 'mychannel' ===================== 

Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... ===================== 
+ peer chaincode query -C mychannel -n mycc -c '{
    
    "Args":["query","a"]}'
Attempting to Query peer0.org1 ...3 secs
+ res=0
+ set +x

100
===================== Query successful on peer0.org1 on channel 'mychannel' ===================== 
Sending invoke transaction on peer0.org1 peer0.org2...
+ peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{
    
    "Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2020-10-23 07:28:28.830 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' ===================== 

Installing chaincode on peer0.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-10-23 07:28:28.975 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-23 07:28:28.975 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-10-23 07:28:29.612 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer1.org1 ===================== 

Installing chaincode on peer1.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-10-23 07:28:29.739 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-23 07:28:29.739 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-10-23 07:28:30.106 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer1.org2 ===================== 

Querying chaincode on peer1.org2...
===================== Querying on peer1.org2 on channel 'mychannel'... ===================== 
Attempting to Query peer1.org2 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{
    
    "Args":["query","a"]}'
+ res=0
+ set +x

90
===================== Query successful on peer1.org2 on channel 'mychannel' ===================== 

========= All GOOD, BYFN execution completed =========== 


 _____   _   _   ____   
| ____| | \ | | |  _ \  
|  _|   |  \| | | | | | 
| |___  | |\  | | |_| | 
|_____| |_| \_| |____/  


六、测试结果:
(1)args: [“invoke”,“a”,“b”,“1”]

wang@wang:~/go/src/github.com/hyperledger/stupid$ ./tape config.yaml 10000
Time     2.98s	Block    411	Tx    133
Time    12.08s	Block    412	Tx    122
Time    31.89s	Block    413	Tx    135
Time    38.31s	Block    414	Tx     11
Time    50.59s	Block    415	Tx    105
Time    69.77s	Block    416	Tx    104
Time    90.87s	Block    417	Tx    135
Time    92.32s	Block    418	Tx     20
Time   107.42s	Block    419	Tx    135
Time   109.24s	Block    420	Tx     15
Time   126.70s	Block    421	Tx    135
Time   129.87s	Block    422	Tx     20
Time   149.09s	Block    423	Tx    135
Time   149.76s	Block    424	Tx     60
Time   150.39s	Block    425	Tx    126
Time   150.76s	Block    426	Tx    101
Time   151.18s	Block    427	Tx    135
Time   151.62s	Block    428	Tx     71
Time   152.71s	Block    429	Tx    135
Time   152.80s	Block    430	Tx      9
Time   153.33s	Block    431	Tx    135
Time   153.47s	Block    432	Tx     35
Time   153.91s	Block    433	Tx    135
Time   153.99s	Block    434	Tx     12
Time   154.30s	Block    435	Tx    103
Time   154.71s	Block    436	Tx    112
Time   155.07s	Block    437	Tx    112
Time   155.61s	Block    438	Tx    113
Time   156.18s	Block    439	Tx    118
Time   156.60s	Block    440	Tx    134
Time   157.02s	Block    441	Tx    102
Time   157.58s	Block    442	Tx    124
Time   158.15s	Block    443	Tx    107
Time   158.79s	Block    444	Tx    135
Time   158.91s	Block    445	Tx     20
Time   159.44s	Block    446	Tx     90
Time   159.79s	Block    447	Tx     84
Time   160.17s	Block    448	Tx    135
Time   160.31s	Block    449	Tx     20
Time   160.94s	Block    450	Tx    131
Time   161.56s	Block    451	Tx    135
Time   161.75s	Block    452	Tx     17
Time   162.24s	Block    453	Tx    134
Time   162.66s	Block    454	Tx    135
Time   162.74s	Block    455	Tx      5
Time   163.28s	Block    456	Tx    102
Time   163.73s	Block    457	Tx    131
Time   164.14s	Block    458	Tx    135
Time   164.36s	Block    459	Tx     15
Time   165.13s	Block    460	Tx    109
Time   165.85s	Block    461	Tx    133
Time   166.52s	Block    462	Tx    127
Time   167.34s	Block    463	Tx    117
Time   167.93s	Block    464	Tx    122
Time   168.45s	Block    465	Tx     82
Time   169.10s	Block    466	Tx    115
Time   170.33s	Block    467	Tx    120
Time   171.26s	Block    468	Tx    135
Time   171.48s	Block    469	Tx     41
Time   172.01s	Block    470	Tx    134
Time   172.51s	Block    471	Tx    135
Time   172.64s	Block    472	Tx     24
Time   173.18s	Block    473	Tx    115
Time   173.67s	Block    474	Tx    135
Time   173.74s	Block    475	Tx      3
Time   174.23s	Block    476	Tx    117
Time   174.79s	Block    477	Tx    122
Time   175.23s	Block    478	Tx    123
Time   175.74s	Block    479	Tx     84
Time   176.23s	Block    480	Tx    135
Time   176.32s	Block    481	Tx     14
Time   176.81s	Block    482	Tx    122
Time   177.10s	Block    483	Tx    103
Time   177.64s	Block    484	Tx    126
Time   178.30s	Block    485	Tx    132
Time   178.81s	Block    486	Tx    135
Time   178.92s	Block    487	Tx     24
Time   179.32s	Block    488	Tx    112
Time   179.71s	Block    489	Tx    135
Time   179.75s	Block    490	Tx      2
Time   180.23s	Block    491	Tx    135
Time   180.34s	Block    492	Tx     22
Time   180.74s	Block    493	Tx    135
Time   180.77s	Block    494	Tx      3
Time   181.17s	Block    495	Tx    135
Time   181.23s	Block    496	Tx      8
Time   181.56s	Block    497	Tx    113
Time   182.47s	Block    498	Tx    132
Time   183.17s	Block    499	Tx    135
Time   183.29s	Block    500	Tx     17
Time   184.02s	Block    501	Tx    135
Time   184.20s	Block    502	Tx     20
Time   185.12s	Block    503	Tx    135
Time   185.22s	Block    504	Tx      3
Time   186.07s	Block    505	Tx    135
Time   186.30s	Block    506	Tx     39
Time   186.90s	Block    507	Tx    130
Time   187.52s	Block    508	Tx    130
Time   187.98s	Block    509	Tx    135
Time   188.25s	Block    510	Tx     29
Time   188.82s	Block    511	Tx    135
Time   188.86s	Block    512	Tx      2
Time   189.37s	Block    513	Tx    135
Time   189.47s	Block    514	Tx     11
Time   189.80s	Block    515	Tx    135
Time   189.92s	Block    516	Tx     23
Time   190.38s	Block    517	Tx    135
tx: 10000, duration: 3m10.379453376s, tps: 52.526677

(2)args: [“query”,“a”]

wang@wang:~/go/src/github.com/hyperledger/stupid$ ./tape config.yaml 10000
Time    32.74s	Block    669	Tx    137
Time    55.23s	Block    670	Tx     88
Time    97.06s	Block    671	Tx    137
Time   105.69s	Block    672	Tx     24
Time   135.56s	Block    673	Tx    137
Time   135.87s	Block    674	Tx     31
Time   136.70s	Block    675	Tx    137
Time   136.82s	Block    676	Tx     12
Time   137.79s	Block    677	Tx    137
Time   138.02s	Block    678	Tx     47
Time   138.45s	Block    679	Tx    137
Time   138.64s	Block    680	Tx     43
Time   139.01s	Block    681	Tx    137
Time   139.09s	Block    682	Tx      7
Time   139.86s	Block    683	Tx    137
Time   140.03s	Block    684	Tx     34
Time   140.42s	Block    685	Tx    137
Time   140.46s	Block    686	Tx      3
Time   140.86s	Block    687	Tx    137
Time   141.04s	Block    688	Tx     71
Time   141.49s	Block    689	Tx    137
Time   141.68s	Block    690	Tx     24
Time   142.16s	Block    691	Tx    137
Time   142.41s	Block    692	Tx     51
Time   142.79s	Block    693	Tx    117
Time   143.09s	Block    694	Tx    137
Time   143.26s	Block    695	Tx     39
Time   143.75s	Block    696	Tx    137
Time   143.81s	Block    697	Tx      3
Time   144.20s	Block    698	Tx    137
Time   144.34s	Block    699	Tx     24
Time   144.80s	Block    700	Tx    137
Time   144.93s	Block    701	Tx     45
Time   145.36s	Block    702	Tx    137
Time   145.41s	Block    703	Tx      4
Time   145.85s	Block    704	Tx    137
Time   146.01s	Block    705	Tx     40
Time   146.49s	Block    706	Tx    137
Time   146.59s	Block    707	Tx     25
Time   146.93s	Block    708	Tx    108
Time   147.47s	Block    709	Tx    137
Time   147.65s	Block    710	Tx     47
Time   148.43s	Block    711	Tx    137
Time   148.71s	Block    712	Tx     41
Time   149.45s	Block    713	Tx    137
Time   149.59s	Block    714	Tx     12
Time   150.28s	Block    715	Tx    137
Time   150.42s	Block    716	Tx     13
Time   151.21s	Block    717	Tx    137
Time   151.40s	Block    718	Tx     44
Time   151.81s	Block    719	Tx    110
Time   152.27s	Block    720	Tx    137
Time   152.54s	Block    721	Tx     55
Time   153.01s	Block    722	Tx    137
Time   153.08s	Block    723	Tx      5
Time   153.70s	Block    724	Tx    137
Time   153.98s	Block    725	Tx     65
Time   154.41s	Block    726	Tx    125
Time   154.91s	Block    727	Tx    120
Time   155.43s	Block    728	Tx    137
Time   155.49s	Block    729	Tx      2
Time   155.97s	Block    730	Tx    137
Time   156.02s	Block    731	Tx      3
Time   156.47s	Block    732	Tx    117
Time   156.86s	Block    733	Tx    135
Time   157.29s	Block    734	Tx    137
Time   157.49s	Block    735	Tx     56
Time   157.89s	Block    736	Tx    126
Time   158.41s	Block    737	Tx    137
Time   158.52s	Block    738	Tx     16
Time   158.92s	Block    739	Tx    137
Time   159.03s	Block    740	Tx     17
Time   159.48s	Block    741	Tx    133
Time   159.94s	Block    742	Tx    108
Time   160.49s	Block    743	Tx    137
Time   160.66s	Block    744	Tx     26
Time   161.30s	Block    745	Tx    134
Time   161.87s	Block    746	Tx     92
Time   162.42s	Block    747	Tx    130
Time   162.81s	Block    748	Tx    137
Time   162.87s	Block    749	Tx      5
Time   163.30s	Block    750	Tx    137
Time   163.42s	Block    751	Tx     23
Time   163.94s	Block    752	Tx    137
Time   164.02s	Block    753	Tx     11
Time   164.40s	Block    754	Tx    113
Time   164.84s	Block    755	Tx    137
Time   164.95s	Block    756	Tx     33
Time   165.44s	Block    757	Tx    129
Time   165.89s	Block    758	Tx    137
Time   166.04s	Block    759	Tx     26
Time   166.46s	Block    760	Tx    122
Time   166.93s	Block    761	Tx    137
Time   167.08s	Block    762	Tx     36
Time   167.51s	Block    763	Tx    117
Time   167.93s	Block    764	Tx    137
Time   168.20s	Block    765	Tx     56
Time   168.65s	Block    766	Tx    137
Time   169.07s	Block    767	Tx    137
Time   169.29s	Block    768	Tx     41
Time   169.69s	Block    769	Tx    117
Time   170.12s	Block    770	Tx    137
Time   170.35s	Block    771	Tx     31
Time   170.71s	Block    772	Tx    137
Time   170.76s	Block    773	Tx     11
Time   170.95s	Block    774	Tx    130
Time   171.23s	Block    775	Tx    137
Time   171.30s	Block    776	Tx     20
Time   171.63s	Block    777	Tx    137
Time   171.72s	Block    778	Tx     11
Time   171.93s	Block    779	Tx     94
tx: 10000, duration: 2m51.933630365s, tps: 58.161978

猜你喜欢

转载自blog.csdn.net/u010931295/article/details/109238277