{"id":2442,"date":"2022-08-30T15:24:54","date_gmt":"2022-08-30T15:24:54","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/12\/script-to-open-a-webpage-many-times-to-test-a-server-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:24:54","modified_gmt":"2022-08-30T15:24:54","slug":"script-to-open-a-webpage-many-times-to-test-a-server-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/script-to-open-a-webpage-many-times-to-test-a-server-collection-of-common-programming-errors\/","title":{"rendered":"Script to open a webpage many times to test a server-Collection of common programming errors"},"content":{"rendered":"<p>If you are running an Apache server you could use the Apache benchmark command-line tool.<\/p>\n<p>So let&#8217;s say for this instance that your server is running on localhost(127.0.0.1), port 8000. If we want to know whether the concurrent connections can be handled by the server we&#8217;d have to have a script that executes for a set amount of (mili)seconds and take the average of that.<\/p>\n<p>So let&#8217;s create a JavaScript function for your server that does a 1 second timeout like this:<\/p>\n<pre><code>setTimeout(function() {\nconsole.log(\"Executed\")\n}, 1000)\n<\/code><\/pre>\n<p>With the Apache command-line tools installed run the following command<\/p>\n<blockquote>\n<p>ab -n 100 -c 100 http:\/\/127.0.0.1:8000<\/p>\n<\/blockquote>\n<p>If all goes well you should see the average time it has taken to execute a single script. The results should be somewhere between 1 and 1.1 seconds.<\/p>\n<p>I would assume that you are using NodeJS? If not I would definitely recommend looking into it. Mostly because of it&#8217;s non-blocking awesomeness.<\/p>\n<p id=\"rop\"><small>Originally posted 2014-01-12 20:47:59. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>If you are running an Apache server you could use the Apache benchmark command-line tool. So let&#8217;s say for this instance that your server is running on localhost(127.0.0.1), port 8000. If we want to know whether the concurrent connections can be handled by the server we&#8217;d have to have a script that executes for a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2442","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2442"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2442\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}