pull/14/head
Richard Liu 7 years ago
commit 0116d2c566
  1. 25
      aws-code/transaction_generator.go
  2. 12
      aws-scripts/setup_golang.sh
  3. 2
      benchmark_main.go
  4. 4
      deploy.sh
  5. 3
      deploy_one_instance.sh
  6. 1
      local_config_shards.txt
  7. 2
      node/node.go

@ -116,6 +116,16 @@ func readConfigFile(configFile string) [][]string {
return result
}
func getClientPort(config *[][]string) string {
for _, node := range *config {
_, port, status, _ := node[0], node[1], node[2], node[3]
if status == "client" {
return port
}
}
return ""
}
func main() {
configFile := flag.String("config_file", "local_config.txt", "file containing all ip addresses and config")
numTxsPerBatch := flag.Int("num_txs_per_batch", 10000, "number of transactions to send per message")
@ -133,6 +143,20 @@ func main() {
// h := log.CallerFileHandler(log.StdoutHandler)
log.Root().SetHandler(h)
// Client server setup
clientPort := getClientPort(&config)
if clientPort != "" {
consensusObj := consensus.NewConsensus("0", clientPort, "0", nil, p2p.Peer{})
clientNode := node.NewNode(&consensusObj)
go func() {
clientNode.StartServer(clientPort)
}()
}
// Testing node to mirror the node data in consensus
nodes := []node.Node{}
for _, shardId := range shardIds {
@ -168,6 +192,7 @@ func main() {
time.Sleep(500 * time.Millisecond) // Send a batch of transactions periodically
}
// Send a stop message to stop the nodes at the end
msg := node.ConstructStopMessage()
peers := append(getValidators(*configFile), leaders...)

@ -2,19 +2,19 @@
sudo yum update -y
sudo yum install -y golang
HOME=/home/ec2-user
MyHOME=/home/ec2-user
echo "now setting up go-lang paths"
# GOROOT is the location where Go package is installed on your system
echo "export GOROOT=/usr/lib/golang" >> $HOME/.bash_profile
echo "export GOROOT=/usr/lib/golang" >> $MyHOME/.bash_profile
# GOPATH is the location of your work directory
echo "export GOPATH=$HOME/projects" >> $HOME/.bash_profile
echo "export GOPATH=$MyHOME/projects" >> $MyHOME/.bash_profile
# PATH in order to access go binary system wide
echo "export PATH=$PATH:$GOROOT/bin" >> $HOME/.bash_profile
echo "export PATH=$PATH:$GOROOT/bin" >> $MyHOME/.bash_profile
export GOROOT=/usr/lib/golang
export GOPATH=$HOME/projects
export GOPATH=$MyHOME/projects
export PATH=$PATH:$GOROOT/bin
source $HOME/.bash_profile
source $MyHOME/.bash_profile
sudo go get github.com/go-stack/stack

@ -38,7 +38,7 @@ func getPeers(myIp, myPort, myShardId string, config *[][]string) []p2p.Peer {
var peerList []p2p.Peer
for _, node := range *config {
ip, port, status, shardId := node[0], node[1], node[2], node[3]
if status == "leader" || ip == myIp && port == myPort || myShardId != shardId {
if status != "validator" || ip == myIp && port == myPort || myShardId != shardId {
continue
}
peer := p2p.Peer{Port: port, Ip: ip}

@ -10,9 +10,11 @@ fi
./kill_node.sh
config=$1
while IFS='' read -r line || [[ -n "$line" ]]; do
IFS=' ' read ip port mode <<< $line
IFS=' ' read ip port mode shardId <<< $line
#echo $ip $port $mode $config
if [ "$mode" != "client" ]; then
go run ./benchmark_main.go -ip $ip -port $port -config_file $config -log_folder $log_folder&
fi
done < $config
go run ./aws-code/transaction_generator.go -config_file $config -log_folder $log_folder

@ -9,9 +9,10 @@ sudo sysctl -w net.ipv4.tcp_wmem='65536 873800 1534217728';
sudo sysctl -w net.ipv4.tcp_mem='65536 873800 1534217728';
./kill_node.sh
MyHOME=/home/ec2-user
source ~/.bash_profile
export GOROOT=/usr/lib/golang
export GOPATH=$HOME/projects
export GOPATH=$MyHOME/projects
export PATH=$PATH:$GOROOT/bin
python aws-scripts/preprocess_peerlist.py
FILE='isTransaction.txt'

@ -20,3 +20,4 @@
127.0.0.1 9029 validator 1
127.0.0.1 9000 leader 0
127.0.0.1 9001 leader 1
127.0.0.1 9999 client 0

@ -57,7 +57,7 @@ func (node *Node) getTransactionsForNewBlock(maxNumTxs int) ([]*blockchain.Trans
// Start a server and process the request by a handler.
func (node *Node) StartServer(port string) {
node.log.Debug("Starting server", "node", node)
node.log.Debug("Starting server", "node", node, "port", port)
node.listenOnPort(port)
}

Loading…
Cancel
Save