Jump to content

Site Sooooooooo Slow


unplugged_web

Recommended Posts

I've got a website that is so slow to load in IE. It didn't use to be this bad but now it can take 3-4 minutes to load. The site is hosted on a dedicated server with one other site which works perfectly. I've been through the error log and there doesn't seem to be anything which is causing the site to be so slow so I'm not sure what to do about it.I'd be grateful if anybody could offer any suggestionsThanks

Link to comment
Share on other sites

That site is sending a rediculous amount of AJAX requests, it's probably sending 10-15 per second that I can see with Firebug. Many of the requests are taking around 30 seconds to complete. IE will only open 2 requests at once, so every second you're queueing up all these requests where IE is only handling them 2 at a time. You're sending requests to countdown.php, cashback1.php, cashback2.php, makezero.php, bid_amountC.php, bid_history.php, and user_bid.php several times per second. In the last 5 or so minutes I've had the site open, Firebug has logged over 2400 AJAX requests.So that's the reason why it's slow in IE. Javascript performance in IE already blows, but when you clobber it with AJAX requests that take several seconds to finish it's just going to get bogged down and sit there using up all the CPU time.

Link to comment
Share on other sites

That site is sending a rediculous amount of AJAX requests, it's probably sending 10-15 per second that I can see with Firebug. Many of the requests are taking around 30 seconds to complete. IE will only open 2 requests at once, so every second you're queueing up all these requests where IE is only handling them 2 at a time. You're sending requests to countdown.php, cashback1.php, cashback2.php, makezero.php, bid_amountC.php, bid_history.php, and user_bid.php several times per second. In the last 5 or so minutes I've had the site open, Firebug has logged over 2400 AJAX requests.So that's the reason why it's slow in IE. Javascript performance in IE already blows, but when you clobber it with AJAX requests that take several seconds to finish it's just going to get bogged down and sit there using up all the CPU time.
Thank you, I didn't realise that about js and ie. I'll have a better look at what's needed with the site.Thanks
Link to comment
Share on other sites

The thought also hit me that you should probably make sure the AJAX requests only start after the page is loaded, so use an onload event handler to start everything. If IE (or anything else, really) is trying to send the AJAX requests and also send the requests for images, CSS, etc for the actual site, it's going to appear to load really slowly because it's waiting on the AJAX requests to finish before it can get the other resources. So getting the Javascript to start on page load would at least allow IE to download all of the resources before it starts with the AJAX stuff.

Link to comment
Share on other sites

The thought also hit me that you should probably make sure the AJAX requests only start after the page is loaded, so use an onload event handler to start everything. If IE (or anything else, really) is trying to send the AJAX requests and also send the requests for images, CSS, etc for the actual site, it's going to appear to load really slowly because it's waiting on the AJAX requests to finish before it can get the other resources. So getting the Javascript to start on page load would at least allow IE to download all of the resources before it starts with the AJAX stuff.
I've done that now and it's so much quicker. Thank you
Link to comment
Share on other sites

Is you site run by database?If so, index any columns your joining....especially if they are text or blog sizeEdit: The site is still taking over 7 minuets to load the index page....thats crazy bad!! Add some caching to .htaccess for your images and javascripts as well this will also dramatically increase your speed

<FilesMatch "\.(js|css)$">Header set Cache-Control "max-age=604800, private, proxy-revalidate"</FilesMatch><FilesMatch "\.(jpg|jpeg|js|gif|ico)$">Header set Cache-Control "max-age=604800, public"</FilesMatch>

Link to comment
Share on other sites

Is you site run by database?If so, index any columns your joining....especially if they are text or blog sizeEdit: The site is still taking over 7 minuets to load the index page....thats crazy bad!! Add some caching to .htaccess for your images and javascripts as well this will also dramatically increase your speed
<FilesMatch "\.(js|css)$">Header set Cache-Control "max-age=604800, private, proxy-revalidate"</FilesMatch><FilesMatch "\.(jpg|jpeg|js|gif|ico)$">Header set Cache-Control "max-age=604800, public"</FilesMatch>

Thanks. That sounds like I good idea. How do I do that? I don't have an .htaccess file
Link to comment
Share on other sites

Thanks. That sounds like I good idea. How do I do that? I don't have an .htaccess file
Just create a blank file with notepad and name it .htaccess then upload it to your root directory:http://www.site.com/.htaccessYou wont be accessing this file directly in your browser just edit it in notepad and ftp it to your serverThis will only help when all files/images have been loaded into the browser at east once, by storing the images and javascript within the users browser it wont make the same request againIm betting your problem lies within your databaseLet me know what size your columns are example :varchar, text, or blogI bet indexing your columns will make your page load within 1 second or lessI have a massive amount of images and javascript on my index page and it takes 0.33 seconds to load...
Link to comment
Share on other sites

