---
# System prepended metadata

title: Lab 1

---

# Lab 1
[TOC]
1. Create a client-server application in javascript using the HTTP protocol that tests the total request to server and back (RTT) travel time with the calculation of **minimum, maximum, median and average RTT, standard deviation and skewness ratio** for client-to-server request frequencies 16Hz, 8Hz, 4Hz, 2Hz, 1Hz, and for client request sizes 128, 256, 512, 1024, 2048 bytes.
Present the results in the form of tables
2. Test the operation of your client-server application on a personal area network (PAN) and on a wide area network (WAN on replit.com hosting). 
3. Estimate the distance to the server and the characteristics of the client-server channel that can be obtained from this data
4. Compare the obtained data with the data of the system network utility ping.
## General information
### Round-Trip Time (RTT)
The Round-Trip Time (RTT) is the duration of time it takes for a signal to be sent to a destination and the acknowledgment of that signal to be received back at the source. In networking, RTT is often used as a measure of the responsiveness and performance of a network connection.

### Standard Deviation
The standard deviation is a measure of the amount of variation or dispersion in a set of values. In the context of RTT measurements, the standard deviation can indicate how spread out the RTT values are from the average RTT. A larger standard deviation suggests greater variability in the RTT values, while a smaller standard deviation suggests more consistency.

The standard deviation (σ) of a sample is calculated using the following formula:

$$
\sigma = \sqrt{\frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n}}
$$

Where:
- $x_i$ represents each individual value in the sample.
- $\bar{x}$ represents the mean of the sample.
- $n$ is the number of values in the sample.

### Skewness Ratio
Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. A skewness ratio greater than zero indicates that the distribution is skewed to the right (positively skewed), while a skewness ratio less than zero indicates that the distribution is skewed to the left (negatively skewed). A skewness ratio of zero indicates a symmetric distribution.

The skewness ratio (SR) of a sample is calculated using the following formula:

$$
SR = \frac{\frac{1}{n} \sum_{i=1}^{n}(x_i - \bar{x})^3}{\sigma^3}
$$

Where:
- $x_i$ represents each individual value in the sample.
- $\bar{x}$ represents the mean of the sample.
- $\sigma$ is the standard deviation of the sample.
- $n$ is the number of values in the sample.

