Skip to content

Commit 06fadec

Browse files
authored
Merge pull request #4 from vicweeks/milestone4-patch0
Milestone4 patch0
2 parents 66226d1 + ccbaf6a commit 06fadec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+447
-2396
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
11
# CS455-HW2-PC
2-
Intro to Distributed Systems: Homework 2
2+
## Intro to Distributed Systems: Homework 2
3+
4+
### Usage:
5+
* Compile the program using ```make```.
6+
7+
* Create one server with the command ```java cs455.scaling.server.Server <portnum> <thread-pool-size>``` where <portnum> is the desired port for the ServerSocketChannel and <thread-pool-size> is the desired size of the thread pool that will be handling tasks.
8+
9+
* Create multiple instances of clients with the command ```java cs455.scaling.client.Client <server-host> <server-port> <message-rate>``` where <server-host> is the name of the host that the server is running on, <server-port> is the port that the server is running on, and <message-rate> is the number of messages per second that each client should send.
10+
11+
* Every 20 seconds the server will print its status to the console. This status includes a timestamp, the server throughput in messages/second, the number of active client connections, the mean per-client throughput in messages/second, and the standard deviation of per-client throughput in messages/second.
12+
13+
* Every 20 seconds each client will print their status to the console. This status includes a timestamp, the number of messages send in the last 20 seconds, and the number of messages received in the last 20 seconds.
14+
15+
16+
### Class Desriptions:
17+
18+
#### client
19+
* Client.java : This class provides the following functions:
20+
1. Connect and maintain an active connection to the server.
21+
2. Regularly send data packets to the server. The payloads for these data packets are 8 KB and the values for these bytes are randomly generated. The rate at which each connection will generate packets is R per-second.
22+
3. Tracks hashcodes of the data packets it has sent to the server. Checks received hashcodes against stored ones.
23+
24+
#### server
25+
* Server.java : This class proveds the following functions by relying on a thread pool.
26+
1. Accepts incoming network connections from the clients.
27+
2. Accepts incomming traffic from these connections.
28+
3. Creates tasks for each message that reply to clients with a hash code for that message.
29+
30+
#### tasks
31+
* ClientSendTask.java : This class represents a thread responsible for the logistics of sending messages to the server.
32+
33+
* ClientTask.java : This class represents a thread responsible for receiving replies from the server.
34+
35+
* ServerTask.java : This class represents a single task that threads from a pool can be assigned to complete. Such a task involves reading a message from a channel, computing its hash code, and sending that hash code back to the client.
36+
37+
* TestTask.java : This class is a way to test the functionality of the thread pool without any server/client activity.
38+
39+
#### threadpool
40+
* FixedThreadPool.java : This class is a thread safe implementation of a thread pool. It handles the creation of a thread pool of a fixed sized. It also allows a thread pool manager to retrieve available worker threads and assigned them tasks. Worker threads are able to add themselves back to the pool upon task completion.
41+
42+
* ThreadPoolManager.java : This class manages the thread pool by maintaining a list of tasks that need to be completed and assigning those tasks to threads from the thread pool.
43+
44+
* WorkerThread.java : This class allows threads to remain idle in a pool until assigned a task.
45+
46+
#### util
47+
* ClientLogger.java : This class handles client status logging and printing to the console. A timer object utilizes this task to print to the console every 20 seconds.
48+
49+
* HashCache.java : This class is a thread safe way for clients to store the hash codes of messages they have sent. It allows clients to compare received hash codes to stored ones and removes them from the list in the case of a match.
50+
51+
* HashGenerator.java : This class handles the generation of SHA1 hash codes and conversion of such codes to string representations.
52+
53+
* ServerLogger.java : This class handles server status logging and printing to the console. It maintains throughput loggers for all clients and calculates the mean and standard deviation of per-client throughput.
54+
55+
* ThroughputLogger.java : This class allows the server to track throughput for a single client.

README.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,63 @@ Intro to Distributed Systems: Homework 2
33
Victor Weeks
44
Feburary 7, 2018
55

