diff --git a/aws-code/transaction_generator.go b/aws-code/transaction_generator.go index 680dd3942..991b5e99c 100644 --- a/aws-code/transaction_generator.go +++ b/aws-code/transaction_generator.go @@ -110,6 +110,7 @@ func readConfigFile(configFile string) [][]string { } func main() { +<<<<<<< HEAD // Setup a stdout logger h := log.CallerFileHandler(log.StdoutHandler) log.Root().SetHandler(h) @@ -130,23 +131,25 @@ func main() { start := time.Now() totalTime := 60.0 time.Sleep(3 * time.Second) // wait for nodes to be ready +======= + configFile := flag.String("config_file", "global_nodes.txt", "file containing all ip addresses and config") + flag.Parse() + config := readConfigFile(*configFile) + totalTime := 60.0 + time.Sleep(totalTime) //Sleep Time to let all instances come up + start := time.Now() + txs := make([]blockchain.Transaction, 10) + leaders := getLeaders(&config) +>>>>>>> aadf3f9b34b9b4b84841dce554814f05f120aed1 for true { t := time.Now() if t.Sub(start).Seconds() >= totalTime { fmt.Println(int(t.Sub(start)), start, totalTime) break } -<<<<<<< HEAD - for i := range txs { - txs[i] = newRandTransaction() - } - msg := node.ConstructTransactionListMessage(txs) - log.Printf("[Generator] Sending txs to %d leader[s]\n", len(leaders)) -======= txsToSend := getNewFakeTransactions(&dataNode, *numTxsPerBatch) msg := node.ConstructTransactionListMessage(txsToSend) log.Debug("[Generator] Sending txs...", "numTxs", len(txsToSend)) ->>>>>>> 31f111ed5d49c01a9c3a20e92e053016c05ebafc p2p.BroadcastMessage(leaders, msg) // Update local utxo pool to mirror the utxo pool of a real node diff --git a/aws-scripts/preprocess_peerlist.py b/aws-scripts/preprocess_peerlist.py index faecebf07..eda1e7fe3 100644 --- a/aws-scripts/preprocess_peerlist.py +++ b/aws-scripts/preprocess_peerlist.py @@ -1,19 +1,21 @@ -from collections import namedtuple 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("all_peerlist.txt",r) + f = open("global_nodes.txt","r") + peerList = [] for myline in f: - mylist = myline.strip().split(" ") + mylist = myline.split(" ") ip = mylist[0] - if ip != current_ip: + 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") - for myline peerList: - g.write(myline + "\n") - g.close() - - - \ No newline at end of file + g = open("global_peerlist.txt","w") + for myline in peerList: + g.write(myline) + g.close() diff --git a/aws-scripts/run_instances.sh b/aws-scripts/run_instances.sh index bd4b7f59f..dedf1d741 100755 --- a/aws-scripts/run_instances.sh +++ b/aws-scripts/run_instances.sh @@ -1,3 +1,3 @@ #!/bin/bash -x cd /home/ec2-user/projects/src/harmony-benchmark -./deploy_linux.sh local_config2.txt \ No newline at end of file +./deploy_one_instance.sh global_peerlist.txt \ No newline at end of file diff --git a/deploy_one_instance.sh b/deploy_one_instance.sh new file mode 100755 index 000000000..fd5131045 --- /dev/null +++ b/deploy_one_instance.sh @@ -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 \ No newline at end of file diff --git a/global_nodes.txt b/global_nodes.txt new file mode 100644 index 000000000..9826ae250 --- /dev/null +++ b/global_nodes.txt @@ -0,0 +1,3 @@ +35.160.197.62 9000 validator 0 +54.68.213.133 9000 leader 0 +34.216.209.90 9000 transaction 0 \ No newline at end of file