10 Replies - 1055 Views - Last Post: 06 October 2014 - 03:26 PM

#1 chris98  Icon User is offline

  • D.I.C Lover

Reputation: 40
  • View blog
  • Posts: 1,100
  • Joined: 06-July 13

How slow is my site?

Posted 02 October 2014 - 11:01 AM

I've been trying more and more to optimise my site, especially since the last speed issue with my host basically made it exceptionally slow. And I've ben using tools such as gtmetrix. But recently it's started saying that my site is loading extremely slow (over 8 seconds in most cases) whereas it's loading fine for me.

I've created a test page that loads the page a slightly different way that appears to be quicker on my computer, but I'm not sure as it still states by places such as gtmetrix that it's slow. But I'm not even sure if it is slow now - and if it is, whether it's a server issue or my site.

How quickly do they load for you?

Original: http://bit.ly/1pxvDzC

New: http://bit.ly/1lMYSbl

This post has been edited by chris98: 03 October 2014 - 08:30 AM


Is This A Good Question/Topic? 0
  • +

Replies To: How slow is my site?

#2 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1864
  • View blog
  • Posts: 5,829
  • Joined: 15-January 14

Re: How slow is my site?

Posted 02 October 2014 - 11:35 AM

According to Chrome, with cache disabled:

The original link has 47 requests, 2.2MB total, and loaded in 5.29 seconds.

The new link has 44 requests, 2.1MB total, and loaded in 7.37 seconds.

If I refresh the second link generally takes about 2 seconds longer to load. I'm not sure how you managed to increase the load time by reducing the number of requests and total size, but you did. If you want to decrease the load time then reduce the number of requests and the total size required to load the page. You have 6 Javascript files, for example, you could combine all of that code into one file. Your server also isn't using compression, if you were using something like gzip compression on the server then you could reduce the transfer size (and time) of text files by around 75% or so. The vast majority of your size is with images though. Some things you could do to reduce the number of requests required for images would be to use sprites instead of individual images. You could put all 8 flags in one image, for example, and use CSS to choose which part of that image to show for each button or whatever. That means you only need to transfer 1 image for all flags instead of 8 images, that means less transfer overhead and faster loading. It takes much less time to download 1 file that is 1MB versus 100 files that are 10KB each. You could do the same for the various border, divider, arrow, etc images, you could make those sprites also. The custom mouse cursors are cute, but that adds another 175KB and 8 requests to make that happen also.

This post has been edited by ArtificialSoldier: 02 October 2014 - 11:38 AM

Was This Post Helpful? 0
  • +
  • -

#3 chris98  Icon User is offline

  • D.I.C Lover

Reputation: 40
  • View blog
  • Posts: 1,100
  • Joined: 06-July 13

Re: How slow is my site?

Posted 02 October 2014 - 01:12 PM

I'm pretty confused now - I installed the toolbar from here: https://chrome.googl...oaohcdbig?hl=en

and it stated that the first page took 12 seconds (originally) yet the second took 1.82. Then I tried the first again and it only took 1.93.

On the second page, I've deliberately avoided unnecessary database queries. I instead use caches and simply load the already generated HTML cache files - as well as a template. The code is much cleaner. This is the headers compared. The second file is bigger - but it avoids the footer which is 7.35 Kb.

Original header
<?php
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)/>/>
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // For HTTP/1.0 compatibility

// Send the Content-type header in case the web server is setup to send something else
header('Content-type: text/html; charset=utf-8');

ob_start(); 

$meta[] = '<meta name="copyright" content="" />';

if ($month_number == '12')
	$banner = '/images/shn_banner_christmas.png';
else
	$banner = '/images/shn_banner.png';

$scripts = $sites = array();
	
try
{
	$sql = "SELECT q.quote, q.unit, q.game FROM quotes AS q INNER JOIN current_quote AS c ON q.id = c.id";
	$ps = $shn_conf->query($sql);
	$quote = $ps->fetch();

	$query = "SELECT site, name FROM `sites` ORDER BY order_by ASC";
	$ps = $shn_conf->query($query);
	foreach ($ps as $row)
               	$sites[] = '<li><a href="'.$row['site'].'">'.$row['name'].'</a></li>';
}
catch(PDOException $e)
{
	error_log($e);
	error_msg();
}

