Merge pull request #6 from simple-rules/runOneInstance

create 1 node per instance
pull/8/head
alajko 7 years ago committed by GitHub
commit 15b906a7c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      aws-code/transaction_generator.go
  2. 21
      aws-scripts/preprocess_peerlist.py
  3. 2
      aws-scripts/run_instances.sh
  4. 20
      deploy_one_instance.sh
  5. 3
      global_nodes.txt

@ -2,19 +2,19 @@ package main
import (
"bufio"
"encoding/hex"
"flag"
"fmt"
"harmony-benchmark/blockchain"
"harmony-benchmark/consensus"
"harmony-benchmark/log"
"harmony-benchmark/node"
"harmony-benchmark/p2p"
"math/rand"
"os"
"strconv"
"strings"
"time"
"harmony-benchmark/consensus"
"encoding/hex"
"strconv"
)
// Get numTxs number of Fake transactions based on the existing UtxoPool.
@ -50,7 +50,7 @@ func getNewFakeTransactions(dataNode *node.Node, numTxs int) []*blockchain.Trans
for index, value := range utxoMap {
countAll++
if rand.Intn(100) <= 20 { // 20% sample rate to select UTXO to use for new transactions
// Spend the money of current UTXO to a random address in [1 - 1000]
// Spend the money of current UTXO to a random address in [1 - 1000]
txin := blockchain.TXInput{txId, index, address}
txout := blockchain.TXOutput{value, strconv.Itoa(rand.Intn(1000))}
tx := blockchain.Transaction{[32]byte{}, []blockchain.TXInput{txin}, []blockchain.TXOutput{txout}}

@ -0,0 +1,21 @@
import requests
amazon_ipv4_url = "http://169.254.169.254/latest/meta-data/public-ipv4"
if __name__ == "__main__":
current_ip = requests.get(amazon_ipv4_url).text
f = open("global_nodes.txt","r")
peerList = []
for myline in f:
mylist = myline.split(" ")
ip = mylist[0]
node = mylist[2]
if node != "transaction":
peerList.append(myline)
else:
h = open("isTransaction.txt","w")
h.write("I am just a transaction generator node")
h.close()
f.close()
g = open("global_peerlist.txt","w")
for myline in peerList:
g.write(myline)
g.close()

@ -1,3 +1,3 @@
#!/bin/bash -x
cd /home/ec2-user/projects/src/harmony-benchmark
./deploy_linux.sh local_config2.txt
./deploy_one_instance.sh global_nodes.txt

@ -0,0 +1,20 @@
#!/bin/bash -x
##The commented suffix is for linux
##Reference: https://github.com/Zilliqa/Zilliqa/blob/master/tests/Node/test_node_simple.sh
sudo sysctl net.core.somaxconn=1024
sudo sysctl net.core.netdev_max_backlog=65536;
sudo sysctl net.ipv4.tcp_tw_reuse=1;
sudo sysctl -w net.ipv4.tcp_rmem='65536 873800 1534217728';
sudo sysctl -w net.ipv4.tcp_wmem='65536 873800 1534217728';
sudo sysctl -w net.ipv4.tcp_mem='65536 873800 1534217728';
./kill_node.sh
source ~/.bash_profile
python aws-scripts/preprocess_peerlist.py
FILE='isTransaction.txt'
config=$1
if [ -f $FILE ]; then
go run ./aws-code/transaction_generator.go -config_file $config
else
go run ./benchmark_main.go -config_file $config&
fi

@ -0,0 +1,3 @@
34.219.57.67 9000 validator 0
52.43.81.62 9000 leader 0
54.201.72.153 9000 transaction 0
Loading…
Cancel
Save