## Code
[**Link to the full code on replit**](https://replit.com/@Natan-Lieonidov/Lab-1)

Let's take a look at some of the most important code fragments:

### File: server.js
```javascript
const server = http.createServer((req, res) => {
    console.log(req.url);
    if (req.url === '/') {
        ...
    } else if (req.url === '/measureRTT') {
        if (req.method === 'POST') {
            let requestData = '';
            req.on('data', chunk => {
                requestData += chunk;
            });
            req.on('end', () => {
                res.writeHead(200, {'Content-Type': 'text/plain'});
                res.end(requestData);
            });
        } else {
            res.writeHead(405);
            res.end('Only POST requests are allowed for /measureRTT');
        }
    ...
```
This code snippet creates an HTTP server using Node.js's 'http' module. It handles incoming requests and responses. It  implements a route '/measureRTT' for measuring Round-Trip Time (RTT) by responding with the received request data. The server responds to POST requests with the data received from the client.


### File: script.js

```javascript
function requestToServer(requestSize) {
    const data = generateData(requestSize);
    const startTime = Date.now();
     fetch('/measureRTT', {
         method: 'POST',
         headers: {
             'Content-Type': 'text/plain'
         },
         body: data
     })
        .then(response => {
            const rtt = Date.now() - startTime;
             return response.text()
                 .then(responseData => {
                     const sizeInBytes = responseData.length;
                      console.log('Response size:', sizeInBytes, 'bytes');
                      calculateMetrics(rtt);
                });
        })
            .catch(error => {
                 console.error('Error sending request:', error);
            });
}
```
The function `requestToServer(requestSize)` is responsible for sending a POST request to the server to measure the Round-Trip Time (RTT):

1. **Generate Data**: It generates data of the specified size using the `generateData()` function. This data will be sent in the body of the POST request.

2. **Start Time**: It records the current time as the start time before sending the request.

3. **Fetch Request**: It uses the `fetch()` function to send a POST request to the '/measureRTT' endpoint of the server. The request includes the generated data in the body and specifies the content type as 'text/plain'.

4. **Handle Response**: It handles the response from the server using a promise chain. When the response is received, it calculates the RTT by subtracting the start time from the current time. Then it parses the response data as text and calculates the size of the response body in bytes. Finally, it logs the response size and calls the `calculateMetrics()` function to calculate and update the metrics based on the RTT:



```javascript
function calculateMetrics(rtt) {

    rttValues.push(rtt);
    
     minRTT = calculateMinimum(rttValues);
     maxRTT = calculateMaximum(rttValues);
     medianRTT = calculateMedian(rttValues);
     avgRTT = calculateAverage(rttValues);
      stdDevRTT = calculateStandardDeviation(rttValues);
       skewnessRatio = calculateSkewnessRatio(rttValues);

        myConsole.innerText =
           "Current frequency: " + frequenciesHz[currentFrequencyIndex] + "\n" +
            "Amount of requests: " + rttValues.length + "\n" +
             "RTT: " + rtt + " ms\n" +
              "Minimum RTT: " + minRTT + " ms\n" +
               "Maximum RTT: " + maxRTT + " ms\n" +
                "Median RTT: " + medianRTT + " ms\n" +
                 "Average RTT: " + avgRTT + " ms\n" +
                  "Standard Deviation RTT: " + stdDevRTT + " ms\n" +
                   "Skewness Ratio: " + skewnessRatio + "\n";

        updateLoadingBar();
}
```

The following statistics are based on **100 requests** per round.

## Results of the test on a personal area network (PAN)
Technical characteristics of the computer on which the experiment was conducted:

    CPU: 
    11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz

    Base speed:            1,80 GHz
    Sockets:               1
    Cores:                 4
    Logical processors:	8

***Google Chrome*** browser was used to run the client part of the application.





<table>
    <thead>
        <tr>
            <th>Freq (Hz)</th>
            <th>Request size</th>
            <th>Total Requests</th>
            <th>Min RTT (ms)</th>
            <th>Max RTT (ms)</th>
            <th>Med RTT (ms)</th>
            <th>Avg RTT (ms)</th>
            <th>STD RTT (ms)</th>
            <th>Skewness Ratio</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>16</td>
            <td>128</td>
            <td>100</td>
            <td>6</td>
            <td>11</td>
            <td>9</td>
            <td>9.17</td>
            <td>1.34</td>
            <td>-0.0042</td>
        </tr>
        <tr>
            <td>8</td>
            <td>128</td>
            <td>100</td>
            <td>7</td>
            <td>12</td>
            <td>10</td>
            <td>9.96</td>
            <td>1.31</td>
            <td>-0.0069</td>
        </tr>
        <tr>
            <td>4</td>
            <td>128</td>
            <td>100</td>
            <td>6</td>
            <td>45</td>
            <td>10</td>
            <td>9.84</td>
            <td>3.90</td>
            <td>0.0758</td>
        </tr>
        <tr>
            <td>2</td>
            <td>128</td>
            <td>100</td>
            <td>5</td>
            <td>27</td>
            <td>10</td>
            <td>9.96</td>
            <td>2.28</td>
            <td>0.0410</td>
        </tr>
        <tr>
            <td>1</td>
            <td>128</td>
            <td>100</td>
            <td>7</td>
            <td>54</td>
            <td>10</td>
            <td>10.42</td>
            <td>5.37</td>
            <td>0.0630</td>
        </tr>
        <tr>
            <td>16</td>
            <td>256</td>
            <td>100</td>
            <td>6</td>
            <td>13</td>
            <td>10</td>
            <td>9.81</td>
            <td>1.78</td>
            <td>-0.0037</td>
        </tr>
        <tr>
            <td>8</td>
            <td>256</td>
            <td>100</td>
            <td>6</td>
            <td>14</td>
            <td>10.5</td>
            <td>10.22</td>
            <td>1.74</td>
            <td>-0.0041</td>
        </tr>
        <tr>
            <td>4</td>
            <td>256</td>
            <td>100</td>
            <td>6</td>
            <td>14</td>
            <td>10</td>
            <td>10.23</td>
            <td>1.52</td>
            <td>-0.0053</td>
        </tr>
        <tr>
            <td>2</td>
            <td>256</td>
            <td>100</td>
            <td>7</td>
            <td>15</td>
            <td>11</td>
            <td>10.61</td>
            <td>1.41</td>
            <td>-0.0042</td>
        </tr>
        <tr>
            <td>1</td>
            <td>256</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>11</td>
            <td>10.62</td>
            <td>1.45</td>
            <td>-0.0111</td>
        </tr>
        <tr>
            <td>16</td>
            <td>512</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>10.5</td>
            <td>10.15</td>
            <td>1.47</td>
            <td>-0.0091</td>
        </tr>
        <tr>
            <td>8</td>
            <td>512</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>10</td>
            <td>10.32</td>
            <td>1.38</td>
            <td>-0.0074</td>
        </tr>
        <tr>
            <td>4</td>
            <td>512</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>11</td>
            <td>10.46</td>
            <td>1.35</td>
            <td>-0.0110</td>
        </tr>
        <tr>
            <td>2</td>
            <td>512</td>
            <td>100</td>
            <td>6</td>
            <td>12</td>
            <td>9</td>
            <td>9.07</td>
            <td>1.75</td>
            <td>0.0022</td>
        </tr>
        <tr>
            <td>1</td>
            <td>512</td>
            <td>100</td>
            <td>7</td>
            <td>17</td>
            <td>11</td>
            <td>10.91</td>
            <td>1.37</td>
            <td>0.0014</td>
        </tr>
        <tr>
            <td>16</td>
            <td>1024</td>
            <td>100</td>
            <td>7</td>
            <td>15</td>
            <td>11</td>
            <td>10.43</td>
            <td>1.28</td>
            <td>-0.0037</td>
        </tr>
        <tr>
            <td>8</td>
            <td>1024</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>10</td>
            <td>10.24</td>
            <td>1.27</td>
            <td>-0.0047</td>
        </tr>
        <tr>
            <td>4</td>
            <td>1024</td>
            <td>100</td>
            <td>7</td>
            <td>14</td>
            <td>11</td>
            <td>10.56</td>
            <td>1.47</td>
            <td>-0.0092</td>
        </tr>
        <tr>
            <td>2</td>
            <td>1024</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>11</td>
            <td>10.35</td>
            <td>1.49</td>
            <td>-0.0093</td>
        </tr>
        <tr>
            <td>1</td>
            <td>1024</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>11</td>
            <td>10.63</td>
            <td>1.49</td>
            <td>-0.0080</td>
        </tr>
        <tr>
            <td>16</td>
            <td>2048</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>10</td>
            <td>10.18</td>
            <td>1.39</td>
            <td>-0.0084</td>
        </tr>
        <tr>
            <td>8</td>
            <td>2048</td>
            <td>100</td>
            <td>7</td>
            <td>13</td>
            <td>11</td>
            <td>10.28</td>
            <td>1.54</td>
            <td>-0.0081</td>
        </tr>
        <tr>
            <td>4</td>
            <td>2048</td>
            <td>100</td>
            <td>7</td>
            <td>14</td>
            <td>11</td>
            <td>10.56</td>
            <td>1.27</td>
            <td>-0.0059</td>
        </tr>
        <tr>
            <td>2</td>
            <td>2048</td>
            <td>100</td>
            <td>7</td>
            <td>14</td>
            <td>11</td>
            <td>10.54</td>
            <td>1.51</td>
            <td>-0.0063</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2048</td>
            <td>100</td>
            <td>7</td>
            <td>14</td>
            <td>11</td>
            <td>10.73</td>
            <td>1.40</td>
            <td>-0.0063</td>
        </tr>
    </tbody>
</table>

### Summary and сonclusions

The table presents the results of a test conducted on a personal area network (PAN) under varying frequencies and request sizes. Here's a summary of the findings:

- **Frequency (Hz)**: Ranged from 1 Hz to 16 Hz, indicating the rate at which requests were sent to the server.
- **Request Size**: Varied from 128 bytes to 2048 bytes, representing the size of each request sent.
- **Total Requests**: Consisted of 100 requests for each combination of frequency and request size.

#### Observations:

- **RTT Metrics**: 
  - **Min RTT (ms)**: Ranged from 5 ms to 7 ms, indicating the shortest round-trip time observed.
  - **Max RTT (ms)**: Spanned from 11 ms to 54 ms, representing the longest round-trip time observed.
  - **Median RTT (ms)**: Varied between 9 ms and 11 ms, reflecting the middle value of the round-trip time distribution.
  - **Avg RTT (ms)**: Ranged from 9.07 ms to 10.91 ms, representing the average round-trip time observed.
  - **STD RTT (ms)**: Showcased standard deviations ranging from 1.27 ms to 5.37 ms, indicating the spread of round-trip times around the mean.
  - **Skewness Ratio**: Spanned from -0.0111 to 0.0758, reflecting the symmetry or asymmetry of the round-trip time distribution.

#### Conclusions:

- **Impact of Frequency**: Higher frequencies generally resulted in shorter round-trip times, as evidenced by the decreasing trend in average and median RTT with increasing frequency.
- **Effect of Request Size**: Larger request sizes tended to lead to longer round-trip times, possibly due to increased processing overhead or network congestion.
- **RTT Distribution**: The skewness ratio provided insights into the shape of the RTT distribution, with values closer to zero indicating a more symmetric distribution.
- **Optimization Opportunities**: Based on the observed metrics, optimizations such as tuning the request size or adjusting the frequency can be explored to improve overall system performance and reduce latency.


## Results of the test on a wide area network (WAN on replit.com hosting).


<table id="results-table">
    <thead>
        <tr>
            <th>Freq (Hz)</th>
            <th>Request size</th>
            <th>Total Requests</th>
            <th>Min RTT (ms)</th>
            <th>Max RTT (ms)</th>
            <th>Med RTT (ms)</th>
            <th>Avg RTT (ms)</th>
            <th>STD RTT (ms)</th>
            <th>Skewness Ratio</th>
        </tr>
    </thead>
    <tbody>
        <!-- Results will be dynamically added here -->
        <tr>
            <td>16</td>
            <td>128</td>
            <td>100</td>
            <td>172</td>
            <td>483</td>
            <td>186</td>
            <td>198.96</td>
            <td>45.11</td>
            <td>0.0420</td>
        </tr>
        <tr>
            <td>8</td>
            <td>128</td>
            <td>100</td>
            <td>172</td>
            <td>260</td>
            <td>187</td>
            <td>189.39</td>
            <td>13.62</td>
            <td>0.0306</td>
        </tr>
        <tr>
            <td>4</td>
            <td>128</td>
            <td>100</td>
            <td>171</td>
            <td>231</td>
            <td>183</td>
            <td>183.98</td>
            <td>8.67</td>
            <td>0.0235</td>
        </tr>
        <tr>
            <td>2</td>
            <td>128</td>
            <td>100</td>
            <td>173</td>
            <td>210</td>
            <td>184</td>
            <td>184.71</td>
            <td>5.86</td>
            <td>0.0103</td>
        </tr>
        <tr>
            <td>1</td>
            <td>128</td>
            <td>100</td>
            <td>175</td>
            <td>265</td>
            <td>189.5</td>
            <td>192.30</td>
            <td>16.51</td>
            <td>0.0306</td>
        </tr>
        <tr>
            <td>16</td>
            <td>256</td>
            <td>100</td>
            <td>174</td>
            <td>583</td>
            <td>188.5</td>
            <td>244.32</td>
            <td>118.26</td>
            <td>0.0189</td>
        </tr>
        <tr>
            <td>8</td>
            <td>256</td>
            <td>100</td>
            <td>170</td>
            <td>220</td>
            <td>183</td>
            <td>184.06</td>
            <td>7.85</td>
            <td>0.0179</td>
        </tr>
        <tr>
            <td>4</td>
            <td>256</td>
            <td>100</td>
            <td>171</td>
            <td>225</td>
            <td>184</td>
            <td>183.98</td>
            <td>7.50</td>
            <td>0.0181</td>
        </tr>
        <tr>
            <td>2</td>
            <td>256</td>
            <td>100</td>
            <td>167</td>
            <td>283</td>
            <td>182</td>
            <td>183.95</td>
            <td>11.77</td>
            <td>0.0621</td>
        </tr>
        <tr>
            <td>1</td>
            <td>256</td>
            <td>100</td>
            <td>176</td>
            <td>373</td>
            <td>186</td>
            <td>189.35</td>
            <td>20.86</td>
            <td>0.0722</td>
        </tr>
        <tr>
            <td>16</td>
            <td>512</td>
            <td>100</td>
            <td>172</td>
            <td>637</td>
            <td>186</td>
            <td>236.01</td>
            <td>115.03</td>
            <td>0.0223</td>
        </tr>
        <tr>
            <td>8</td>
            <td>512</td>
            <td>100</td>
            <td>174</td>
            <td>216</td>
            <td>187</td>
            <td>186.60</td>
            <td>6.20</td>
            <td>0.0098</td>
        </tr>
        <tr>
            <td>4</td>
            <td>512</td>
            <td>100</td>
            <td>179</td>
            <td>394</td>
            <td>191</td>
            <td>195.27</td>
            <td>22.29</td>
            <td>0.0732</td>
        </tr>
        <tr>
            <td>2</td>
            <td>512</td>
            <td>100</td>
            <td>176</td>
            <td>268</td>
            <td>190</td>
            <td>193.33</td>
            <td>14.65</td>
            <td>0.0330</td>
        </tr>
        <tr>
            <td>1</td>
            <td>512</td>
            <td>100</td>
            <td>182</td>
            <td>264</td>
            <td>195</td>
            <td>197.72</td>
            <td>15.04</td>
            <td>0.0248</td>
        </tr>
        <tr>
            <td>16</td>
            <td>1024</td>
            <td>100</td>
            <td>167</td>
            <td>578</td>
            <td>184</td>
            <td>220.04</td>
            <td>100.91</td>
            <td>0.0284</td>
        </tr>
        <tr>
            <td>8</td>
            <td>1024</td>
            <td>100</td>
            <td>171</td>
            <td>201</td>
            <td>185</td>
            <td>184.29</td>
            <td>5.00</td>
            <td>0.0028</td>
        </tr>
        <tr>
            <td>4</td>
            <td>1024</td>
            <td>100</td>
            <td>169</td>
            <td>263</td>
            <td>183</td>
            <td>185.58</td>
            <td>15.83</td>
            <td>0.0359</td>
        </tr>
        <tr>
            <td>2</td>
            <td>1024</td>
            <td>100</td>
            <td>172</td>
            <td>208</td>
            <td>186</td>
            <td>187.34</td>
            <td>7.55</td>
            <td>0.0096</td>
        </tr>
        <tr>
            <td>1</td>
            <td>1024</td>
            <td>100</td>
            <td>171</td>
            <td>431</td>
            <td>187</td>
            <td>198.02</td>
            <td>42.29</td>
            <td>0.0430</td>
        </tr>
        <tr>
            <td>16</td>
            <td>2048</td>
            <td>100</td>
            <td>173</td>
            <td>653</td>
            <td>187</td>
            <td>226.31</td>
            <td>112.35</td>
            <td>0.0266</td>
        </tr>
        <tr>
            <td>8</td>
            <td>2048</td>
            <td>100</td>
            <td>178</td>
            <td>883</td>
            <td>188</td>
            <td>195.45</td>
            <td>69.80</td>
            <td>0.1005</td>
        </tr>
        <tr>
            <td>4</td>
            <td>2048</td>
            <td>100</td>
            <td>177</td>
            <td>246</td>
            <td>188</td>
            <td>189.84</td>
            <td>9.51</td>
            <td>0.0281</td>
        </tr>
        <tr>
            <td>2</td>
            <td>2048</td>
            <td>100</td>
            <td>177</td>
            <td>283</td>
            <td>188.5</td>
            <td>191.83</td>
            <td>15.51</td>
            <td>0.0370</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2048</td>
            <td>100</td>
            <td>173</td>
            <td>226</td>
            <td>187</td>
            <td>187.93</td>
            <td>8.48</td>
            <td>0.0124</td>
        </tr>
    </tbody>
</table>

### Summary and сonclusions

The table provides the results of a test conducted on a wide area network (WAN) hosted on replit.com, examining various frequencies and request sizes. Here's a summary and analysis of the findings:

- **Frequency (Hz)**: Ranged from 1 Hz to 16 Hz, indicating the rate at which requests were sent to the server.
- **Request Size**: Varied from 128 bytes to 2048 bytes, representing the size of each request sent.
- **Total Requests**: Consisted of 100 requests for each combination of frequency and request size.

#### Observations:

- **RTT Metrics**: 
  - **Min RTT (ms)**: Ranged from 167 ms to 182 ms, indicating the shortest round-trip time observed.
  - **Max RTT (ms)**: Spanned from 201 ms to 883 ms, representing the longest round-trip time observed.
  - **Median RTT (ms)**: Varied between 183 ms and 195 ms, reflecting the middle value of the round-trip time distribution.
  - **Avg RTT (ms)**: Ranged from 183.95 ms to 244.32 ms, representing the average round-trip time observed.
  - **STD RTT (ms)**: Showcased standard deviations ranging from 5.00 ms to 118.26 ms, indicating the spread of round-trip times around the mean.
  - **Skewness Ratio**: Spanned from 0.0028 to 0.1005, reflecting the symmetry or asymmetry of the round-trip time distribution.

#### Conclusions:

- **Impact of Frequency**: Higher frequencies generally resulted in shorter round-trip times, as evidenced by the decreasing trend in average and median RTT with increasing frequency.
- **Effect of Request Size**: Larger request sizes tended to lead to longer round-trip times, possibly due to increased processing overhead or network congestion, although the impact was less pronounced compared to the PAN.
- **RTT Distribution**: The skewness ratio provided insights into the shape of the RTT distribution, with values closer to zero indicating a more symmetric distribution. However, compared to the PAN, the WAN exhibited slightly higher skewness ratios, suggesting a more pronounced asymmetry in the distribution.
- **Optimization Opportunities**: Based on the observed metrics, optimizations such as fine-tuning the request size or adjusting the frequency can be explored to improve overall system performance and reduce latency, especially in the context of wide area networks where factors like network congestion and packet loss may have a more significant impact.

## Comparison of Results between Personal Area Network (PAN) and Wide Area Network (WAN)

#### Round-Trip Time (RTT) Metrics:

- **Minimum RTT (ms)**:
  - PAN: Ranged from 5 ms to 7 ms.
  - WAN: Ranged from 167 ms to 182 ms.
  - **Observation**: PAN generally exhibits significantly shorter minimum RTT compared to WAN.

- **Maximum RTT (ms)**:
  - PAN: Spanned from 11 ms to 54 ms.
  - WAN: Spanned from 201 ms to 883 ms.
  - **Observation**: WAN generally experiences higher maximum RTT compared to PAN.

- **Median RTT (ms)**:
  - PAN: Varied between 9 ms and 10.5 ms.
  - WAN: Varied between 183 ms and 195 ms.
  - **Observation**: PAN generally demonstrates shorter median RTT compared to WAN.

- **Average RTT (ms)**:
  - PAN: Ranged from 9.07 ms to 10.91 ms.
  - WAN: Ranged from 183.95 ms to 244.32 ms.
  - **Observation**: PAN generally yields lower average RTT compared to WAN.

- **Standard Deviation (STD) RTT (ms)**:
  - PAN: Ranged from 1.28 ms to 5.37 ms.
  - WAN: Ranged from 5.00 ms to 118.26 ms.
  - **Observation**: PAN generally exhibits lower variability in RTT compared to WAN.

- **Skewness Ratio**:
  - PAN: Ranged from -0.0111 to 0.0758.
  - WAN: Ranged from 0.0028 to 0.1005.
  - **Observation**: PAN generally demonstrates slightly lower skewness ratios compared to WAN, indicating a more symmetric distribution of RTT.

#### General Observations:

- **Impact of Network Type**: PAN typically offers lower latency and more consistent performance compared to WAN, as it operates within a smaller, more controlled environment.
- **Variability**: WAN experiences higher variability in RTT metrics, likely due to factors such as network congestion, packet loss, and longer physical distances between nodes.
- **Optimization Opportunities**: While PAN may require less optimization due to its inherently stable environment, WAN performance can benefit significantly from optimizations targeting network efficiency, congestion management, and protocol enhancements.


## Comparison of the obtained data with the data of the [system network utility ping](https://2ip.ua/ru/services/ip-service/ping-traceroute)

### Results of the ping commad:

```
[anonymous@2ip ~]$ ping -c 10 https://3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev/
PING 3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev (34.75.151.117): 56 data bytes
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=0 ttl=57 time=96.900 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=1 ttl=57 time=96.700 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=2 ttl=57 time=96.900 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=3 ttl=57 time=97.200 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=4 ttl=57 time=97.000 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=5 ttl=57 time=97.100 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=6 ttl=57 time=96.900 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=7 ttl=57 time=97.100 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=8 ttl=57 time=96.800 ms
64 bytes from 117.151.75.34.bc.googleusercontent (34.75.151.117): icmp_seq=9 ttl=57 time=97.000 ms
--- 3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 96.700/96.960/97.200/0.143 ms
```

Let's look at the locations of 2ip.ua and [replit](https://3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev)

<table class="table">
    <tbody>
        <tr>
            <td>Domain:</td>
            <td>2ip.ua</td>
            <td>3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev</td>
        </tr>
        <tr>
            <td>Country:</td>
            <td>Netherlands</td>
            <td>United States Of America</td>
        </tr>
        <tr>
            <td>Region:</td>
            <td>Noord-holland</td>
            <td>California</td>
        </tr>
        <tr>
            <td>City:</td>
            <td>Amsterdam</td>
            <td>Mountain View</td>
        </tr>
        <tr>
            <td>Latitude:</td>
            <td>52.37403</td>
            <td>37.405992</td>
        </tr>
        <tr>
            <td>Longitude:</td>
            <td>4.88969</td>
            <td>-122.078515</td>
    </tbody>
</table>

Distance between site 2ip.ua and [replit](https://3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev) is:

<table>
    <tbody>
        <tr>
            <td>Meters</td>
            <td>8793041.02</td>
        </tr>
        <tr>
            <td>Kilometers</td>
            <td>8793.04</td>
        </tr>
        <tr>
            <td>Miles</td>
            <td>5463.74</td>
        </tr>
    </tbody>
</table>

Ad now let's see at my current location and [replit](https://3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev):

<table class="table">
    <tbody>
        <tr>
            <td>Domain:</td>
            <td>78.26.151.209</td>
            <td>3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev</td>
        </tr>
        <tr>
            <td>Country:</td>
            <td>Ukraine</td>
            <td>United States Of America</td>
        </tr>
        <tr>
            <td>Region:</td>
            <td>Odeska Oblast</td>
            <td>California</td>
        </tr>
        <tr>
            <td>City:</td>
            <td>Odessa</td>
            <td>Mountain View</td>
        </tr>
        <tr>
            <td>Latitude:</td>
            <td>46.477274</td>
            <td>37.405992</td>
        </tr>
        <tr>
            <td>Longitude:</td>
            <td>30.732597</td>
            <td>-122.078515</td>
    </tbody>
</table>

Distance between me and [replit](https://3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev) is:


<table class="table table-striped">
    <tbody>
        <tr>
            <td>Meters</td>
            <td>10301421.39</td>
        </tr>
        <tr>
            <td>Kilometers</td>
            <td>10301.42</td>
        </tr>
        <tr>
            <td>Miles</td>
            <td>6401.01</td>
        </tr>
    </tbody>
</table>



```
natanius@od-mobile-136:~$ ping -c 10 3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev
PING 3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev (34.75.151.117) 56(84) bytes of data.
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=1 ttl=105 time=138 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=2 ttl=105 time=137 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=3 ttl=105 time=138 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=4 ttl=105 time=140 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=5 ttl=105 time=138 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=6 ttl=105 time=137 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=7 ttl=105 time=137 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=8 ttl=105 time=140 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=9 ttl=105 time=137 ms
64 bytes from 117.151.75.34.bc.googleusercontent.com (34.75.151.117): icmp_seq=10 ttl=105 time=137 ms

--- 3eb92c6b-e84c-4e44-9407-35dce7c43ad4-00-2607akwr7pdd6.worf.replit.dev ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9019ms
rtt min/avg/max/mdev = 136.538/137.910/140.316/1.154 ms
```



## Speed of the signal

The speed of the signal is determined by the speed of light in the medium through which the signal is being transmitted. The speed of light in a vacuum is approximately 299,792,458 meters per second (m/s). However, in most cases, signals are transmitted through cables or other mediums, which have a lower speed of light.

In the case of a digital signal being transmitted over a coaxial cable, the speed of the signal is approximately 2/3 the speed of light in the medium (coaxial cable). This is because the signal is transmitted as an electromagnetic wave, and the wave travels at 2/3 the speed of light in the medium.

For example, if the signal is being transmitted over a coaxial cable, the speed of the signal would be approximately $\frac{2}{3} \times 299,792,458 \, \text{m/s} = 199,854,742.67 \, \text{m/s} = 199 \, \text{km/ms}$. 
However, the actual speed of the signal may vary depending on the specific medium and signal type.

With this speed, a signal would cover a distance of 199 km in 1 millisecond. Therefore, in 96 milliseconds, the signal would travel a distance of $96 \, \text{ms} \times 199 \, \text{km/ms} = 19,104 \, \text{km}$
and in 137 milliseconds the signal would travel a distance of $137 \, \text{ms} \times 199 \, \text{km/ms} = 27,263 \, \text{km}$

## Conclusions

So, an RTT of 96 ms indicates that the signal has traveled approximately 19,104 kilometers round trip between the source and the destination. This means the distance between servers is twice smaller: 9552 km.

Pretty accurate if we compare it with the data from 2ip.ua (8793 km).

In case of local ping to repl.it the distance is 27,263/2=13631.5

According to the data from 2ip.ua the distance between me and server repl.it(10301.42 km).

The speed of a signal in a local network looks very slow, it can be due to several reasons, such as network congestion, low-quality cables, or outdated network devices. However, in the context of this work, it seems that the delay is specifically related to signal processing on the server.

There are several possible reasons for delay in signal processing on the server:

* Inefficient code: If the code that processes the signal is not optimized, it may take longer to execute, leading to delays (for example POST method delays).
* Hardware limitations: If the server's hardware is not powerful enough to handle the processing demands, it may cause delays.
* Network issues: Even though the network itself may not be the cause of the delay, network issues between the client and the server can still cause delays in signal processing.
* Software bugs: Software bugs in the server software or the code that processes the signal can cause delays or even prevent the signal from being processed altogether.