$scripts[] = '<link rel="shortcut icon" href="/images/favicon.ico" />'."\n";
$scripts[] = '<link href="/css/jssor.css" rel="stylesheet" type="text/css" />'."\n";
$scripts[] = '<link href="/css/style.css" rel="stylesheet" type="text/css" />'."\n";

if (defined('PAGINATION'))
	$scripts[] = '<link href="/css/pagination.css" rel="stylesheet" type="text/css" />'."\n";
	
$scripts[] = '<script type="text/javascript" src="/js/validate.js"></script>'."\n";

if (isset($header_style) && $header_style == 'index')
{
	$scripts[] = '<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>'."\n";
	$scripts[] = '<script type="text/javascript" src="/js/jssor.core.js"></script>'."\n";
	$scripts[] = '<script type="text/javascript" src="/js/jssor.slider.js"></script>'."\n";
	$scripts[] = '<script type="text/javascript" src="/js/jssor.utils.js"></script>'."\n";
	$scripts[] = '<script type="text/javascript" src="js/jssor.config.js"></script>'."\n";
}

$scripts[] = '<style type="text/css">'.$GLOBALS['pun_colorize_groups']['style']."\n\t\t</style>"."\n";

if (!defined('ALLOW_INDEX'))
	$scripts[] = '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n"; 
$scripts[] = '<base href="http://'.$_SERVER['HTTP_HOST'].'/" />'."\n";


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><?php echo $title; ?></title>
		<?php if (count($meta)) echo implode("\n\t\t", $meta); 
		generate_header_addons($month_number);
			if (count($scripts)) echo implode("\t\t", $scripts); ?>
	</head>
	<body>
		<div id="wrapper_outer">
			<div id="wrapper_inner">
				<div id="shn_banner">
					<a href="" title=""  class="banner_icon"><img src="<?php echo $banner; ?>" width="980" height="150" title="" alt="" /></a>
				</div>
				<?php generate_menu_links($pun_user, $shn_conf); ?>
			</div>
			<div id="content_wrapper">
				<div class="side_bar margin_right_10">
					<div class="header_01">Random Quote:</div>
					<div class="quote"><?php echo $quote['quote']; ?></div>
					<p class="unit"><?php echo $quote['unit']; ?></p>
					<p class="game"><?php echo $quote['game']; ?></p>
					<div class="margin_bottom_20 horizontal_divider"></div>
					<div class="margin_bottom_20"></div>
					<div class="header_01">Site Search</div>
					<form action="search" method="post" name="search" onsubmit="return validatesearch()">
						<input type="hidden" name="site" value="all" />
						<input class="inputs" type="text" name="search_field" id="search_field" placeholder="Search here..." onkeyup="show_hint(this.value)" size="1" />
						<div id="livesearch"></div>
						<input type="submit" value="" class="inputs" id="search_button" name="search_button" />
					</form>
				<div class="margin_bottom_20 horizontal_divider"></div>
				<div class="margin_bottom_20"></div>
				<div class="header_01">Game Navigation</div>
				<ul>
					<?php echo implode("\n\t\t\t\t\t", $sites)."\n"; ?>
				</ul>
				<div class="margin_bottom_20 horizontal_divider"></div>
				<br />
				<a href="arden"><img src="/ads/arden.png" border="0" width="160" height="600" alt="" /></a>
				<div class="margin_bottom_20"></div>
			</div>
			<div class="content margin_right_10">
				<div class="content_section">
					<?php check_announcement($pun_config); ?>


New header
<?php
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Content-type: text/html; charset=utf-8');

ob_start();
switch($month_number)
{
	case 12:
		$banner = '/images/shn_banner_christmas.png';
	break;
	default:
		$banner = '/images/shn_banner.png';
	break;
}

$sidebar = array();

$scripts = generate_header_addons();
$navigation = generate_menu_links($pun_user, $shn_conf);
$announcement = check_announcement($pun_config);

