Is it necessary to overlook Java Script when conducting load testing on my website?

We are in the process of developing a robust web application that needs to be able to handle a significant amount of traffic. I have been conducting load tests on a HP (Proliant DL 380) server with two 3.6GHz Xeon CPUs and 16GB of RAM. To perform these tests, I have been using Apache JMeter and Pylot, both of which have been providing similar results.

During one test scenario, I set up the load testing program to continuously hit my index page with just one thread. The index page is approximately 60KB in size and includes 10 ajax calls, a lot of JavaScript and jQuery code, necessary CSS, and more. Unfortunately, the results were not very promising.

Here are the results for the full index.jsp page:

  • Throughput (req/sec): 3.567
  • Response Time (secs): 0.278

I then decided to remove all ajax calls, charts, and CSS, but kept the JavaScript code.

  • Throughput (req/sec): 6.082
  • Response Time (secs): 0.161

Despite these changes, the performance was still low. I created a static index page in HTML format with the same content size, but without any server-side or client-side computation.

  • Throughput (req/sec): 20.787
  • Response Time (secs): 0.046

It was a significant improvement. I then added some JavaScript code back to the index.html page.

  • Throughput (req/sec): 9.617
  • Response Time (secs): 0.103

It seems that the bottleneck lies in the JavaScript code. I need to determine how many requests per second the server can handle without including JavaScript in the test, as it runs client-side. Should load testing tools be processing JavaScript code? (It appears they may be doing so).

Another crucial question is whether the current throughput is acceptable given the hardware, content size, and configurations mentioned. My target is 500 req/sec. Is the only solution to add more hardware?

For reference, the web application is built using Java, Struts2, JSP, Hibernate, and MySQL. It is also distributed across multiple servers using haproxy, but these tests were conducted on a single server.

Answer №1

When it comes to measuring the speed at which a server delivers content, focusing solely on the raw number is key. This means disregarding java-script and concentrating on the overall time it takes to transfer all components of a page, such as HTML, images, script files, and CSS.

However, if your goal is to evaluate user experience, JavaScript plays a significant role in that aspect. In this case, it is essential to factor in JS when conducting tests. Based on your requirements, it seems you are more concerned with server load than user experience.

One approach to consider is setting up JMeter to directly assess different elements of your pages, following the suggestion mentioned earlier.

Answer №2

Do you have your JavaScript, CSS, and images directly embedded in your webpage, or are they being loaded from a script tag? Embedding them will cause the browser to download the files from your server, significantly slowing down your pages. This is why it's recommended to load libraries like jQuery from a different server (such as Google) - it may slightly impact the user's perceived page load time (due to an extra DNS query), but it will greatly reduce the strain on your server.

Answer №3

One crucial question that comes to mind is whether, based on the hardware, content size, and specified configurations, the current level of throughput is realistic. Shouldn't we be aiming for a higher rate, around 500 requests per second? Is increasing hardware the only solution to achieve this goal?

Developing your application in a way that allows for caching of pages and then implementing an http-proxy in front of your application can be a beneficial strategy.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Prefer using Android bulk insertion or updating over insertOrReplace

My Challenge: Currently, I am developing an Android application that utilizes SQLite to fetch and store data from a server. The process involves receiving a list from the server, iterating over it, and individually inserting each record into the DB. Howev ...

Troubleshooting Java JSON Parsing

