Jump to content

Why is my site so slow?


Recommended Posts

Thanks for respond but i know that tips and they are already on my site.
Can you check gtmetrix.com and say to me what can be slow. I have more then 20k articles. But on last design speed site was okey.

I need to speed up this site for 2-3 second minimum.

When you join on site, you have 5-7 seconds before site is loaded.
Maybe javascript or something....

Link to comment
Share on other sites

oh, can you help me with this: |
 

  • Sets PHP's display_errors to "on": errors are displayed in the browser instead of just blank pages.
  • Sets PrestaShop's _PS_DEBUG_SQL_ constant to "true": PrestaShop displays potential problems within your SQL queries.
  • Sets PrestaShop's _PS_DISPLAY_COMPATIBILITY_WARNING_ constant to "true": PrestaShop displays a warning message if a piece of code you are using is deprecated in the current version.
Link to comment
Share on other sites

hi, as you are running a 1.5.4.0 shop one assumes that you speed was not always so slow (from your perspective)

 

was it always this slow?  if not when did you start to see this issue?

 

what usually happens on established shops is 1) hosting has slowed 2) you modified (most likely module) that has created more overhead in your shop.

 

honestly, low cost hosting can 'reduce' performance for any number of different reasons...but for me anyway there would not be enough information to really help other than things you can look at.

Link to comment
Share on other sites

I understand. Now i looking for new server. I am using for now this dedicated server:

 

This is server is most cheaper. I am looking for same server but with SSD . What you think about this. maybe i will get better performanse. If you look on gtmetrix.com you will see in my first 5 problems 3 are SERVER.

 

Intel® Core™ i7-4770
Quadcore Haswell
incl. Hyper-Threading Technology
  • RAM 32 GB DDR3 RAM
  • Hard Drive 2 x 2 TB SATA 6 Gb/s 7200 rpm
    HDD (Software-RAID 1)
    Class Enterprise
  • Connection 1 Gbit/s-Port
  • Guaranteed Bandwidth 200 Mbit/s
  • Backup Space 100 GB
  • Inclusive Traffic 20 TB*

 

                                                           
 

Link to comment
Share on other sites

you may want to message dh42 here on forum include link to this topic.

 

without knowing many other details I can not honestly give you better advice other than general stuff to help you.  I know dh42 has customers and works with them on hosting.  I don't do that sort of thing anymore.

Link to comment
Share on other sites

Okay i sent message. Tell me now what about your module from signature?  Modul Java Pro. i have toomuch javascripts on site.

 

Hi, we all have to much JavaScript...jajajaja

 

here is forum post

 

it's important to understand 'above the fold' page render, then you have better idea of what module accomplishes.

 

Google weighs your 'above the fold' (AFT) page render time for SEO purposes.  It's all about user experience.  Google factors in ‘above the fold’ render time into your SEO.

 

Measuring a shop using online metrix...pingdome, gmetrix, etc. while it provides useful information does not currently measure AFT.

The AFT is so important that Google patented it.

 

Learn more here: http://www.google.co.../US20070118640f

 

JavaPro combined with native PrestaShop CCC for .css and .js gives you competitive advantage over all other open source e-commerce CMS.

Link to comment
Share on other sites

hi, as you are running a 1.5.4.0 shop one assumes that you speed was not always so slow (from your perspective)

 

was it always this slow?  if not when did you start to see this issue?

 

Just jumping in on this discussion since this argument triggered my attention.

 

I am on 1.5.4.1 and yes it has been slow since the beginning. From the moment we had the shop up and running running, we had massive performance fluctuations but the bottom line was that the site was too slow for my taste. If I would have been a potential customer to my own shop I would not have bothered waiting for the pages to appear.

 

Moving to a new faster server brought a lot of improvement but still the fluctuations remained.

 

We then installed APC Cache which improved performance once more, but still the immense performance fluctuations remained. On a new query, especially when it was a filter query, it could take up to 10 sec. to get a page loaded.

 

Having tried numerous suggestions (also from the threads you point to in this thread) the biggest breakthrough for our shop was the tip about disabling caching in this thread: http://www.prestashop.com/forums/topic/241838-prestashop-very-slow/ in combination with a tip about modifying the Category query (also mentioned somewhere on the forum).

 

Since we don't need all the data gathered by the original query, I deleted those parts from the query and made the same adjustments to the filter module (blocklayered).