if (defined('PAGINATION'))
	$scripts .= '<link href="/css/pagination.css" rel="stylesheet" type="text/css" />'."\n";

if (defined('INDEX'))
{
	$scripts .= '<link href="/css/jssor.css" rel="stylesheet" type="text/css" />'."\n";
	$scripts .= '<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>'."\n";
	$scripts .= '<script type="text/javascript" src="/js/jssor.core.js"></script>'."\n";
	$scripts .= '<script type="text/javascript" src="/js/jssor.slider.js"></script>'."\n";
	$scripts .= '<script type="text/javascript" src="js/jssor.utils.js"></script>'."\n";
	$scripts .= '<script type="text/javascript" src="/js/jssor.config.js"></script>';
}

if (!defined('ALLOW_INDEX'))
	$robots = 'NOINDEX, FOLLOW'; 
else
	$robots = 'INDEX, FOLLOW';

$template = file_get_contents('/home/*******/template.tpl');
$template = str_replace('<shn_page_title>', $title, $template);
$template = str_replace('<shn_meta_robots_content>', $robots, $template);
$template = str_replace('<shn_groups_css>', $GLOBALS['pun_colorize_groups']['style'], $template);
$template = str_replace('<shn_header_files>', $scripts, $template);
$template = str_replace('<shn_logo_banner>', $banner, $template);
$template = str_replace('<shn_navigation_menu>', trim(ob_get_contents()), $template);
$template = str_replace('<shn_announcement>', $announcement, $template);
$template = str_replace('<shn_random_quote>', file_get_contents(FORUM_CACHE_DIR.'cache_quote.php'), $template);
$template = str_replace('<shn_site_list>', file_get_contents(FORUM_CACHE_DIR.'cache_sites.php'), $template);

ob_end_clean();
ob_start();

try
{
	$sql = "SELECT COUNT(id) FROM `messages` WHERE showed = 0 AND show_message = 1 AND owner = :id";
	$sql = $shn_fluxbb->prepare($sql);
	$sql->execute(array(':id'=>$pun_user['id']));
	$new_pms = $sql->fetchColumn();
}
catch(PDOException $e)
{
	error_log($e);
	error_msg();
}

	if ($new_pms != 0)
		$new = ' ('.$new_pms.')';

	if ($pun_user['is_guest'])		
		$sidebar[] = '<form method="post" action="login.php?action=in">
	<input type="hidden" name="form_sent" value="1" />
	<label class="conl required">Username<br /><input type="text" name="req_username" size="25" tabindex="2" maxlength="25" /><br /></label>
	<label class="conl required">Password<br /><input type="password" name="req_password" size="25" tabindex="2" /><br /></label>
	<label><input type="checkbox" name="save_pass" value="1" tabindex="3" />Remember me<br /></label>
	<label><a href="/register.php">Not Registered yet?</a><br /></label>		
	<input type="submit" name="login" class="inputs" value="Login" tabindex="4" style="background-color:#424242;color:#FFFFFF;"/>
</form>';
	else
	{
		$sidebar[] = '<li><a href="/profile.php?id='.$pun_user['id'].'">My Profile</a></li>';
		$sidebar[] = '<li><strong><a href="/subscriptions/'.$pun_user['id'].'-'.replace_characters($pun_user['username']).'/">My User Subscriptions</a></li></strong></li>';
		
		$sidebar[] = '<li><strong><a href="subscribers/'.$pun_user['id'].'-'.replace_characters($pun_user['username']).'/">My Subscribers</a></li></strong></li>';
		
		$sidebar[] = '<li><a href="files/'.$pun_user['id'].'-'.replace_characters($pun_user['username']).'/">My Download Files</a></li>';
		
		$sidebar[] = '<li><a href="/pms_inbox.php">Private Messaging'.$new.'</a></li>';
		
		$sidebar[] = '<li><a href="/login.php?action=out&id='.$pun_user['id'].'&csrf_token='.pun_hash($pun_user['id'].pun_hash(get_remote_address())).'">Logout</a></li>';
	}

