Sockets Activity
The purpose of this activity is to explore the performance of the client/server
communication in a variety of configurations. Several performance measures will
be used to compare the impact of different architectures on these measures.
Demo code and support files
Zip file and makefile with client and server demo code: sockets.zip
Submit this spreadsheet with your measurements: sockets spreadsheet
Windows cygwin configuration document: cygwin_config
Build and test Demo C code
- Place the provided client and server C code files in the sockets directory on nitron.
- Verify that the supplied demo code compiles and runs on nitron. Run the server in
one ssh terminal and the client in a second ssh terminal.
- Compile: gcc -o client -g -Wall client.c and gcc -o server -g -Wall server.c
- Run server code: ./server 30000 (30000 is one possible port number.
If not available pick a port number over 2048 and less than 65536.)
- Run client code: ./client nitron.se.rit.edu 30000 (must be the same port number.)
- The demo version sends one message and gets one hard-coded response.
Measurements Overview
- For all measurements do not impact the performance by doing printf's!
- Tip -- the time utility may be useful or use some timer code
- Elapsed time -- measure the amount of time that the client is running
using the linux time utility.
- Connection time -- measure by opening, sending, receiving, and closing
for each message initiated by the client. For all other measurements
keep the client to server socket open.
- Measure latency and bandwidth
- Measure between client and server on nitron.
- Measure between client on nitron and server on control.
- Measure between client on your laptop or workstation and server on nitron.
Measure Latency
On the client system using the ping utility to measure latency. Use Control-c to stop the ping.
- On nitron (to self): ping nitron.se.rit.edu
- On nitron (to control): ping control.se.rit.edu
- On your laptop or workstation (to nitron): ping nitron.se.rit.edu
Record the average on the spreadsheet omitting obvious outliers for each of the three configurations.
Measure Connection Time:
- Create a subfolder called connection.
- Hard code 1000 loops or pass in 1000 as a command line parameter.
- Use the time utility to measure total elapsed time.
e.g. time ./client nitron.se.rit.edu 30000
- Loop for 1000 passes
- make connection
- send a small (10 bytes) message
- wait for the response (10 byte response).
- close connection.
- Divide the client elapsed time by the number of passes in the loop. This is the approximate connection time.
- Do this for all three configurations:
- both client and server on nitron
- client on nitron and server on control
- client on your home system with server on nitron.
- Record the connection time in the spreadsheet for each of the three configurations.
- Make sure your server program exits! You could send a special character
in the first position of the last message to exit like a # character.
Measure bandwidth (throughput):
- Create a bandwidth subfolder.
- Change a copy of your connection code to make the connection only once before the loop of 1000 messages.
- Next change your client code to send a 1400 byte message from the client to server.
- Change your server code to send back a 1400 byte message.
- Use the time utility to measure the sending and receiving of 1000 sent and received messages.
- Calculate the approximate bandwidth:
- Total data sent in both directions is 1000 * 2 * 1400
- Divide the total by the elapsed time to get the approximate bandwidth
- Record this in the spreadsheet
- Do this for all three configurations:
- both client and server on nitron
- client on nitron and server on control
- client on your home system with server on nitron.
Submission
- Submit your code and the spreadsheet to your repo to a the sockets folder and subdirectories as described above.
- This is due by end of day Monday April 29th.
Larry Kiser, April 12, 2024
Larry Kiser: simplified and revised April 20, 2024