Also I disabled CCC caching entirely, so we are only using Smarty cache and APC cache, the rest is disabled.

 

And this is the override for the Category.php that I now use:

(You should put this Category.php in you override/classes folder. And mind you, this is based on 1.5.4.1)

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

class Category extends CategoryCore
{
	/**
	  * Return current category products
	  *
	  * @param integer $id_lang Language ID
	  * @param integer $p Page number
	  * @param integer $n Number of products per page
	  * @param boolean $get_total return the number of results instead of the results themself
	  * @param boolean $active return only active products
	  * @param boolean $random active a random filter for returned products
	  * @param int $random_number_products number of products to return if random is activated
	  * @param boolean $check_access set to false to return all products (even if customer hasn't access)
	  * @return mixed Products or number of products
	  */
	public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null)
	{
		if (!$context)
			$context = Context::getContext();
		if ($check_access && !$this->checkAccess($context->customer->id))
			return false;
		
		$front = true;
		if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
			$front = false;
			
		if ($p < 1) $p = 1;

		if (empty($order_by))
			$order_by = 'position';
		else
			/* Fix for all modules which are now using lowercase values for 'orderBy' parameter */
			$order_by = strtolower($order_by);

		if (empty($order_way))
			$order_way = 'ASC';
		if ($order_by == 'id_product' || $order_by == 'date_add' || $order_by == 'date_upd')
			$order_by_prefix = 'p';
		elseif ($order_by == 'name')
			$order_by_prefix = 'pl';
		elseif ($order_by == 'manufacturer')
		{
			$order_by_prefix = 'm';
			$order_by = 'name';
		}
		elseif ($order_by == 'position')
			$order_by_prefix = 'cp';

		if ($order_by == 'price')
			$order_by = 'orderprice';

		if (!Validate::isBool($active) || !Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way))
			die (Tools::displayError());

		$id_supplier = (int)Tools::getValue('id_supplier');

		/* Return only the number of products */
		if ($get_total)
		{
			$sql = 'SELECT COUNT(cp.`id_product`) AS total
					FROM `'._DB_PREFIX_.'product` p
					'.Shop::addSqlAssociation('product', 'p').'
					LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
					WHERE cp.`id_category` = '.(int)$this->id.
					($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').
					($active ? ' AND product_shop.`active` = 1' : '').
					($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '');
			return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
		}

		$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, 0 as quantity, pl.`description`, pl.`description_short`, pl.`available_now`,
					pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image,
					il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default,
					DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),
					INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).'
						DAY)) > 0 AS new, product_shop.price AS orderprice
				FROM `'._DB_PREFIX_.'category_product` cp
				LEFT JOIN `'._DB_PREFIX_.'product` p
					ON p.`id_product` = cp.`id_product`
				'.Shop::addSqlAssociation('product', 'p').'
				LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
					ON (product_shop.`id_category_default` = cl.`id_category`
					AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
				LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
					ON (p.`id_product` = pl.`id_product`
					AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
				LEFT JOIN `'._DB_PREFIX_.'image` i
					ON (i.`id_product` = p.`id_product`)'.
				Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
				LEFT JOIN `'._DB_PREFIX_.'image_lang` il
					ON (image_shop.`id_image` = il.`id_image`
					AND il.`id_lang` = '.(int)$id_lang.')
				LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
					ON m.`id_manufacturer` = p.`id_manufacturer`
				WHERE product_shop.`id_shop` = '.(int)$context->shop->id.'
					AND cp.`id_category` = '.(int)$this->id
					.($active ? ' AND product_shop.`active` = 1' : '')
					.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
					.($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '')
					.' GROUP BY product_shop.id_product';

		if ($random === true)
		{
			$sql .= ' ORDER BY RAND()';
			$sql .= ' LIMIT 0, '.(int)$random_number_products;
		}
		else
			$sql .= ' ORDER BY '.(isset($order_by_prefix) ? $order_by_prefix.'.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
			LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;

		$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
		if ($order_by == 'orderprice')
			Tools::orderbyPrice($result, $order_way);

		if (!$result)
			return array();

		/* Modify SQL result */
		return Product::getProductsProperties($id_lang, $result);
	}

}

This made a huge performance difference. And performance does fluctuate much less now.

 

In the mean time I am still playing with it though to tweak the whole setup even further.

 

Hope this helps others too.

Edited by Toeareg (see edit history)
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...