if (!$pun_user['is_bot']): ?>
          <div class="header_01">Translate Page</div>
	<a href="<?php echo $url; ?>"><img src="/images/flag_great_britain.png" title="Translate to English" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=de"><img src="/images/flag_germany.png" title="Translate to German" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=fr"><img src="/images/flag_france.png" title="Translate to French" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=pl"><img src="/images/flag_poland.png" title="Translate to Polish" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=ru"><img src="/images/flag_russia.png" title="Translate to Russian" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=da"><img src="/images/flag_denmark.png" title="Translate to Danish" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=es"><img src="/images/flag_spain.png" title="Translate to Spanish" width="16" height="16" border="0" /></a> <a href="http://translate.google.com/translate?u=<?php echo $url; ?>&hl=en&ie=UTF-8&sl=en&tl=sv"><img src="images/flag_sweden.png" title="Translate to Swedish" width="16" height="16" border="0" /></a>
			<div class="margin_bottom_20 horizontal_divider"></div>
			<div class="margin_bottom_20"></div>
<?php endif; ?>
				<div class="header_01">My Account</div>
				<ul>
					<?php echo implode("\n\t\t\t\t\t", $sidebar); ?>
				</ul>
				<div class="margin_bottom_20 horizontal_divider"></div>
				<div class="margin_bottom_20"></div>

<?php
$template = str_replace('<shn_page_sidebar>', trim(ob_get_contents()).file_get_contents(FORUM_CACHE_DIR.'cache_sidebar.php'), $template);
$template = str_replace('<shn_current_year>', date('Y'), $template);
ob_end_clean();
ob_start();

//echo $template;
?>


template:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title><shn_page_title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="" />
<meta name="copyright" content="" />
<meta name="ROBOTS" content="<shn_meta_robots_content>" />
<link rel="shortcut icon" href="/images/favicon.ico" />
<link href="/css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css"><shn_groups_css></style>
<shn_header_files>
<script type="text/javascript" src="/js/validate.js"></script>
</head>
<body>
<div id="wrapper_outer">
			<div id="wrapper_inner">
				<div id="shn_banner">
					<a href="" title=""  class="banner_icon"><img src="<shn_logo_banner>" width="980" height="150" title="" alt="" /></a>
				</div>
				<shn_navigation_menu>
			</div>
			<div id="content_wrapper">
				<div class="side_bar margin_right_10">
				<div class="header_01">Random Quote:</div>
				<shn_random_quote>
				<div class="margin_bottom_20 horizontal_divider"></div>
				<div class="margin_bottom_20"></div>
				<div class="header_01">Site Search</div>
				<form action="/search" method="post" name="search" onsubmit="return validatesearch()">
					<input type="hidden" name="site" value="all" />
					<input class="inputs" type="text" name="search_field" id="search_field" placeholder="Search here..." onkeyup="show_hint(this.value)" size="1" />
					<div id="livesearch"></div>
					<input type="submit" value="" class="inputs" id="search_button" name="search_button" />
				</form>
				<div class="margin_bottom_20 horizontal_divider"></div>
				<div class="margin_bottom_20"></div>
				<div class="header_01">Game Navigation</div>
				<ul>
					<shn_site_list>
				</ul>
				<div class="margin_bottom_20 horizontal_divider"></div>
				<br />
				<a href="arden"><img src="/ads/arden.png" border="0" width="160" height="600" alt="" /></a>
				<div class="margin_bottom_20"></div>
			</div>
			<div class="content margin_right_10">
				<div class="content_section">
				<shn_announcement>

				<shn_main>
			<div class="line-separator"></div>
			<center>Copyright &copy; 2013 - <shn_current_year> **.<br />Please read our <a href="/disclaimer/">Disclaimer</a> and <a href="/privacy/">Privacy Statement</a>.<br />Unauthorised Copying of <strong>any</strong> kind is <strong>Strictly Prohibited</strong>.<br />All rights, including images, downloads and articles are reserved.</center>
                	<div class="cleaner"></div>
            	</div>
		</div>
		<div class="side_bar">

			<shn_page_sidebar>
		<shn_footer>
</body>
</html>


Note that I've removed the domain name.

Original:

Header.php -> 5.24 Kb
footer.php -> 7.35 Kb

New:

