santoshdhirwani / benchmark_ethereum Goto Github PK
View Code? Open in Web Editor NEWThis repository was created to automate the benchmarking process of private ethereum deployment with caliper.
This repository was created to automate the benchmarking process of private ethereum deployment with caliper.
Adding a flag in main.py to ask the user whether he/she wants the detailed output to be printed or not.
At present, a lot of things are being printed while running the tool which makes it very difficult for the user to understand exactly which step is being executed.
We need a flag in main.py for the user to specify if the detailed output is required to be printed or not (beneficial for debugging).
This task should add meaningful comments in main.py to print clearly which step is being executed at the moment.
The code must run without any errors.
The execution must print clearly the steps of the execution and results of each step in case the flag is enabled for used mode.
The execution must print all the output (as it is now) in case the flag is enabled for debug mode
We need to create a first draft for the final presentation so we can get some early feedback from Jacob in the next meeting (04.02.2020).
The presentation must have a structure
It must have all content which is more or less ready, for example, all of the theoretical content, system design, etc.-ON HOLD due to results
The repo is accumulating scripts and the README needs to be updated accordingly.
The README should include not only the directory map of the repo but also the installation and execution instructions. It must also explain every value in the json config file and list every dependency used.
The repo structure should be reorganized to be more descriptive, specifically follow the modular organization.
Inside bin we should have the following:
main.py
sut/ - with all the SUT deployment automation scripts and files needed
workload/ - with all the workload (caliper) scripts and configuration files needed
analyzer/ - with all the aggregator scripts and possible scripts that deal with reading results.
This organization needs to change correctly every path that is written in every script or errors will appear.
The tool is running without any errors
The README is clear and describes all the information requested in the task
We need to receive nodes, gas limit and block interval as argument and create the same number of accounts as nodes locally with geth.
Like in task #18 It will create the genesis file taking block interval and gas limit as well as the accounts that should be added as sealers. This must be done without using puppeth
Currently our prerequisites.sh file installing Caliper using Global NPM method. However this method not working well in practical. We need to change using Local NPM method and put Caliper inside folder workload.
Another package that need to install is web3. This web3 should installed inside workload folder too.
Improvement from current prerequisites.sh file
The issue must include User Story, Tasks, Acceptance Criteria, Notes, Deadline and Story Points.
#33 MUST BE FINISHED BEFORE TAKING THIS TASK
We should create a script that creates a VM template. The process should be the following:
The SUT script uploaded #47 works with some considerations to further develop. One of them is changing the gas limit in the genesis file.
After creating the genesis file, we need to edit the json file and write the gas limit received as parameter in hex value.
We need to create a workload deployment script. This deployment script will use the caliper image and will build the same number of containers as number of nodes of the SUT. When deployed, each container will benchmark one node and generate results.
Story: #22 Workload deployment
We need to discuss how are we going to gather the experiment result from each container
We need to implement the following algorithm.
https://github.com/Cloud-Prototyping-WS-2019-20/cp_ws_1920/blob/algorithm-flowsharts/documentation/Lower%20Bound%20Gas%20Limit.pdf
The code of main.py executes without errors.
The implemented code executes correctly the algorithm defined and obtains the lower bound block gas limit
We need to change deploy-sut.sh to build nodes in different zones / regions if the user asks for.
The code runs without errors
The SUT builds nodes in different regions / zones
Test
We need a script that reads the results of the experiment and finds the optimal values.
Specifically this mockup script can read for now from a file fake experiment results (block gas limit, block interval, throughput) and it must find minimum the block gas limit and block interval values that offer the maximum improvement.
The script also receives the sensitivity configuration parameter (minimum difference value of improvement to keep searching for optimal values).
Find the mathematical value for parameters value to test, by researching about operational research
Story: #14 Block gas limit and block interval optimal values
This story can benefit from the results of #19
Right now main.py script is giving the final result in a print command. We need to generate a meaningful report to the final user where he can see the final output of our tool and meaningful insights of our execution.
The idea is to modify aggregate-results so that it creates a HTML format report with the information of our execution, plotting useful graphs.
The script must run without errors
Once the execution of the tool is finished a report in HTML should be available to open and see the result and meaningful insights of our execution.
Make the the network id, the username and the password configurable in the config file so it can be read by SUT-deploy script.
Right now INSTANCE_LIST and INSTANCE_IP_LIST are extracting different information from the same list and we are assuming that the output will list in the same order. To avoid having future problems with our assumption INSTANCE_LIST and INSTANCE_IP_LIST should be merged into one. it will also need changes in the gcloud command and script adaptation.
Add to the prerequisite script the installation of pm2, mention the right versions of packages and document correctly the needed version is the README.
The code must run without errors.
The information should be self explanative and clear for the user
We need a script that runs the caliper command to benchmark the blockchain. The script should:
Receive as exec parameters the IP and port of a node, the account and its password.
Write under the ethereum network configuration file of caliper the configuration needed to benchmark a node with the parameters received
Execute the caliper command to benchmark.
We will run caliper locally, we will not use the docker image.
As a user, I want the analyzer to give me the optimal ethereum block gas limit and block interval
#19 Find useful literature that research about block gas limit and block interval impact.
#20 Mockup script to test the optimization of block gas limit and block interval.
#21 Script to aggregate the results of the tests in one place
We need a script that aggregates the HTML results of the tests.
Caliper generates HTML reports from the experiments, in order to treat the information we need, we have to go through the HTML reports and gather the values we need.
Story: #14 Block gas limit and block interval optimal values
This task is open for discussion, we still need to know the values that are going to be read (we may have several contract functions to read). We also need to agree if either this script will send the results to other script or if it should write them in a file that later on will be read.
As an end user, I want to have the documentation about the tool and research done to build it
Final report first part
Requirements to build and run the project
Readme with procedure to run the tool
Final report finished
Final presentation finished
Tool documentation finished
We need to experiment and see what is the behavior of the network for different gas limit and block interval configurations, we are interested in seeing what can be the normal stats when executing caliper and what are the stats when executing caliper with a extreme gas limit and block interval configuration.
We also need to know if there is a better way to detect a possible stagnation or benchmark crash than just executing caliper (e.g. block propagation, latency). In order to find out which values could be important and how to actually monitor them in our tool, we need first to analyze with an existing tool different benchmark situations.
Using something like https://ethstats.net/ can be interesting for this task.
https://medium.com/coinmonks/how-to-build-ethereum-dashboard-and-to-monitor-your-ethereum-network-status-9f1941beac08
https://github.com/goerli/ethstats-server
https://github.com/goerli/ethstats-client
Find out what is the expected behavior of the network for the workload it is configured now in our tool
Recommend stats that we can use to detect a possible crash or stagnation
In order to make easier the implementation of calculate-optimal-values.py added in #57, we need to modify aggregate-html-reports.py to generate file with a grid of the results.
This script should receive as parameters the maximum and minimum values of both block interval and block gas limit and their steps. Then for each function in the workload benchmarked (for now open and transfer) it should create a file with a grid of results. This grid should have same number of rows and columns as block gas limit and block interval respectively, separated in comas and line jumps.
Results must be organized correctly in the grid. Imagine 3x3 example:
min gas limit = 10m, max gas limit = 20m, gas limit step = 5m
min interval = 10, max interval = 20, interval step = 5
The result is organized this way (x= gas limit, y= interval)
.........10,15,20
10m 15,17,19
15m 25,27,29
20m 30,32,34
Being the file output this format:
15,17,19
25,27,29
30,32,34
The idea is to use a script that uses Google SDK to connect to GKE and manage the SUT. We need to know if, after deploying with Kubernetes the SUT in the same cluster, we can receive an event warning us the the nodes have been correctly deployed. This will be needed to know when to accept a new sealer node in the network.
GKE will create containers in a cluster, the idea is that we will have one node per container. Theoretically the nodes will be built in the same machine, which means that these can not use the same ports. However with GKE we have the possibility of publishing services to access containers that can have different IP:Ports addresses even if they are in the same cluster/machine. We need to know if the use of services can solve our problem of publishing the Ethereum nodes even if these are in the same cluster.
Story: #13 Ethereum SUT Deployment
The research should be documented commenting in this issue with the sources found. If possible, suggest a way of applying the solution.
We can actually run several rounds in Caliper. The idea is that the aggregating script should also gather these rounds from the report files.
We know that caliper will fail with certain configurations and we can not let the whole tool to fail. run-caliper.py should handle caliper errors.
A variable must be added in the config file specifying the number of tries until we assume the execution of caliper failed.
This script should be also improved to delete the residual reports generated (possible benchmark reports created even though the execution failed) in case of failure.
If the execution of caliper completely failed after trying a number of times this script should return this information to the main script, exit(-1) should be enough.
UPDATE 24/01: As of 23/01 this task was nearly fulfilled but we have seen that the caliper command does not fail if the benchmark prints a failure. A proposed solution for this can be seen in #74
We need to deploy a VM for each node, in order to make this possible we need a deployment script that will install all whats needed to run ethereum in the VM.
This script will just install the dependencies needed to run an ethereum node or a bootnode
We need to know if the bootnode gathers information of the nodes already connected in the network. If it gathers the information, we want to know if we can somehow retrieve it and use it in a script. This will be needed for the SUT deployment script.
Story: #13 Ethereum SUT Deployment
The research should be documented commenting in this issue with the sources found. If possible, suggest a way of applying the solution.
Documentation must be done to deliver our project. There are some parts that can be done already:
Relevant Literature gathered
Introduction
Background
#30 Project Documentation
We need to implement the following algorithm:
https://github.com/Cloud-Prototyping-WS-2019-20/cp_ws_1920/blob/algorithm-flowsharts/documentation/OptiBench%20Flowshart.pdf
The code runs without errors.
The code implements correctly the algorithm to obtain the optimal combination of block gas limit and block interval for the maximum TPS
As a user, I want the infrastructure controller automatically to build the Ethereum SUT for me.
The SUT Deployment Script is divided in 2 parts, both should be merged in one in the end (It may be added as a new task).
We suppose that the user does not have knowledge about what is the configuration of block gas limit and block interval where he can have no more improvement.
Our tool should by benchmarking find these last improvement configuration values.
A new configuration variable should be added in the config file to indicate the minimum performance improvement difference.
E.g. If the config value is 5, the algorithm should stop after seeing less than 5% improvement between benchmarks.
We need to implement this algorithm in main.py.
We suppose that the user does not have knowledge about what is the minimum block interval and gaslimit values that he can try.
Our tool should by benchmarking and handling the crashes find these minimum values. From these minimum values it will continue benchmarking step by step until finding the last improvement configuration values.
We need to implement this algorithm in main.py.
As a user, I want the infrastructure controller to automatically set up the workload to benchmark the SUT.
Create Caliper container image
Create Workload deployment script
We need to implement the benchmark algorithm specified in #76.
This task is divided into 2 tasks: #80 #81
The algorithm executes the designed flow correctly.
The code should handle errors correctly.
The implementation should obtain the combination of block interval and block gas limit for the maximum TPS found in the execution
The task is to check if the GCP setup exists or not based on the user input.
We add a flag in main.py: 1 or 0
(so that the user can decide to use an existing setup or clean the existing setup and create a new one.)
The default flag must be to use the existing setup.
When the user does 1: We just clean the existing setup
When the user does 0:
we check what is currently running if he is right then we do the normal flag 0 execution
we check what is currently running if he is wrong then we do the flag 1 execution
"If he is right" means checking on GCP mainly the number of nodes, if it matches with config.json or not.
At present, deploy-sut.sh has a flag that does this but it needs to be done as the first step when the user runs main.py.
The code must run without errors.
The script must correctly ask for the flag and accept the response correctly.
We need the main script to read from the config file the user will use to add his/her desired parameters.
Parameters that needs to read from the config file:
These parameters will also be accordingly sent to the other scripts we are creating.
In this simple task we need to update the current scripts to make them return a value that will help the main script to know if their execution worked.
https://github.com/Cloud-Prototyping-WS-2019-20/cp_ws_1920/blob/master/bin/Python%202/temp.py
https://github.com/Cloud-Prototyping-WS-2019-20/cp_ws_1920/blob/master/bin/build-tag-push-docker-image.sh
The return value should be an integer value and if the execution is successful it must return 0, if there was any error it should return -1
Please change the name of the temp.py file to aggregate-html-reports.py
When executing the SUT it is not completely automated:
When deleting the previous environment is asking for the user permission. We must agree if this needs a user answer or not for the sake of automation and speed.
After creating the machines if no SSH key is found it prompts a cli to create them, needing a passphrase input 2 times.
When accessing the just created VMs for the first time, it will ask for the passphrase added in the previous step. It will ask for it for each machine we are trying to access.
Right now the algorithm is trying to find the minimum gas limit for every interval but when testing the algorithm we have seen that the minimum gas limit for every interval is pretty identical and this calculation takes a lot of time.
The idea is to change optibench algorithm under find_optimal_parameters function to use the first min gas limit value for any interval.
UPDATE 04/02:
We need to improve this algorithm, research fast if the algorithm can be improved estimating the gas of the workload contract. If not take the previous minimum gas limit as a reference to calculate the new one.
The code must run without errors
The algorithm should calculate the minimum gas limit in the first interval and then be used in the following intervals, avoiding the calculation that is being done now every interval iteration.
We need to create a caliper container image that will be used to deploy it in a cluster. We need to take into account that it will need configuration template files that will be changed while deploying.
Parameters that will be received by this image:
IP and port of a node
Account address
Account password
Story: #22 Workload Deployment
We want caliper to hit every node. We need to make sure if we can execute several caliper instances in the same machine or if we can not have several caliper instances in the same machine
We need to ease the installation of the tool to the user. We are already installing libraries and dependencies and we need to take care of them to facilitate the installation of the user.
We need a script that:
The code of the script runs without any errors (error handling correctly used)
The code should print clear steps of how to install or at least show a link with clear documentation of how to install what is needed.
If everything is installed, show a message that dependencies are fulfilled.
If after running the script everything is fulfilled, main.py must be able to run correctly without dependencies errors
the script is in #72
We need a script that deploys the Ethereum SUT.
This part of the script should receive a notification of GCP whenever a new node is set up and running. After receiving such notification it will communicate with the nodes already sealing to accept this new node as a new sealer.
Update 17-12-19:
After discussion, we decided to add the sealers with the genesis file. The script should get the number of nodes, gas limit and block interval as argument and create the same number of accounts as nodes locally with geth. Next it will create the genesis file taking block interval and gas limit as well as the accounts that should be added as sealers. The final output for this part of the script would be the genesis.json file and the account keystores that later on will be built in the node containers.
Story: #13 Ethereum SUT Deployment
This task is open for discussion depending on the results of #15 and #16
With the SUT script #47 and the workload script #46 the main script can now execute the logic needed to benchmark.
The main script should follow this loop logic:
Build the SUT using the SUT script. Take into account this script needs parameters.
Execute the workload using the workload script. Take into account this script also needs parameters.
Wait for the results of caliper benchmarking.
The loop should change the values of block interval and gas limit for each iteration.
We need to know if there is already literature that researched about the block gas limit and block interval impact over throughput. Specifically, if there is a formula or model to apply in our solution.
Update 17/12/19: As discussed in group the information found already confirms the influence of block gas limit and block time over throughput. However, the paper does not cover PoA with block interval. Further research is needed to find more related work.
Story: #14 Block gas limit and block interval optimal values
The research should be documented here in a comment with the sources found. If possible, suggest a way of applying the solution.
Task
We need a script that deploys the Ethereum SUT.
This part of the script should take the container images published in Google Container Registry and use them to deploy the SUT.
The nodes should be accessible through an IP and port.
This script should receive as parameter the number of nodes, the block gas limit and block interval.
Story: #13 Ethereum SUT Deployment
First step of this task should be to create the YAML Kubernetes template for the deployment of nodes
https://imti.co/ethereum-kubernetes/
https://cloud.google.com/container-registry/docs/using-with-google-cloud-platform#google-kubernetes-engine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.