I've got a web service that the clients use by placing an exterior JavaScript (located on my small servers). Lately, because of server outage - the exterior JavaScript grew to become not available and my customers' websites found a crawl as browser did not load relaxation from the website until it loaded the JS (it is going into header from the websites).

I'm working out techniques to ensure that customers' website don't decelerate even when my server goes lower and for your I needed to simulate an ailment in which the my server is not reacting. Observe that basically specify an incorrect URL, browser will not load the JS but just in case URL is appropriate and server is not reacting, browser will stall loading relaxation from the page. I wish to simulate the final situation. Any ideas how do i do it?

PS: On server side, I'm while using Light stack.

Produce a script that sleeps for any configurably very long time

Something similar to

<?php
$how_long = $_GET['seconds'];
sleep($how_long);
echo "alert('Finished sleeping!');";
?>

Then you definitely just access this script rather, for instance by putting this inside your Html page <script src="http://example.com/hang_for.php?seconds=3600" />. That will sleep to have an hour. You will see another timeouts that'll trigger first set up in php.ini, but that is exactly what you would like to check, no?

When the "P" inside your Light is PHP, you could utilize the sleep function (recorded here). Then, have your test page load your PHP script because the supply of your Javascript to determine what goes on.

Unplug the server. Getting no energy constitutes a server unresponsive...

Have you try looping back the server into itself (or other HTTP server w/o the webservice on)?

unplugging is fairly drastic, the off-button must do.