header.php -> 7.2 Kb
template -> 3.05 Kb

Surely this just can't be a case of code clutter? I've got a single db query on the second, while on the first there are multiple queries (both in header and footer.php) - a thought has just occurred - could some of this be my htaccess IP bans? I now have nearly 200 single IP deny requests, my mod_rewrite stuff, error documents and RewriteConds. My htaccess file is 9.07 Kb.

I also tried using gzip before, but I didn't see any difference?

This post has been edited by chris98: 02 October 2014 - 01:13 PM

Was This Post Helpful? 0
  • +
  • -

#4 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1864
  • View blog
  • Posts: 5,829
  • Joined: 15-January 14

Re: How slow is my site?

Posted 02 October 2014 - 01:51 PM

Quote

I'm pretty confused now - I installed the toolbar

I'm not sure what that is. In Chrome, press Ctrl-Shift-I. Click the Network tab. Click the Disable cache checkbox. Refresh your site several times. At the bottom of the list of files that were loaded you'll see a summary row which will list the total number of requests, the total size, the time to download everything listed there, the initial load time, and the time until the DOMContentLoaded event fired. There's a filter option on that page if you want to see only certain requests (CSS, scripts, images, ajax requests, etc).

After several more refreshes, now the original one is steady at about 6.6 seconds, and the new one is kind of all over the place (2.5s, 4.7s, 5.6s, 6.1s, 6.6s).

Quote

I've got a single db query on the second, while on the first there are multiple queries (both in header and footer.php)

What about generate_header_addons and the other functions, those don't have queries?

Even so, the time to generate the HTML is not the bottleneck here. Most of the time is spent downloading all of the various files, which only occurs after the PHP code that generates the initial HTML is finished.

Quote

could some of this be my htaccess IP bans?

Of course. Asking the server do to more work is not free.

Quote

My htaccess file is 9.07 Kb.

That is a very large set of rules that you are asking the server to process on each of those 47 requests. There's another trend I notice in Chrome. If I look at the timeline to see where the time for each request is being spent, this is what I see:

test.php - 78ms to connect; waiting for 1.10s; 86ms to receive
style.css - 73ms blocked; waiting for 1.08s; 1.5ms to receive
jssor.css - 73ms to connect; waiting for 1.08s; 2.5ms to receive
jquery-1.9.1.min.js - 73ms to connect; waiting for 1.08s; 389ms to receive
jssor.core.js - 74ms to connect; waiting for 1.08s; 4ms to receive

Starting to see a pattern there? It takes roughly .07 seconds for the browser to connect to the server. After that, the browser waits over a second for the server to start responding. Once it does respond, it downloads the file very quickly (the output from test.php was 26KB and got downloaded in 86ms). If you asked me, from looking at those numbers I would guess that it takes your server about 1.08 seconds to process that .htaccess file, and it took test.php and extra 0.02 seconds to execute.

Quote

I also tried using gzip before, but I didn't see any difference?

The text content of your site is only about 200KB. Compression will only save you maybe 150KB. The rest is image data which you should not compress.

This post has been edited by ArtificialSoldier: 02 October 2014 - 01:55 PM

Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6580
  • View blog
  • Posts: 30,734
  • Joined: 10-May 07

Re: How slow is my site?

Posted 02 October 2014 - 03:26 PM

http://tools.pingdom.com/fpt/
Was This Post Helpful? 0
  • +
  • -

#6 chris98  Icon User is offline

  • D.I.C Lover

Reputation: 40
  • View blog
  • Posts: 1,100
  • Joined: 06-July 13

Re: How slow is my site?

Posted 03 October 2014 - 06:10 AM

generate_header_addons is my snow (taken from wordpress originally) that comes down the page during December (a simple PHP if statement is all), the generate_menu_links uses a pre-built cache to avoid a massive query and check_announcement uses a pre-generated array of configuration values from the DB.

The only other query is for updating the online list and logging the user for stats.

I've removed all my IP bans and my htaccess file is considerably smaller at a size of only 5 Kb (exactly). But it's still going just as slow!

I've also did what you did and now I'm waiting for between 1.15 & 1.65 seconds! It's absolutely horrendous - everything I do to try and make it better seems to backfire on me.

