Skip to content

Commit

Permalink
Add Evaluation Results and Add SimulateRace
Browse files Browse the repository at this point in the history
  • Loading branch information
hoang-ho committed Mar 18, 2021
1 parent 38746a4 commit b385622
Show file tree
Hide file tree
Showing 27 changed files with 242 additions and 88,132 deletions.
54 changes: 48 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ project
│ TestCase1.json
│ TestCase2.json
│ TestCase3.json
│ TestCase3Modified.json
│ TestCase2EC2.json
│ TestCase3EC2.json
│ TestCase3EC2Modified.json
└───doc
│ │ doc.md // design description
Expand Down Expand Up @@ -41,11 +43,21 @@ project

## Performance Evaluation

Test cases are:

![Screenshot](../TestCases.png)

Test Case 3 modified is to check how performance of the network changes when a node 2 and node 3 is connected!

The data are in the data folder, and I skipped the first 2 entries due to some processes start up slower than others.
There are around 1000 data points for each measurement criteria. I average all data points to got the results in the table.
Lookup Response Time is the time elapsed between when the Buyer first sends out a lookup request and when the Buyer receives a reply from Seller!

**Local Computer**

The data are in the data folder, and I skipped the first few entries due to some processes start up slower than others.
My local computer is a 4 core 16GB RAM.

| TestCase | Peer | Lookup ResponseTime (ms) | lookupRPC (ms) | replyRPC (ms) | buyRPC (ms) |
| TestCase | Peer | Lookup Response Time (ms) | lookupRPC latency (ms) | replyRPC latency (ms) | buyRPC latency (ms) |
| :--- | :----: | :----: | :---: | :---: | ---: |
| TestCase3.json | Node 0 | 41.36 | 6.04 | 4.6 | 3.5 |
| TestCase3.json | Node 1 | 35.72 | 6.3 | 3.4 | 3.3 |
Expand All @@ -62,8 +74,38 @@ The data are in the data folder, and I skipped the first few entries due to some
| TestCase3Modified.json | Node 5 | _ | 7.2 | 14 | _ |
| TestCase3Modified.json | Node 6 | _ | 8.4 | 7 | _ |

As we can see from the table, the lookup response time increases drastically when a new connection between node 2 and node 3 is introduced.
The increase in response time for node 0 and 1 is bigger than increase in response time for node 2. This is due to node 3 being a connecting node for node 0 and node 1 to the Seller, but now node 3 also have to serve node 2.
The increase in response time can be due to (1) our single machine has to create extra threads to handle service call and context switching takes more time; (2) node 3 becoming a bottleneck since it has so many clients to serve!
There are some increases in latency in lookupRPC and replyRPC, but this is much smaller compare to the increase in lookup response time!

**EC2 Cluster**

I deploy each peer on a t2-micro EC2 instance. I skipped the first 2 entries due to some processes start up slower than others!

| TestCase | Peer | Lookup Response Time (ms) | lookupRPC latency (ms) | replyRPC latency (ms) | buyRPC latency (ms) |
| :--- | :----: | :----: | :---: | :---: | ---: |
| TestCase3.json | Node 0 | 34.5 | 5.77 | 5.4 | 5.9 |
| TestCase3.json | Node 1 | 29.7 | 6.6 | 4.8 | 3.9 |
| TestCase3.json | Node 2 | 26.1 | 5.7 | 4 | 3.9 |
| TestCase3.json | Node 3 | _ | 6.5 | 5 | _ |
| TestCase3.json | Node 4 | _ | 5.3 | 4.6 | _ |
| TestCase3.json | Node 5 | _ | 4.7 | 6.04 | _ |
| TestCase3.json | Node 6 | _ | 4.9 | 5.3 | _ |
| TestCase3Modified.json | Node 0 | 41.1 | 7.3 | 5.0 | 5.3 |
| TestCase3Modified.json | Node 1 | 35.7 | 6.3 | 4.8 | 3.6 |
| TestCase3Modified.json | Node 2 | 28.8 | 6.3 | 3.8 | 3.1 |
| TestCase3Modified.json | Node 3 | _ | 7.4 | 5 | _ |
| TestCase3Modified.json | Node 4 | _ | 5.7 | 4.7 | _ |
| TestCase3Modified.json | Node 5 | _ | 4.03 | 6 | _ |
| TestCase3Modified.json | Node 6 | _ | 4.64 | 4.6 | _ |

Similarly, on a distributed environment, the response time for lookup request increase when we introduce a new connection between 2 and 3.
The increase in response time for node 0 and 1 is bigger than increase in response time for node 2. This is due to node 3 being a connecting node for node 0 and node 1 to the Seller, but now node 3 also have to serve node 2.
However, the increase is much less compare to single server! This can be due the cost of new connection is distributed among involved peers on different machine,
while on a single server, the machine incurs the whole cost.

From the experimental results, we can conclude that when a


## Build and Test
Expand All @@ -72,14 +114,14 @@ The data are in the data folder, and I skipped the first few entries due to some

The project is build with Java 1.8, Gradle 6.7, and gRPC 1.36.0

To run:
To compile the code:
```
$ ./gradlew clean build
```

**hopcount** is hardcoded to be 1 for milestone 1. Professor confirmed that it's okay to have the two peers: one buyer, one seller for milestone 1.
### To deploy on EC2 instance

Image ID for the customized EC2 instance:
View instruction in doc/testVerify.md. Customized image with Java 8, git installed and repo cloned:

{
"ImageId": "ami-07916b33d72291f85"
Expand All @@ -91,7 +133,7 @@ Image ID for the customized EC2 instance:
- [X] Test case 1: 1 buyer and 1 seller
- [X] Test case 2: Race condition 2 buyers 1 seller
- [X] Test case 3: 7 peers 3 Buyers 2 Sellers 2 peers
= [ ] Simulate a race condition
- [X] Simulate a race condition
- [X] Running test case on a single server EC2
- [X] Deploy test case on EC2 cluster
- [X] Measure latency
73 changes: 73 additions & 0 deletions TestCase3EC2Modified.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"N": "7",
"K": "4",
"network": [
{
"id": "0",
"IPAddress": "172.31.45.247",
"port": "8080",
"neighbors": [
"3",
"1"
]
},
{
"id": "1",
"IPAddress": "172.31.91.178",
"port": "8080",
"neighbors": [
"0",
"2",
"3"
]
},
{
"id": "2",
"IPAddress": "172.31.88.28",
"port": "8080",
"neighbors": [
"1",
"3",
"4"
]
},
{
"id": "3",
"IPAddress": "172.31.55.0",
"port": "8080",
"neighbors": [
"0",
"1",
"2",
"5"
]
},
{
"id": "4",
"IPAddress": "172.31.18.128",
"port": "8080",
"neighbors": [
"2",
"6"
]
},
{
"id": "5",
"IPAddress": "172.31.85.180",
"port": "8080",
"neighbors": [
"3",
"6"
]
},
{
"id": "6",
"IPAddress": "172.31.95.38",
"port": "8080",
"neighbors": [
"4",
"5"
]
}
]
}
15 changes: 2 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,11 @@ protobuf {
}
}

task p2pSeller(type: JavaExec) {
task simulateRace(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "com.p2p.grpc.Seller"
main = "com.p2p.SimulateRace"
}

task p2pBuyer(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "com.p2p.grpc.Buyer"
}

task p2pPeer(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "com.p2p.grpc.PeerImpl"
}


test {
useJUnitPlatform()
}
Loading

0 comments on commit b385622

Please sign in to comment.