Merge pull request #102 from getamis/add-qourum-load-test

Add qourum load test
This commit is contained in:
Miya Chen 2017-12-20 21:45:13 +08:00 committed by GitHub
commit 773b4362fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 18 deletions

View File

@ -230,6 +230,6 @@ OPTIONS:
### Load tests
[Test specification](https://github.com/getamis/istanbul-tools/wiki/Istanbul-BFT-Benchmarking)
[Istanbul-BFT-Benchmarking](https://github.com/getamis/istanbul-tools/wiki/Istanbul-BFT-Benchmarking)
</details>
</details>

View File

@ -35,7 +35,7 @@ type GenesisChart struct {
args []string
}
func NewGenesisChart(validators []common.Address, allocs []common.Address, gasLimit uint64) *GenesisChart {
func NewGenesisChart(validators []common.Address, allocs []common.Address, gasLimit uint64, isQuorum bool) *GenesisChart {
chartPath := filepath.Join(chartBasePath, "genesis-block")
genesisPath := filepath.Join(chartPath, ".genesis")
err := os.MkdirAll(genesisPath, 0700)
@ -49,7 +49,7 @@ func NewGenesisChart(validators []common.Address, allocs []common.Address, gasLi
chartPath: chartPath,
genesisFile: genesis.NewFileAt(
genesisPath,
false,
isQuorum,
genesis.Validators(validators...),
genesis.GasLimit(gasLimit),
genesis.Alloc(append(validators, allocs...), new(big.Int).Exp(big.NewInt(10), big.NewInt(50), nil)),

View File

@ -50,9 +50,9 @@ func installRelease(name string, args []string, path string, debug bool) error {
cmd.Args = append(cmd.Args, "--dry-run")
cmd.Args = append(cmd.Args, "--debug")
} else {
// cmd.Args = append(cmd.Args, "--wait")
// cmd.Args = append(cmd.Args, "--timeout")
// cmd.Args = append(cmd.Args, "120")
cmd.Args = append(cmd.Args, "--wait")
cmd.Args = append(cmd.Args, "--timeout")
cmd.Args = append(cmd.Args, "600")
}
if debug {

View File

@ -28,13 +28,13 @@ import (
)
var (
DefaultGasPrice int64 = 20000000000
DefaultGasPrice int64 = 0
DefaultGasLimit int64 = 21000 // the gas of ether tx should be 21000
)
func SendEther(client client.Client, from *ecdsa.PrivateKey, to common.Address, amount *big.Int, nonce uint64) error {
tx := types.NewTransaction(nonce, to, amount, big.NewInt(DefaultGasLimit), big.NewInt(DefaultGasPrice), []byte{})
signedTx, err := types.SignTx(tx, types.NewEIP155Signer(big.NewInt(2017)), from)
signedTx, err := types.SignTx(tx, types.HomesteadSigner{}, from)
if err != nil {
log.Error("Failed to sign transaction", "tx", tx, "err", err)
return err

View File

@ -29,7 +29,7 @@ import (
"github.com/getamis/istanbul-tools/container"
)
func NewBlockchain(numOfValidators int, numOfExtraAccounts int, gaslimit uint64, options ...Option) (bc *blockchain) {
func NewBlockchain(numOfValidators int, numOfExtraAccounts int, gaslimit uint64, isQourum bool, options ...Option) (bc *blockchain) {
_, nodekeys, addrs := istcommon.GenerateKeys(numOfValidators)
ips := istcommon.GenerateIPs(len(nodekeys))
@ -45,7 +45,7 @@ func NewBlockchain(numOfValidators int, numOfExtraAccounts int, gaslimit uint64,
}
bc = &blockchain{
genesis: charts.NewGenesisChart(addrs, allocAddrs, uint64(gaslimit)),
genesis: charts.NewGenesisChart(addrs, allocAddrs, uint64(gaslimit), isQourum),
staticNodes: charts.NewStaticNodesChart(nodekeys, ips),
}

View File

@ -25,6 +25,7 @@ func ExampleK8SBlockchain() {
4,
0,
21000*1000,
false,
ImageRepository("quay.io/amis/geth"),
ImageTag("istanbul_develop"),
ServiceType("LoadBalancer"),

View File

@ -78,8 +78,6 @@ func (eth *ethereum) Start() error {
return err
}
<-time.After(3 * time.Minute)
eth.k8sClient = k8sClient(eth.chart.Name() + "-0")
return nil
}

View File

@ -24,7 +24,7 @@ import (
func ExampleK8SEthereum() {
_, nodekeys, addrs := common.GenerateKeys(1)
genesisChart := charts.NewGenesisChart(addrs, nil, genesis.InitGasLimit)
genesisChart := charts.NewGenesisChart(addrs, nil, genesis.InitGasLimit, false)
if err := genesisChart.Install(false); err != nil {
log.Error("Failed to install genesis chart", "err", err)
return

View File

@ -45,8 +45,9 @@ var _ = Describe("TPS-01: Large amount of transactions", func() {
func(rate int) {
runTests(numberOfValidators, gaslimit, txpoolSize, rate)
},
// only preload txs if send rare is 0
tests.Case("150ms", 150),
// only preload txs if send rate is 0
// tests.Case("preload", 0),
tests.Case("300ms", 300),
)
},
@ -84,8 +85,9 @@ func runTests(numberOfValidators int, gaslimit int, txpoolSize int, sendRate int
numberOfValidators,
accountsPerGeth,
uint64(gaslimit),
k8s.ImageRepository("quay.io/amis/geth"),
k8s.ImageTag("istanbul_develop"),
true,
k8s.ImageRepository("quay.io/amis/quorum"),
k8s.ImageTag("latest"),
k8s.Mine(false),
k8s.TxPoolSize(txpoolSize),
)