I used the tool no2pencil gave me, and this is what I got:

Quote

Perf.
grade85/100

Requests
48

Load time
2.21s

Page size
2.2MB


But then I did a test from Dallas in the US and I got back that my speed was over 8 seconds. It's just so confusing and I'm just about at my wit's end with this. There are no stable results that bring back concrete factors that are the cause. I've even shoved my javascript and CSS through minifiers but it's made zero difference.

This was my timeline on Chrome:

Quote

shn_banner
blocking 5 ms; sending 0; waiting 1.40 s; receiving 2.14 s

test.php
blocking 5 ms; DNS lookup 150 ms; connecting 122 ms; sending 0; waiting 1.67 s; receiving 149 ms

style.css
blocking 14.986 ms; sending 0; waiting 1.14 s; receiving 23 ms;

jssor.utils.js
blocking 15 ms; DNS lookup 7 ms; connecting 126 ms; sending 0; waiting 1.18 s; receiving 582.500 ms

jssor.slider.js
blocking 15.000 ms; DNS Lookup 8.000 ms; Connecting 124.000 ms; Sending 0; Waiting 1.16 s; Receiving 721.000 ms

jssor.core.js
Blocking 15.000 ms; DNS Lookup 1.000 ms; Connecting 123.000 ms; Sending 0; Waiting 1.16 s; Receiving 5.000 ms

jssor.config.js
Blocking; 1.16 s; Sending 0; Waiting 1.20 s; Receiving 816.500 ms


For the CSS, it was waiting 1.14 seconds - what's it actually "waiting" for?

EDIT: My htaccess file:

RewriteEngine on
# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /

ErrorDocument 400 /errors/400 
ErrorDocument 401 /errors/401
ErrorDocument 403 /errors/403 
ErrorDocument 404 /errors/404
ErrorDocument 500 /errors/500 
ErrorDocument 501 /errors/501 
ErrorDocument 502 /errors/502
ErrorDocument 503 /errors/503
ErrorDocument 504 /errors/504
ErrorDocument 505 /errors/505
ErrorDocument 506 /errors/506
ErrorDocument 507 /errors/507
ErrorDocument 508 /errors/508
ErrorDocument 509 /errors/509
ErrorDocument 510 /errors/510

php_value auto_prepend_file none
AddDefaultCharset UTF-8 

<IfModule mod_rewrite.c>
  RewriteCond %{HTTP_HOST} ^****** [NC]
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule ^(.*)$ http://www.*****/$1 [L,R=301]
  RewriteRule ^community/get-involved/$ ****.php 
  RewriteRule ^community/faq$ ****.php
  RewriteRule ^community/staff$ ****.php
  RewriteRule ^community/donate$ ****.php
  RewriteRule ^community/staff/edit/(.*)/$ ****.php?id=$1
  RewriteRule ^search/(.*)/(.*)/$ ****?site=$1&search=$2
  RewriteRule ^search/(.*)/(.*)/page_(.*)$ ****site=$1&search=$2&page=$3
  RewriteRule ^search$ ***
  RewriteRule ^article/(.*)/(.*)$ ****?pageid=$1&name=$2
  RewriteRule ^article/(.*?)-(.*)$ ****pageid=$1&name=$2
  RewriteRule ^logout/(.*)/(.*)$ ***?action=out&id=$1&csrf_token=$2
  RewriteRule ^report/error$ **
  RewriteRule ^report/link$ **
  RewriteRule ^report/user$ **
  RewriteRule ^rules/terms-of-service$ ***
  RewriteRule ^support/ticket.php?id=(.*)&hash=(.*)$ ^****.php?id=$1&hash=$2
  RewriteRule ^articles/list/(.*)/(.*)/page_(.*)$ ***.php?game=$1&category=$2&page=$3
  RewriteRule ^articles/list/(.*)/(.*)$ ****.php?game=$1&category=$2
  RewriteRule ^articles/list/(.*)$ *****.php?game=$1
  RewriteRule ^errors/401$ ****.php
  RewriteRule ^errors/403$ **.php
  RewriteRule ^errors/404$ *?error=404
  RewriteRule ^errors/400$ *?error=400
  RewriteRule ^errors/500$ *?error=500
  RewriteRule ^errors/501$ *?error=501
  RewriteRule ^errors/502$ *?error=502
  RewriteRule ^errors/503$ *?error=503
  RewriteRule ^errors/504$ *?error=504
  RewriteRule ^errors/505$ *?error=505
  RewriteRule ^errors/506$ *?error=506
  RewriteRule ^errors/507$ *?error=507
  RewriteRule ^errors/508$ *?error=508
  RewriteRule ^errors/509$ *?error=509
  RewriteRule ^errors/510$ *?error=510
  RewriteRule ^arden$ http://forums.*****/viewtopic.php?id=96
  RewriteRule ^(.*)-polls/$ *?type=$1
  RewriteRule ^poll/(.*?)-(.*?)/$ ***?id=$1&q=$2
  RewriteRule ^games/(.*)/$ ***?game=$1
  RewriteRule ^members/article-guidelines/$ **.php
  RewriteRule ^members/submit-article/$ **.php
  RewriteRule ^members/submit-article/submit$ ***.php 
  RewriteRule ^members/submitted-article/$ **.php
