Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
# UW-CS739-Project1
## Part 0
Shown in part0/timing.cpp.
Comparison with clock_gettime can be done by replacing chrono calls with those of clock_gettime
## Part 1
Unless otherwise noted, all measurements are done from part1/part1.cpp
* L1 cache reference: lines 72-109
* Branch misprediction: Could not figure out good way to measure
* L2 cache reference: lines 72-82, 111-148
* Mutex lock/unlock: lines 170-182
* Main memory reference: lines 150-168
* Read 1MB from memory: lines 184-194
* Compress 1K with Zippy (now Snappy): lines 196-212
* Send 1K over 1Gbps link: lines 263-276
* RTT within the same datacenter: ping -c 10 royal-13.cs.wisc.edu
* Reading 1MB sequentially from SSD/HDD: lines 214-238
* Read 4K randomly from SSD/Disk: lines 240-261
* Packet from Madison->Netherlands->Madison: ping -c 10 government.nl
## Part 2
- The library code is in `part2/comm.hpp`
- For detail about running the program, see `part2/README.md`
A. Performance
1. Overhead
- Since we use tcpdump, this part is not fully automatic, so it's not entirely in code.
- See the commented out lines at `recv` and `send` in `comm.hpp`, where we insert clock function and calculate time difference with the timestamp from tcpdump.
2. Roundtrip
- See `part2/client.cpp` `argv[1][0] == '1'` part
3. Bandwidth
- See `part2/client.cpp` `argv[1][0] == '2'` and `argv[1][0] == '3'` part
4. Running on different machine
- See `part2/client.cpp` where it can take a hostname as an argument
5. Improvement
- See `sendbig` and `recvbig` in `part2/comm.hpp`
B. Reliability.
1, 2. Packet drop
- See `recv` in `part2/comm.hpp`
3. Same as A-2 but with packet drop
C. Compiler Optimization
- See `part2/Makefile`
## Part 3
gRPC:
Refer to the gRPC code in `part3/grpc/` folder.
A. Marshalling and unmarshalling of various data types have been measured using timers inside helloword.pb.cc file provided. Refer to the <requestType>::InternalSerialize and <requestType>::InternalParse functions to see the timing being calculated, e.g. function `HelloRequestInt::_InternalSerialize` on line 511.
```
auto start = std::chrono::high_resolution_clock::now();
//some processing
auto end = std::chrono::high_resolution_clock::now();
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start);
std::ofstream myfile;
myfile.open("serialize_int.txt", std::ios_base::app); // append instead of overwrite
myfile <<ns.count()<<std::endl;
```
Similar snippets are used across the file for other data types as well.
B. RTT is being calculated in `greeter_client.cc` in all the SayHello<datatype> functions, e.g in SayHelloInt, lines 92-100 calculate the RTT for each request. This is later used to find mean RTT in `main()` function, line 276
Each RTT involves the following overheads in order
- Marshalling request on client
- Network time
- Unmarshalling received request on server
- Server processing time
- Marshalling response on server
- Network time
- Unmarshalling response on client
Request and response times are roughly RTT/2. For different machines, we assume the clocks are synchronized.
C. For streaming and bandwidth calculation, refer to function `DoClientStream` on line 135 in `greeter_client.cc`.
D. For optimization, CMakeLists.txt has been updated with `add_compile_options(-O3)`.
For running the code and generating the measurements, please refer to README.md in `/part3/grpc`.
Thrift:
Refer to the Thrift code in `part3/thrift/` folder.
1. Marshalling and Unmarshalling of various data types: Method `marshallUnmarshallMsgs` (lines 184-409 of Client.cpp)
2. Round Trip time calculation: Method `roundTripTimeCalc` (lines 58-155 of Client.cpp)
3. Total Bandwidth: Method `bandwidthCalc` (lines 157-182 of Client.cpp)
Change the hostname in line 414.
For details regarding thrift, refer to the README.md file in the `part3/thrift/` folder.