I am struggling with this code: public void villageData() throws JSONException{ HashMap<String, Object> villageData = new HashMap<String, Object>(); villageData.put("newShopTraps", obj.get("newShopTraps")); villageData. ...

PHP script for batch string replacement

My function is triggered by a button click, where it takes two input IDs and forms a string as follows: var str = "headingText=" + $("#headingText").val() + "&centerText=" + $("#centerText").val(); $.ajax({ url: "indexpdf.php", data: str, ...

Having difficulty linking the Jquery Deferred object with the Jquery 1.9.1 promise

I have been developing a framework that can add validation logic at runtime. This logic can include synchronous, asynchronous, Ajax calls, and timeouts. Below is the JavaScript code snippet: var Module = { Igniter: function (sender) { var getI ...

I noticed a change in the state between dispatches, but I did not make any alterations to the state

Although this question has been previously raised, most of the discussions focus on the OP directly mutating the state. I have taken precautions to avoid this by using techniques like the spread operator with objects and arrays. However, despite these effo ...

Display the hidden element using jQuery with the !important rule

There is a specific element that has been given a class with the following CSS styling: .cls { display:none !important; } Despite attempting to display this element using jQuery $(".cls").show(); This method does not seem to be effective. Is ...

Tips for creating an illustration in Vue.js

As I attempt to create an image using canvas, my browser throws this error at me: Uncaught TypeError: Cannot read property 'drawImage' of undefined at Image.img.onload (test.js:23) To troubleshoot, I added some console.log() messages and here ...

Angular app sends a JSON request and receives no data in response

It seems like Angular may be loading the page before fully receiving all the information from JSONP. There are times when refreshing the page multiple times eventually displays the information, but it's not consistent. Interestingly, the code used on ...

When accessing the innerHTML and outerHTML properties on an HTMLElement, they may return undefined without triggering

Task: My goal is to take an HTML string, make changes to certain attributes of image tags within it, and then return the modified HTML string. The function I have developed follows these steps: private resolveImagesInHTML (body: string): string { le ...

Sorting the array in MongoDB before slicing it

Currently, I have a pipeline that aggregates Regions along with their respective countries and sales values. My goal is to obtain the top 5 countries by sales in each region using the $slice method. However, the issue I am facing is that it returns the fir ...

Tips for retrieving user input and displaying it on an HTML page

I have encountered an issue with displaying user input in a table. The code for the table display is as follows: <tr ng-repeat="user in users" ng-class-even="'bg-light-grey'" ng-if="isLoading==false"> <td> ...

What is the best way to retrieve specific items using the Chosen JQuery plugin?

I have a multiple select box set up with chosen, but I am unsure how to retrieve the selected items. <select class="multiselect" multiple="" name="parlementId"> @foreach (Politicus p in politici) { <optio ...

Tips for resolving issues with async-await functions when utilizing Axios

I am trying to implement axios using the async await function in my code. However, I encountered an error when attempting to use async await. useEffect(async() => { await axios .get("https://cryptic-inlet-27003.herokuapp.com/products?size=6" ...

What is the best way to implement lazy loading of images that have not been downloaded in a JavaFX WebView?

Currently, I am in the process of developing an email client application using JavaFX WebView to showcase email HTML files. In order to enhance its responsiveness and speed, my goal is to display inline images in emails as they are downloaded locally. Duri ...

Utilizing the PhoneStateListener to enable speaker mode

I have implemented a PhoneStateListener in my app so that the speaker is automatically turned on when the user receives or initiates a call. PhoneStateListener phoneStateListener = new PhoneStateListener() { @Override public void o ...

Is there a way to execute selenium scripts on a virtual machine without relying on Selenium Grid?

I am able to run my script on a local machine, but now I need to run a Selenium script from my local machine to a Virtual Machine. I have already tried using Selenium Grid and Jenkins, but unfortunately our system has certain restrictions. Are there any ...

How can we trigger a function once an ajax request has finished, without directly interacting with the ajax

I am facing a challenge where I need to trigger a JS function after an ajax call is completed, specifically when filtering posts in WordPress. The issue lies in the fact that the ajax filter tool in use is part of a WordPress plugin that cannot be modified ...

Using javascript, what is the best way to clear a text field with a specific condition?

When I clear the text field #t1, I expect text field #d1 to also clear. However, the last two lines of code do not achieve this result. function utl() { var tField = document.getElementById('t1'); var dField = document.getElementById(&a ...

Having trouble connecting to my MongoDB container using Node.js

I am facing an issue while trying to connect my local mongoDB docker, named "some-mongo", to my NodeJS backend server running on the same computer. The problem arises when attempting to establish the connection using the "mongoose" module. To launch my mo ...

Guide on executing a jar file using JavaScript and obtaining a JSON output

Is there a way to execute and capture the output of a jar file that returns a json using javascript? ...