Reduce Server Response Time

Hi,

This is my website:
AdSpot.lk

There are “some” pages of my site, which takes too long to load (high server response time). For eg, please take a look at this one:
https://developers.google.com/speed/pagespeed/insights/?url=adspot.lk%2Fall-ads

This is also noticeable if you view this page from the browser.

Weird thing is there are some pages that loads fast. For eg:
https://developers.google.com/speed/pagespeed/insights/?url=adspot.lk

I already did my best to fix other issues (minifying JS and CSS, leverage browser caching, eliminating render blocking JSS and CSS).
As doing those didn’t fix the problem, obviously there is something beyond my current knowledge.

Can you guys please let me know what could be the possible reason/s for this?
One person mentioned this is hosting issue and changing the host should fix it. But I don’t think that’s true because if it was a hosting issue, then ALL my pages should be slow. What do you think?

Thanks

The source of your site “http://adspot.lk” shows there are numerous JavaScript files and source yhat is loaded in the header. Why have you not observed the recommendations to move all these files and script to just above </body>

There are 04 render blocking JS files now for index. I tried moving them to footer, but when I did that, it broke some of the functions of my site. Besides even they are in the header, I managed to get 91 score for that page.

Problem is in some pages including All Ads page, “Server Response Time” is high.
I was wondering if you guys can help me understand what may be the problem.
I will focus on other issues later.

Thanks

They will be significantly slowing the loading of your page. The score is irrelevant if the page is loading noticeably slowly.

They shouldn’t break if moved to just before the </body> tag provided you list them in the right order. If they do then you have a serious problem with how the scripts are written.

Anyway that move is the simplest way to speed up the loading of the page and so is the first thing to do. If it still loads too slowly after that then you would consider more complicated changes at that point.

1 Like

I tried moving those JS to footer. Still didn’t fix the server response time. Thanks

Can you supply a test-page with the JavaScript moved to just above </body> and also let us know what is not working and what you are expecting.

I used this code to do it. Just inserted at the end of theme’s functions.php

// Custom Scripting to Move JavaScript from the Head to the Footer

function remove_head_scripts() {
remove_action(‘wp_head’, ‘wp_print_scripts’);
remove_action(‘wp_head’, ‘wp_print_head_scripts’, 9);
remove_action(‘wp_head’, ‘wp_enqueue_scripts’, 1);

add_action(‘wp_footer’, ‘wp_print_scripts’, 5);
add_action(‘wp_footer’, ‘wp_enqueue_scripts’, 5);
add_action(‘wp_footer’, ‘wp_print_head_scripts’, 5);
}
add_action( ‘wp_enqueue_scripts’, ‘remove_head_scripts’ );

// END Custom Scripting to Move JavaScript

When I do that, when posting an ad, category selection drop downs and image uploading buttons aren’t working. I noticed these two errors only.
If I keep jquery and jqurery.migrate files on top, they work OK.

Thanks

It looks like you are using WordPress which I have no knowledge.

Perhaps this topic would be better in the CMS & WordPress Forum.

That code means they are added to the head first then removed and added to the bottom of the body instead.

You need to NOT add any scripts in the head in the first place.

Moving JavaScript files around is counter productive since the location of JavaScript files has no bearing on server response time. High server response time would be the result of something at the server level not client. Thought you might want to know that because the suggestions so far provide no help in terms of you’re initial problem. Everything so far is just a bunch of unhelpful “elistest” views containing no substance in terms of lowering SERVER response time.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.