</IfModule>

php_value post_max_size 128M

<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>

Redirect 404 /sites/
Redirect /wordpress /honey/
Redirect /wp-admin /honey/
Redirect /admin /honey/
Redirect /wp-login.php /honey/
Redirect /administrator /honey/



RewriteCond %{HTTP_REFERER} !^http://admin.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://admin.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://downloads.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://downloads.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://forums.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://forums.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://gallery.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://gallery.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.downloads.mysite.com.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.downloads.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.forums.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.forums.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gallery.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gallery.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$      [NC]
RewriteRule .*\.(zip)$ - [F,NC]


<Files 403.shtml>
order allow,deny
allow from all
</Files>


EDIT 2: Here's the code for the sprite you suggested - but it's not doing what I want, it's simply outputting a blank page.

Here is the code, and a link below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title>CSSSprites.com generated page</title>
  <style type="text/css">
	.flag {
		background: url('images/translate_flags3.png');
	}
 /*   div {
        background: url('images/translate_flags3.png');
    } */

#flag_britain {
	background url('images/translate_flags3.png') -0px -3px;
	width: 16px;
	height: 16px
	position: relative;
}
  </style>
</head>
<body>
  <div id="flag_britain"></div>
<br /><br /><div style="background-position: -0px -3px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -19px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -35px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -51px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -67px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -83px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -99px; width: 16px; height: 16px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -117px; width: 16px; height: 16px">&nbsp;</div>


</body>
</html>


http://bit.ly/1vDaMwh

This post has been edited by chris98: 03 October 2014 - 08:29 AM

Was This Post Helpful? 0
  • +
  • -

#7 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1864
  • View blog
  • Posts: 5,829
  • Joined: 15-January 14

Re: How slow is my site?

Posted 03 October 2014 - 10:24 AM

Quote

For the CSS, it was waiting 1.14 seconds - what's it actually "waiting" for?

It's waiting for the server to start sending data. It takes the server that long to start sending data. Part of that time is testing all of the regular expressions in your .htaccess file for matches against the URL. If you're not actually running this server, if this is a shared server or something, then who knows what else it's doing. Maybe the host just puts a ton of accounts on their shared servers and they end up being fairly slow to respond, I don't know. That's the major problem with your site, that 1+ seconds of wait time for each and every request. If I test dreamincode.net, for example, I see wait times as low as 25 milliseconds. Your server is taking over 1000 milliseconds. That's the problem. If you want to find out what the baseline wait time for your server is, put up a static HTML page (or image, or whatever), completely remove your .htaccess file, and check the wait time for the static file. Then add your .htaccess file back and check the difference. Your .htaccess file might not even be making that much of a difference, the problem might be somewhere else on the server that you can't even get to.
Was This Post Helpful? 0
  • +
  • -

#8 chris98  Icon User is offline

  • D.I.C Lover

Reputation: 40
  • View blog
  • Posts: 1,100
  • Joined: 06-July 13

