To download a web page and its resources, modern browsers create several connections to the web server. The connections are used behind the scenes, and, typically, users do not know about them. However, they are important from the point of view of traffic recording and simulation. This topic provides information on connections and describes how LoadComplete works with them.
To download a web page and its resources like images, style sheets, scripts, and other files, browsers typically use several connections to the web server. Multiple connections work in parallel making the download faster. Requests within a connection are executed in series (see the image below).
Establishing a connection requires time. So, browsers do not close them after downloading a page. Quite often, they keep connections live and use them for subsequent downloads:
Why Information on Connections Is Important
During the scenario recording, LoadComplete records information on the connections your browser creates. It uses this information to organize requests among connections appropriately during the scenario playback. If LoadComplete simulated all requests within the same connection, the simulated traffic would much differ from the actual traffic a browser produces. Also, having connection items in a scenario, LoadComplete can simulate the connection creation time appropriately. In other words, by simulating connections, LoadComplete makes the simulated sequence of request very close to the real-life traffic.
How LoadComplete Handles Connections
Typically, browsers do not close connections after downloading a page. They keep them alive and use for subsequent downloads. However, if you look at the recorded traffic in the Scenario editor, you will notice that each Page node has its own Connection subnodes (the connections’ indexes – 0001, 0002, 0003 – do not repeat). This is done by design for future purposes. To indicate that the Connection node corresponds to the same real connection that already exists by the moment of simulation, LoadComplete uses a special icon (). The operation properties specify the Connection operation that corresponds to the real connection:
As you can see in the image above,
Connection 0003 corresponds to the same real connection, to which
Connection 0001 corresponds (the editor says the
Connection 0002 is linked to
Unlike browsers, LoadComplete closes connections when it stops traffic recording. As a result, the browser you used for traffic recording may behave incorrectly. To avoid this, we recommend closing the browser before stopping recording.
If the “base” connection (the initial connection that was opened earlier in the scenario, and to which other connections are linked) is closed due to an error during traffic simulation, LoadComplete will reopen it to simulate requests in all the connections linked to it.
When Do You Need to Link Connections?
You link connections when you need requests to be simulated in some existing connection. Alternatively, if you need some requests to be simulated in a new connection, you can unlink it and specify the needed parameters.
Though the editor provides the possibility of linking and unlinking connections, we would recommend that you use the recorded connection settings. This will make the simulated traffic closer to real traffic.
If you link some connection to another connection, then select a connection that was created earlier than the connection you are editing.