Apologies if this is the wrong place to ask.

For my experiment, I have a single-page application and a multi-page application. I am testing them with an exponential distributed delay throttling. The idea is that individual chunks are delayed by a random number sampled from an exponential distribution. So, when a HTTP/GET request comes in, it gets split into 200 byte chunks and each chunk is delayed. Basically each request for a resource e.g. HTML/CSS/JS is a sum of exponential distributed delays.

Now, when I did a test of a 100 page loads and got the mean.

My question is why is the SPA vs MPA without delay, SPA is around 4 times faster but then SPA vs MPA with delay is only 2 times faster?

No delay: enter image description here

With delay: enter image description here

Edit: The mean exponential parameter is 1 (second). The multi-page app total size transferred is significantly smaller (58KB), than single-page app (267KB) which due to the JavaScript framework, so it is expected to load faster. SPA also has more files to download, therefore more round-trips.

To do a simulation:

  1. User visits a website from his browser, he makes a HTTP request for the root HTML first, which makes subsequent requests for style sheets and scripts to load the page.

  2. Taking the first request for the root HTML, (for specific details) this TCP stream is fed into a SOCKS server before going out to the web server. The stream takes 200 byte chunks at a time and delays it, (and without blocking) keeps taking another chunk and delays it. It also checks if any previous chunk will overlap, if so it will send it out the same time.

  3. The web server gets the delayed request and sends a reply back (in this case the HTML file) to the SOCKS server, where it will delay it again.

At step 2, say we have a 1000 byte stream, it will take 200 byte and delay it in the background, take another 200 byte and delay that in the background too, and keep doing it. Meanwhile it will check overlaps, so if the first chunk has a delay (plus current time) that is greater than the delay (plus current time) of the second, meaning the second will get sent first. We want to delay the second chunk the same time, so it gets sent in order.

I hope that makes sense. Please let me know if it doesn't.

  • 2
    $\begingroup$ Can you describe your experiments in such a way that even someone with no knowledge of networking can understand them? $\endgroup$ Aug 7, 2017 at 18:45
  • $\begingroup$ When you say "with delay", how much delay is added? You say the delay is exponentially distributed but don't provide the parameters of the distribution. Also, how much data is downloaded by each application? Do they both download the same number of 200 byte chunks? $\endgroup$
    – D.W.
    Aug 7, 2017 at 21:55

1 Answer 1


The time to load a web application is a sum of multiple factors, including at least:

  • The round-trip latency to initiate a TCP connection to the server (or maybe multiple connections, depending on your application and your browser) -- also called RTT time.

  • The time to download all of the page and content that it causes to be downloaded.

The second factor depends on the amount of delay you're adding; the first doesn't. Also, the multi-page application might cause more TCP connections, causing more of the first type of delay; but it downloads less data, so less of the second delay.

So there's no reason to expect things to scale as simply as you are expecting. Instead, the resulting performance will be a more complicated function of page size, RTT time, and delay.

Heuristically, we can expect a RTT time of a few hundred milliseconds per TCP connection, though that will depend on how far the client is from the server. You say there's an average delay of 1 second per 200 bytes downloaded, so for the single-page application, you expect 267KB / 200bytes = 1367 seconds of delay added, on average, due to your artificial delays; for the multi-page application, you expect 58KB / 200bytes = 297 seconds of delay added, on average. Without the artificial delays, the time to download that much data might depend on the speed of your network.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.