Re: How slow is my site?

Posted 03 October 2014 - 10:49 AM

Well I loaded the HTML file above (which I've now managed to get the sprites working) and using the add-on I linked to above it took 2.42 seconds to load.

I used the way you showed me after, (which then took 2.72 seconds to load from the add-on above) and this was the result:

test.html

Quote

Blocking 3.000 ms; DNS Lookup; 230.000 ms; Connecting 121.000 ms; Sending 1.000 ms; Waiting 1.13 s; Receiving 0


translate_flags4.png

Quote

Blocking 4.000 ms; Sending 0; Waiting 1.13 s; Receiving 0.010 ms


It's waiting 1.13 seconds. I then renamed my htaccess file to .htaccess_____ and I got this:

test.html

Quote

Blocking 6.000 ms; DNS Lookup 348.000 ms; Connecting 123.000 ms; Sending 0; Waiting 1.13 s; Receiving 0.500 m


translate_flags4.png

Quote

Blocking 3.000 ms; Sending 1.000 ms; Waiting 1.14 s; Receiving 0


The addon claimed my speed was 2.79. It's clearly server related. I have heard many rumors stating they cram as many clients onto one server as possible, obviously this is true. A reverse IP lookup shows over 40 other sites (some appearing inactive) on the same server as my own site. I'm not sure how many clients competent hosts put on one server, is this a relatively small amount or large?
Was This Post Helpful? 0
  • +
  • -

#9 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1864
  • View blog
  • Posts: 5,829
  • Joined: 15-January 14

Re: How slow is my site?

Posted 03 October 2014 - 11:10 AM

It's not a huge amount, we have a server here that has around 40 clients on it and their applications are pretty large and intensive (although, that server is maxed out for its hardware, I need to move a couple accounts somewhere else). But, our server is not a traditional shared host either, our clients do not have cPanel, SSH, or FTP access unless special arrangements are made, it is just a hosted application. Your server might be doing several additional permission and access control checks that ours don't have to do, or it could just be configured in an odd way. If it takes the server over a second to start responding to any request then that's definitely a problem. If you want to approach your host about that issue, you may want to test some other sites and see how long other servers typically take to respond. If you know people with shared accounts on other hosts, check them.
Was This Post Helpful? 0
  • +
  • -

#10 chris98  Icon User is offline

  • D.I.C Lover

Reputation: 40
  • View blog
  • Posts: 1,100
  • Joined: 06-July 13

Re: How slow is my site?

Posted 04 October 2014 - 04:22 AM

I'm in the process of checking other sites as well, but could this be to do with the server load?

My host has a page where you can check the server load, and in most cases when it was going slow, the server load was about 4.x.

It's taking a lot less time just 'waiting' at the moment and according to gtmetrix the test page took 1.79 seconds to load, the main page took 2.53 seconds to load, and the server load is half of that above (2.29) - Nothing has changed on my pages.

I think they use the function sys_getloadavg. I refreshed the page a couple of times and it went from 1.x to 2.x. I'm not quite sure what it's in though, I'm guessing megabytes.

The add-on for chrome shows my HTML page loading in 0.34 seconds now, but the way you showed me states that the waiting time was 136 ms.
Was This Post Helpful? 0
  • +
  • -

#11 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1864
  • View blog
  • Posts: 5,829
  • Joined: 15-January 14

Re: How slow is my site?

Posted 06 October 2014 - 03:26 PM

If you're using WHM/cPanel, the CPU load metric on its own doesn't mean much. If the server has 4 CPU cores, then a load of 4 means that all cores are working 100% of the time. But if the server has 16 cores, a load of 4 means that the cores are only 25% used. So knowing that load number without also knowing what hardware is in the machine doesn't really tell you much.

Some comparison:

server1 - 8 cores; serving 33 requests; Load Averages: 0.63 0.67 0.69
server2 - 16 cores; serving 48 requests; Load Averages: 4.78 6.44 6.28
server3 - 16 cores; serving 12 requests; Load Averages: 0.52 0.63 0.80
server4 - 16 cores; serving 8 request; Load Averages: 0.17 0.51 0.58
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1