The performance monitor manages status information from every node and super node. It consists of a server which collects status information, and client code which runs on every node and super node, periodically sending status information.
Information collected is:
- bytes sent and received over time for every node and super node
- latencies between each node and its super node
- latencies between each pair of super nodes.
Performance monitoring occurs on every node in the network, including the super-nodes. All of these nodes are expected to call our functions upon receiving and sending bytes and when the system clock is updated. Performance information is logged locally and uploaded periodically via an HTTP GET request to the performance server.
//initialization: PerfMonitorNode perfMon = new PerfMonitorNode(); //upon message sent: perfMon.sentMessage(int msgLength); // length of message in bytes //Upon message received: perfMon.recvMessage(int msgLength); // length of message in bytes //Upon clock synchronization response: perfMon.rtt(int rtt); // round trip time in milliseconds
PerfMonitorNode | |
---|---|
Constructor Summary | |
PerfMonitorNode() | Initializes a new performance monitor for your node, which should create a new thread that interrupts every N seconds to upload new data, creates a new log file unless one exists already, and create and clear some internal variables (or update them from the log file). |
Public Method Summary | |
public void sentMessage(int msgLength) | Should be called on every message sent to log outgoing bytes. Waits for lock to be free, acquires it, updates totalBytesSent and totalMsgsSent, then releases the lock. |
public void recvMessage(int msgLength) | Should be called on every message received to log incoming bytes. Waits for lock to be free, acquires it, updates totalBytesRecv and totalMsgsRecv, then releases the lock. |
public void rtt(int rtt) | Update latest round trip time (in milliseconds). Should be called inside clock synchronization function. |
Private Method Summary | |
private void sendUpdate() | Sends update of current log information to main server. Should be called every N seconds from a thread started at the constructor. |
Private Variables Summary | |
private int totalBytesSent | |
private int totalBytesRecv | |
private int totalMsgsSent | |
private int totalMsgsRecv | |
private smoothedRtt | Smoothed round-trip time |
private Lock l | Private lock that manages writes to variables above. See Lock |
The server system will run on music.cs.cmu.edu and consist of 4 files:
- a Python script which receives GET requests from the nodes containing status information
- a plain-text file containing aggregate status information
- a lock file for the text file
- a Python script that reads the text file and produces an HTML view of the data