Just create a blank file with notepad and name it .htaccess then upload it to your root directory:http://www.site.com/.htaccessYou wont be accessing this file directly in your browser just edit it in notepad and ftp it to your serverThis will only help when all files/images have been loaded into the browser at east once, by storing the images and javascript within the users browser it wont make the same request againIm betting your problem lies within your databaseLet me know what size your columns are example :varchar, text, or blogI bet indexing your columns will make your page load within 1 second or lessI have a massive amount of images and javascript on my index page and it takes 0.33 seconds to load...
This is everything the database consists of, including the limit for different colums. I don't know if this helps, but hope it does.Thanksbigint(100) (20)varchar(100) (5) (30) (150) (50) (25) (200) (20) (8) (255) (16) (11) (75) (250) (70) (35) (15)textenumdatetime / date / timestamp / timetinint(4) (10)decimal(10,2) (30,2) (11,2)float(6,2)int(5) (3) (10) (11) (6)longtextdoublesmallint(6)char(2)
Link to comment
Share on other sites

This is everything the database consists of, including the limit for different colums. I don't know if this helps, but hope it does.Thanksbigint(100) (20)varchar(100) (5) (30) (150) (50) (25) (200) (20) (8) (255) (16) (11) (75) (250) (70) (35) (15)textenumdatetime / date / timestamp / timetinint(4) (10)decimal(10,2) (30,2) (11,2)float(6,2)int(5) (3) (10) (11) (6)longtextdoublesmallint(6)char(2)
You shouldnt have problems with this layoutYoull need to create an index on columns your consistently using
CREATE INDEX index_nameON table_name (column_name)

Link to comment
Share on other sites

Not this has anything to do with speed, but you're also going to want to rewrite the HTML so that it at least makes sense. This is the start of your index page:

<body topmargin="0" leftmargin="0" rightmargin="0"><META name="description" content="iTechBids v8.0 Gold - The best auction software coded in php/mysql. iTechBids v8.0 Gold is 100% secured. No vulnerability detected."><meta name="keywords" content="auction script software package ITechBids "><META NAME="keyphrases" content="itechbids.com, itechscripts.com, biding script, auction script, auction software, auction business, professional auction script, php auction script, php auction software, free auction demo, cheap auction script,"><META NAME="robots" content="index,follow"><META NAME="AUTHOR" CONTENT="ITechBids Auction Script Software"><META NAME="GOOGLEBOT" CONTENT="INDEX, FOLLOW"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head><body bgcolor="#FFFFFF" topmargin="0"><table width="980" border="0" cellpadding="0" cellspacing="0" align="center">  <tr>	<td valign="top">	<html><head><title>SoMuchCheaper</title><META Http-Equiv="Cache-Control" Content="no-cache"><META Http-Equiv="Pragma" Content="no-cache"><META Http-Equiv="Expires" Content="0"><link rel="stylesheet" type="text/css" href="templates/Default/cssfiles/theme1.css"><link rel="stylesheet" type="text/css" href="templates/Default/cssfiles/theme.css"><link rel="shortcut icon" href="templates/Default/img_files/favicon.ico"><script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/core.js"></script><script type="text/javascript" src="js/highlight.js"></script><script type="text/javascript" src="js/countdown.js"></script></head>	<div id="main">

Database indexing may help, but you're still clobbering the browser with AJAX requests every second. I'm seeing a lot of requests take over a second to finish, so if you send every second it's going to get backed up. You should edit the GetCount function to increase the timeout between request. Bump it up to at least 2 seconds.

function GetCount(auctionid,atype){ GetCo(auctionid,atype); refreshID=setInterval("GetCo('"+auctionid+"','"+atype+"')",1000);}

You're also still not starting the AJAX on page load, you just have a timeout to run it after 20 seconds. If the browser takes longer than 20 seconds to download all of the images and scripts and CSS, then you're going to see the browser get hung up again once the AJAX starts and it's got all these requests queued. You should really kick everything off on page load.Also, the GetBid function sends requests to 5 different pages:

function GetBid(idname){$.get("bid_amountC.php", {id:+ idname}, function(data){$('#Amt'+idname).html(data); });$.get("user_bid.php", {id:+ idname}, function(data){$('#Usr'+idname).html(data); });$.get("cashback1.php", {id:+ idname}, function(data){$('#csh'+idname).html(data); });$.get("cashback2.php", {id:+ idname}, function(data){$('#cshh'+idname).html(data); });$.post("bid_history.php", {id:+ idname},function(data){$('#His'+idname).html(data);});$('#Amt'+idname).effect("highlight", {}, 2000);}

It would be a major improvement if you could get that to send only a single request to a single page, and have that one page get all the data needed. Each time you send a request to the server there is a certain amount of overhead involved with starting the connection, in addition to the limit of open connections imposed by the browser. If you could turn those 5 requests into 1 request that would probably speed things up more than anything else. In the time it's taken me to write this, your site has racked up almost 8000 requests.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...