6+
Usage:
7+
* Compile the program using ```make```.
8+
9+
* Create one server with the command ```java cs455.scaling.server.Server <portnum> <thread-pool-size>``` \
10+
where <portnum> is the desired port for the ServerSocketChannel and \
11+
<thread-pool-size> is the desired size of the thread pool that will be handling tasks.
12+
13+
* Create multiple instances of clients with the command ```java cs455.scaling.client.Client <server-host> <server-port> <message-rate>``` \
14+
where <server-host> is the name of the host that the server is running on, \
15+
<server-port> is the port that the server is running on, and \
16+
<message-rate> is the number of messages per second that each client should send.
17+
18+
* Every 20 seconds the server will print its status to the console. This status includes a timestamp, the server throughput in messages/second, \
19+
the number of active client connections, the mean per-client throughput in messages/second, and the standard deviation of per-client throughput in messages/second.
20+
21+
* Every 20 seconds each client will print their status to the console. This status includes a timestamp, the number of messages send in the last 20 seconds, and \
22+
the number of messages received in the last 20 seconds.
23+
24+
25+
Class Desriptions:
26+
27+
client
28+
* Client.java : This class provides the following functions:
29+
1. Connect and maintain an active connection to the server.
30+
2. Regularly send data packets to the server. The payloads for these data packets are 8 KB and the values for these bytes are randomly generated. \
31+
The rate at which each connection will generate packets is R per-second.
32+
3. Tracks hashcodes of the data packets it has sent to the server. Checks received hashcodes against stored ones.
33+
34+
server
35+
* Server.java : This class proveds the following functions by relying on a thread pool.
36+
1. Accepts incoming network connections from the clients.
37+
2. Accepts incomming traffic from these connections.
38+
3. Creates tasks for each message that reply to clients with a hash code for that message.
39+
40+
tasks
41+
* ClientSendTask.java : This class represents a thread responsible for the logistics of sending messages to the server.
42+
43+
* ClientTask.java : This class represents a thread responsible for receiving replies from the server.
44+
45+
* ServerTask.java : This class represents a single task that threads from a pool can be assigned to complete. Such a task involves reading a message from a channel, computing its hash code, and sending that hash code back to the client.
46+
47+
* TestTask.java : This class is a way to test the functionality of the thread pool without any server/client activity.
48+
49+
threadpool
50+
* FixedThreadPool.java : This class is a thread safe implementation of a thread pool. It handles the creation of a thread pool of a fixed sized. It also allows a thread pool manager to retrieve available worker threads and assigned them tasks. Worker threads are able to add themselves back to the pool upon task completion.
51+
52+
* ThreadPoolManager.java : This class manages the thread pool by maintaining a list of tasks that need to be completed and assigning those tasks to threads from the thread pool.
53+
54+
* WorkerThread.java : This class allows threads to remain idle in a pool until assigned a task.
55+
56+
util
57+
* ClientLogger.java : This class handles client status logging and printing to the console. A timer object utilizes this task to print to the console every 20 seconds.
58+
59+
* HashCache.java : This class is a thread safe way for clients to store the hash codes of messages they have sent. It allows clients to compare received hash codes to stored ones and removes them from the list in the case of a match.
60+
61+
* HashGenerator.java : This class handles the generation of SHA1 hash codes and conversion of such codes to string representations.
62+
63+
* ServerLogger.java : This class handles server status logging and printing to the console. It maintains throughput loggers for all clients and calculates the mean and standard deviation of per-client throughput.
64+
65+
* ThroughputLogger.java : This class allows the server to track throughput for a single client.

cs455/scaling/HW1_Classes/node/MessagingNode.java

Lines changed: 0 additions & 99 deletions
This file was deleted.

cs455/scaling/HW1_Classes/node/Node.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

cs455/scaling/HW1_Classes/node/Registry.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

cs455/scaling/HW1_Classes/routing/RoutingEntry.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

cs455/scaling/HW1_Classes/routing/RoutingTable.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)