Skip to content

Commit

Permalink
Merge pull request hyperledger#78 from nklincoln/base-and-contract
Browse files Browse the repository at this point in the history
Base and contract
  • Loading branch information
nklincoln committed May 21, 2020
2 parents 6d99cd9 + eacc6a0 commit 2143577
Show file tree
Hide file tree
Showing 625 changed files with 3,924 additions and 286 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ launch.json
# No npm runtime artifacts
node_modules/*
package-lock.json
package.json

src/fabric/samples/fabcar/java

Expand Down
8 changes: 7 additions & 1 deletion benchmarks/api/fabric/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Fabric API Tests

This folder contains tests that target Fabric shim API methods that may be called within chaincode
This folder contains tests that target Fabric shim API methods that may be called within chaincode

Fabric chaincode may be written in two ways:
- Using a Contract wrapper
- Coding direct to the shim

These methods are split within the contract and base folders respectively.
6 changes: 0 additions & 6 deletions benchmarks/api/fabric/couchDB/_README.md

This file was deleted.

178 changes: 178 additions & 0 deletions benchmarks/api/fabric/couchDB/base/base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
test:
name: fixed-asset-couchDB
description: This is a duration based benchmark targeting a Hyperledger Fabric network with a CouchDB world state database using the `fixed-asset` NodeJS chaincode contract that is interacted with via
a Fabric-SDK-Node Gateway. Each test round flexes a single chaincode method, and includes a null-operation to act as a performance cost baseline.
workers:
type: local
number: 5
rounds:
- label: empty-contract-evaluate
description: Test an evaluateTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `nullResponse`, which immediately returns a null response. This represents the fastest possible round trip time for an evaluateTransaction() method that does not touch the world state or perform any action.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
consensus: false
callback: benchmarks/api/fabric/lib/empty-contract.js
- label: empty-contract-submit
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `nullResponse`, which immediately returns a null response. This represents the fastest possible round trip time for a submitTransaction() method that does not touch the world state or perform any action.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
consensus: true
callback: benchmarks/api/fabric/lib/empty-contract.js
- label: create-asset-1000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `create`, which performs a `putState()` operation on an asset of size 1000 bytes.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
callback: benchmarks/api/fabric/lib/create-asset.js
- label: get-asset-evaluate-1000
description: Test a evaluateTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `getAsset`. This method performs a `getState()` operation for a passed UUID, retrieving as asset of size 1000 bytes.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
nosetup: true
bytesize: 1000
assets: 500
consensus: false
callback: benchmarks/api/fabric/lib/get-asset.js
- label: get-asset-submit-1000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `getAsset`. This method performs a `getState()` operation for a passed UUID, retrieving as asset of size 1000 bytes. This test includes involvement of the orderer, and appending to the ledger.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
nosetup: true
bytesize: 1000
assets: 500
consensus: true
callback: benchmarks/api/fabric/lib/get-asset.js
- label: rich-query-evaluate-0
description: Test an evaluateTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRichQuery`. This method performs a paginated rich query, with a passed pagesize of 10 and query string that matches no assets in the world state database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
pagesize: '10'
nosetup: true
nomatch: true
consensus: false
callback: benchmarks/api/fabric/lib/rich-query-asset.js
- label: rich-query-evaluate-1000
description: Test an evaluateTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRichQuery`. This method performs a paginated rich query, with a passed pagesize of 10 and query string that matches all assets created by the calling client. Each returned asset is of size 1000 bytes.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
pagesize: '10'
nosetup: true
consensus: false
callback: benchmarks/api/fabric/lib/rich-query-asset.js
- label: rich-query-submit-0
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRichQuery`. This method performs a paginated rich query, with a passed pagesize of 10 and query string that matches no assets in the world state database. This test includes involvement of the orderer, and appending to the ledger.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
pagesize: '10'
nosetup: true
nomatch: true
consensus: true
callback: benchmarks/api/fabric/lib/rich-query-asset.js
- label: rich-query-submit-1000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRichQuery`. This method performs a paginated rich query, with a passed pagesize of 10 and query string that matches all assets created by the calling client. Each returned asset is of size 1000 bytes. This test includes involvement of the orderer, and appending to the ledger.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
pagesize: '10'
nosetup: true
consensus: true
callback: benchmarks/api/fabric/lib/rich-query-asset.js
- label: range-query-evaluate-0
description: Test an evaluateTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRangeQuery`. This method performs a paginated range query that matches no assets in the world state database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
range: 200
offset: 100
nosetup: true
pagesize: '10'
nomatch: true
consensus: false
callback: benchmarks/api/fabric/lib/range-query-asset.js
- label: range-query-evaluate-1000
description: Test an evaluateTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRangeQuery`. This method performs a paginated range query, with a passed pagesize of 10 and a range keys that bound 200 assets created by the calling client. Each returned asset is of size 1000 bytes.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
range: 200
offset: 100
nosetup: true
pagesize: '10'
consensus: false
callback: benchmarks/api/fabric/lib/range-query-asset.js
- label: range-query-submit-0
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRangeQuery`. This method performs a paginated range query that matches no items in the world state database. This test includes involvement of the orderer, and appending to the ledger.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
range: 200
offset: 100
nosetup: true
pagesize: '10'
nomatch: true
consensus: true
callback: benchmarks/api/fabric/lib/range-query-asset.js
- label: range-query-submit-1000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `paginatedRangeQuery`. This method performs a paginated range query, with a passed pagesize of 10 and a range keys that bound 200 assets created by the calling client. Each returned asset is of size 1000 bytes. This test includes involvement of the orderer, and appending to the ledger.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 100} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 1000
range: 200
offset: 100
nosetup: true
pagesize: '10'
consensus: true
callback: benchmarks/api/fabric/lib/range-query-asset.js
monitor:
interval: 5
type: ['process', 'docker']
process:
processes: [{ command: 'node', arguments: 'fabricClientWorker.js', multiOutput: 'avg' }]
docker:
containers: ['all']
observer:
type: local
interval: 30
128 changes: 128 additions & 0 deletions benchmarks/api/fabric/couchDB/base/create-asset-batch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
test:
name: create-asset-batch-couchDB
description: This is a duration based benchmark targeting a Hyperledger Fabric network with a CouchDB world state database using the `fixed-asset` NodeJS chaincode contract that is interacted with via
a Fabric-SDK-Node Gateway. Each test round invokes the `createAssetsFromBatch` method, with successive rounds increasing the batch size of the assets being
added into the world state database.
workers:
type: local
number: 4
rounds:
- label: create-asset-batch-20-8000-fixed-tps
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 20 assets of size 8k bytes into the World State database at a fixed TPS.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-rate, opts: { tps: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 20
callback: benchmarks/api/fabric/lib/batch-create-asset.js
- label: create-asset-batch-1-8000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 1 assets of size 8k bytes into the World State database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 1
callback: benchmarks/api/fabric/lib/batch-create-asset.js
- label: create-asset-batch-10-8000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 10 assets of size 8k bytes into the World State database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 10
callback: benchmarks/api/fabric/lib/batch-create-asset.js
- label: create-asset-batch-20-8000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 20 assets of size 8k bytes into the World State database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 20
callback: benchmarks/api/fabric/lib/batch-create-asset.js
- label: create-asset-batch-30-8000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 30 assets of size 8k bytes into the World State database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 30
callback: benchmarks/api/fabric/lib/batch-create-asset.js
- label: create-asset-batch-40-8000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 40 assets of size 8k bytes into the World State database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 40
callback: benchmarks/api/fabric/lib/batch-create-asset.js
- label: create-asset-batch-50-8000
description: Test a submitTransaction() Gateway method against the NodeJS `fixed-asset` Smart Contract method named `createAssetsFromBatch`, which inserts a batch of 50 assets of size 8k bytes into the World State database.
chaincodeID: fixed-asset-base
txDuration: 300
rateControl: { type: fixed-backlog, opts: { unfinished_per_client: 5} }
arguments:
chaincodeID: fixed-asset-base
bytesize: 8000
batchsize: 50
callback: benchmarks/api/fabric/lib/batch-create-asset.js
monitor:
type:
- prometheus
prometheus:
url: "http://localhost:9090"
push_url: "http://localhost:9091"
metrics:
ignore: [prometheus, pushGateway, cadvisor, grafana, node-exporter, ca.org1.example.com, ca.org2.example.com]
include:
Avg Memory (MB):
query: sum(container_memory_rss{name=~".+"}) by (name)
step: 10
label: name
statistic: avg
multiplier: 0.000001
CPU (%):
query: sum(rate(container_cpu_usage_seconds_total{name=~".+"}[1m])) by (name)
step: 10
label: name
statistic: avg
multiplier: 100
Network In (MB):
query: sum(rate(container_network_receive_bytes_total{name=~".+"}[1m])) by (name)
step: 10
label: name
statistic: sum
multiplier: 0.000001
Network Out (MB):
query: sum(rate(container_network_transmit_bytes_total{name=~".+"}[1m])) by (name)
step: 10
label: name
statistic: sum
multiplier: 0.000001
Disc Write (MB):
query: sum(rate(container_fs_writes_bytes_total{name=~".+"}[1m])) by (name)
step: 10
label: name
statistic: sum
multiplier: 0.000001
Disc Read (MB):
query: sum(rate(container_fs_reads_bytes_total{name=~".+"}[1m])) by (name)
step: 10
label: name
statistic: sum
multiplier: 0.000001
observer:
type: prometheus
interval: 10

0 comments on commit 2143577

Please sign in to comment.