Jump to content

Archived

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

Chemo

A Store Speed Optimization in Progress

Recommended Posts

You have h1 and h2 tags in the head section which should not be there.

 

The 2 images do not exist

    * http://www.stylingagenten.se/images/line_x.gif
   * http://www.stylingagenten.se/images/menu_marker.gif

 

Hi!

I started to delete some calls for that images and reduced the size of the css a bit, that is great!

 

Excuse me for this dumb question, but where should my H1, H2 tags be then, if not in head section?

 

One more question, is it any idea to optimize the category box as suggested with for example this addon

 

http://addons.oscommerce.com/info/5173

or

http://addons.oscommerce.com/info/4075

 

if I did not have enabled the "count" for the categories? Will it still improve the number of queries?

 

Cheers, thank you for all help!! :)

 

Best regards

Andreas

 

 

 

 

 

You could create a link to your jquery like this instead of serving it. (People will probably already have this cached so a faster load time, plus parallel downloading)

<script type="text/javascript" src="<?php echo (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://') . 'ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'; ?>"></script>
<script type="text/javascript" src="<?php echo (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://') . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js'; ?>"></script>

Share this post


Link to post
Share on other sites

For a better understanding of H1 and H2 tags, download version 2.3.1 and have a look how they are positioned. h1 tags are used as pageheadings (usually near the top of page in the body) and h2 are sub headings. Disabling the count reduces the queries by 1 per category, so yes. I cannot comment on the categories box as I use USU5 pro which caches the queries. I have got my page down to 0.006s parse time and still going!!!!

 

www dot electricalcity.co.uk

Share this post


Link to post
Share on other sites

Hi,

It is strange that is say it is missing, because that picture is shown in the browser. I found one thing that makes the picture seems slow. Its very slow when you click in the menu and hit for example this url:

http://www.stylingag...tyling-c-1.html

 

From what you see it in this picture:

http://www.stylingag...images/test.jpg

 

There are a lot of "red-missing" pictures, but they are actually existing. It is all the category/product pictures.

 

As you see in the picture they are all beginning download after each picture is done, this takes a long total time. That makes it slow in total. Anyone knows how this is possible to change?

 

Best regards :)

Andreas

 

Hi Andreas

 

I see your shop is attractive but very slow.

Probably:

- use lot of thing in one

- snowflakes slow dawn browsers (this is typical speed test for browsers by how many snowflakes can fly :rolleyes:)

- google analitics script cant close

- use product_thumb.php

- I see you use seo URL, but links dont use in the shop!

- facebook box

- there are many redirects from server side

- and so on..

 

 

I suggest you that go step by step speed debug. You have to switch off all extra and start to switch on by step to exam the results.

I think you have got too many incompatible cross process.

 

You can do.

1. Make a BACKUP!!

2. install a basic new shop in a subdomain or a subdirectory with a new database and config after (in all configure.php) installation to the real one.

Make a speed tests in the simple store. This will be the reference speed with your database.

 

3. Return to the real shop and start step by step switch on your extras.

Make speed test and you can analise results.

- turn on only URL SEO and after turn off

- turn on only Google analitics and after turn off

- turn on only product_thumb.php and after turn off

and so on

 

I find some nonstandard intresting thing in html code javascirpts inserted after </thml> close tags.

 

Maybe you can find any important results.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Hi Gergely,

thank you for your great feedback, that gave some good knowledge how to continue!

 

Hi Andreas

 

I see your shop is attractive

Thank you :)

 

 

- snowflakes slow dawn browsers (this is typical speed test for browsers by how many snowflakes can fly :rolleyes:)

 

Haha, it is a cool feature but I see now that it does not make a fair test result in the web tools. The .js for the snowflake is putted last in the page code, so the customer does not experience that the snow slow much.

 

google analitics script cant close

Do you mean in general, or do you see something wrong in my coding?

 

- use product_thumb.php

Ya, I guess this may slow a bit

 

- I see you use seo URL, but links dont use in the shop!

I dont understand you completely he, depending on my lack of experience and not on you way to explain :) , do you mean for example theese product links? http://www.stylingagenten.se/product_info.php?cPath=1_22&products_id=214?

 

- facebook box

I experienced it was going much faster when I did not use iframes here, so it is better now than before...but it does not speed things up..hehe.

 

- there are many redirects from server side

I dont understand this completely, because of the code or the host?

 

I suggest you that go step by step speed debug. You have to switch off all extra and start to switch on by step to exam the results.

I think you have got too many incompatible cross process.

 

You can do.

1. Make a BACKUP!!

2. install a basic new shop in a subdomain or a subdirectory with a new database and config after (in all configure.php) installation to the real one.

Make a speed tests in the simple store. This will be the reference speed with your database.

What do you think about this addon for that? http://addons.oscommerce.com/info/7503

 

3. Return to the real shop and start step by step switch on your extras.

Make speed test and you can analise results.

- turn on only URL SEO and after turn off

- turn on only Google analitics and after turn off

- turn on only product_thumb.php and after turn off

and so on

 

Great method!:) I see alreade that URL SEO and Sitemap SEO is slowing my site quite much. I actually experienced my site quite fast when I disabled them. I really like this addons thou, so I dont know what to do here? Do you have any experience about them?

 

I find some nonstandard intresting thing in html code javascirpts inserted after </thml> close tags.

 

I guess Im to novice to find thoose hehe:)

 

Thank you for taking your time and helped me!!

 

Best regards

Andreas

Share this post


Link to post
Share on other sites

For a better understanding of H1 and H2 tags, download version 2.3.1 and have a look how they are positioned. h1 tags are used as pageheadings (usually near the top of page in the body) and h2 are sub headings. Disabling the count reduces the queries by 1 per category, so yes. I cannot comment on the categories box as I use USU5 pro which caches the queries. I have got my page down to 0.006s parse time and still going!!!!

 

www dot electricalcity.co.uk

 

You really succeeded :) I did improve quite much since I started to ask in this thread. I have much to thank you from that!

 

I use Ultimate SEO URL, I will upgrade to USU5 pro, I think that will improve my site even more!

 

Best Regards

Andreas

Share this post


Link to post
Share on other sites

Hi.

 

I just installed v1.6 of Chemos debug module, but as a result my page suddenly started showing the login/account creation page for no reason.

 

After removing the mod, its alle back to normal again, so I'm fairly certain whats causing the problem.

 

Have anyone else encountered any similar result, and what could be causing this strange behaviour?

I made tripple checks to make sure the mod was installed correct.

Share this post


Link to post
Share on other sites

Hi.

 

I just installed v1.6 of Chemos debug module, but as a result my page suddenly started showing the login/account creation page for no reason.

 

After removing the mod, its alle back to normal again, so I'm fairly certain whats causing the problem.

 

Have anyone else encountered any similar result, and what could be causing this strange behaviour?

I made tripple checks to make sure the mod was installed correct.

 

That contribution is very old and limited, my suggestion is to install KissER, see my sig.

Share this post


Link to post
Share on other sites

I just installed Roberts excellent Kiss_ER awesome contribution and thought I'd look at my slower queries....the slowest one that I have on index.php is this one...

 

select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id, products_description pd where p.products_status = '1' AND (p.products_site = 'ALL' OR p.products_site = 'CAD') and p.products_id = pd.products_id and pd.language_id = '1' order by RAND() limit 4

 

It comes in at 0.0522 Seconds and I'm wondering if there is anything I can do to speed it up. If seems reasonably quick but I thought I'd ask just to see if I could understand the process a bit....I tried using the "Explain" sql query mentioned in this thread but it really didn't give me anything to go on, at least nothing that I understood anyway.

 

Does anyone have any suggestions at to what I might do to improve on this query?

 

Dan

Share this post


Link to post
Share on other sites

Thanks to everyone I spend a while to read everything.

 

But big thanks to chemo

So I read everything and made the necessary changes.

But I'm still questionning myself.

 

If queries are important for the server load, isn't the most important thing for the website performance

For example on my site php page is loaded in 0.7 seconds, but the page is loaded in 4.5 s.

The main slowing point, are javascript loading (110KB compressed to 28kb) and images (36 images, reduced by "on the fly thumbnaillers")

having already installed a thumbnailler, gzip compression, I thinking to install a CDN(Content delivery network), he has someone already implemented a cdn?

 

 

Regards, sorry for my poor english.

Share this post


Link to post
Share on other sites

I read a lot of speed optimizations articles...

 

According to them one of the things which should speed up the site is to serve the images , css and javascript files from cookie less domain/sub-domain.

 

When I try to change the DIR_WS_IMAGESto sub domain it appends the catalog path to before.

 

for example:

 

define('DIR_WS_IMAGES', 'img.mydomain.com');

 

And the thumbnail path turns out to be my_main_domain.com/img.mydomain.com/img.jpg

 

Does anyone know what changes should I make in order to enable images serving from different domain/sub domain.

 

Thanks

Share this post


Link to post
Share on other sites

If your site has a lot of categories like mine, your advanced search page can bog down considerably while populating the category dropdown. I made the following change to only populate the drop down with top categories:

 

in catalog/advanced_search.php Change

echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES))));

 

To this

echo tep_draw_pull_down_menu('categories_id', tep_get_top_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES))));

 

 

In catalog/includes/functions/general.php add the following function:

  function tep_get_top_categories($categories_array = '', $parent_id = '0', $indent = '') {
global $languages_id;
if (!is_array($categories_array)) $categories_array = array();
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
while ($categories = tep_db_fetch_array($categories_query)) {
 	$categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name']);
}

return $categories_array;
 }

 

 

 

 

I'm not quite there yet but a couple resources have been recommended:

Create Indexes Automatically

Index Help File

 

probably because I have RC2.2 but I did as outlined here and now I get the error (although it is much faster now)

[color=#333333][font=Verdana, Arial, sans-serif][size=2]ategories:[color="#000000"][b]1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and cd.language_id = '1' order by sort_order, cd.categories_name' at line 1

select c.categories_id, cd.categories_name from categories c, categories_description cd where parent_id = '0' and c.categories_id = cd.categories_id and and cd.language_id = '1' order by sort_order, cd.categories_name

[color="#ff0000"][TEP STOP][/color][/b][/color][/size][/font][/color]

 

In the advanced_search.php page under the search box

 

Any assistance appreciated!

Share this post


Link to post
Share on other sites

probably because I have RC2.2 but I did as outlined here and now I get the error (although it is much faster now)

[color=#333333][font=Verdana, Arial, sans-serif][size=2]ategories:[color="#000000"][b]1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and cd.language_id = '1' order by sort_order, cd.categories_name' at line 1

select c.categories_id, cd.categories_name from categories c, categories_description cd where parent_id = '0' and c.categories_id = cd.categories_id and and cd.language_id = '1' order by sort_order, cd.categories_name

[color="#ff0000"][TEP STOP][/color][/b][/color][/size][/font][/color]

 

In the advanced_search.php page under the search box

 

Any assistance appreciated!

 

You have 2 times "and" before the language_id: and and cd.language_id

 

Some times errors are just errors not connected to anything else but an error we did, not to versions not to nothing else

Share this post


Link to post
Share on other sites

You have 2 times "and" before the language_id: and and cd.language_id

 

Some times errors are just errors not connected to anything else but an error we did, not to versions not to nothing else

 

Absolutely spot on as usual! Thank you George, it's appreciated.

Share this post


Link to post
Share on other sites

Any ideas on how to stop the banners from being queried on pages other than the index? I only have banners on my index page but the query runs on every page.

Time: 0.0458 Seconds.

Query: select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from banners b, banners_history bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id


If the only tool you have is a hammer, all your problems look like nails

Share this post


Link to post
Share on other sites

Hello.

 

After testing my site through webpagetest.org I found out that the time to first byte is about 20 second !!

 

I asked my host ,but they told me that their servers are fast.

 

I can not understand if it is the time which my site consumes or the server side.

 

I installed the most necessary queries contributions and got a very high grades on Google Page Speed and YSlow tools , but still my side loads within about 25-28 second.

 

Please help me understand what goes behind the TTFB time.

 

Here is a link to my site: www.israel-depot.com

 

Thank you

Share this post


Link to post
Share on other sites

Hello.

 

After testing my site through webpagetest.org I found out that the time to first byte is about 20 second !!

 

I asked my host ,but they told me that their servers are fast.

 

I can not understand if it is the time which my site consumes or the server side.

 

I installed the most necessary queries contributions and got a very high grades on Google Page Speed and YSlow tools , but still my side loads within about 25-28 second.

 

Please help me understand what goes behind the TTFB time.

 

Here is a link to my site: www.israel-depot.com

 

Thank you

I'm no expert by I am happy to chime in

 

This gives some food for thought http://www.websiteop...rvices/analyze/

and Page Speed points out some things

 

Your pulling images and other things from other domains, perhaps that is also causing issues,

static.ak.fbcdn.net

http://cdn-img.appspot.com

 

try turning off the stats program/s and cutting out as much javascript as you can and see what difference it makes

 

On the plus side, once you have loaded the home page things improve but the site is still a touch slow

Share this post


Link to post
Share on other sites

A little micro - improvement for oscommerce 2.3.1

 

I've replaced the regex function to check for alphanumerical carachters to the faster ctype php function.

 

In catalog/includes/functions/session.php find:

 

global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

   $sane_session_id = true;

   if (isset($HTTP_GET_VARS[tep_session_name()])) {
     if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_GET_VARS[tep_session_name()]) == false) {
       unset($HTTP_GET_VARS[tep_session_name()]);

       $sane_session_id = false;
     }
   } elseif (isset($HTTP_POST_VARS[tep_session_name()])) {
     if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_POST_VARS[tep_session_name()]) == false) {
       unset($HTTP_POST_VARS[tep_session_name()]);

       $sane_session_id = false;
     }
   } elseif (isset($HTTP_COOKIE_VARS[tep_session_name()])) {
     if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_COOKIE_VARS[tep_session_name()]) == false) 

 

replace to:

 

global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

   $sane_session_id = true;

   if (isset($HTTP_GET_VARS[tep_session_name()])) {
     if (ctype_alnum($HTTP_GET_VARS[tep_session_name()]) == false) {
       unset($HTTP_GET_VARS[tep_session_name()]);

       $sane_session_id = false;
     }
   } elseif (isset($HTTP_POST_VARS[tep_session_name()])) {
     if (ctype_alnum($HTTP_POST_VARS[tep_session_name()]) == false) {
       unset($HTTP_POST_VARS[tep_session_name()]);

       $sane_session_id = false;
     }
   } elseif (isset($HTTP_COOKIE_VARS[tep_session_name()])) {
     if (ctype_alnum($HTTP_COOKIE_VARS[tep_session_name()]) == false) 

 

In catalog/includes/functions/general.php find:

 

if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
     } elseif ($type == 'chars') {
       if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;
     } elseif ($type == 'digits') {
       if (preg_match('/^[0-9]$/i', $char)) $rand_value .= $char;
     }
   }

   return $rand_value;
 }


 

change to:

 

if (ctype_alnum($char)) $rand_value .= $char;
     } elseif ($type == 'chars') {
       if (ctype_alpha($char)) $rand_value .= $char;
     } elseif ($type == 'digits') {
       if (ctype_digit($char)) $rand_value .= $char;
     }
   }

   return $rand_value;
 }


Share this post


Link to post
Share on other sites

I have added some speed improvement to the catalog/includes/function/general.php file.

 

You can watch the changes here: https://github.com/acidvertigo/oscommerce2/commit/2b6b321e13e54a2fea0cfe95b03cd29b3b62fb9c

 

in my case, my parse time it was reduced from 0.686 to 0.345.

 

doesn't work for me I get unexpected T_IF in line 180 something to do with this

 if ( is_string($value) && (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key,

Share this post


Link to post
Share on other sites

doesn't work for me I get unexpected T_IF in line 180 something to do with this

 if ( is_string($value) && (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key,

I also get this fault and a similar one on line 876 (in my site)

Share this post


Link to post
Share on other sites

I also get this fault and a similar one on line 876 (in my site)

 

Is this the entire string?

 

should be:

if ( is_string($value) && (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) {

 

 

Other Improvements:

 

https://github.com/acidvertigo/oscommerce2/commit/a9c4db8a10689a635ff7f91c096e4da610df03d3

 

https://github.com/acidvertigo/oscommerce2/commit/8370c02421e785dc0fcf9f85d87803e61cda725d

 

https://github.com/acidvertigo/oscommerce2/commit/50e29d01556f44cc74a723fbe1f565db44f1f96e

Share this post


Link to post
Share on other sites

Is this the entire string?

 

should be:

if ( is_string($value) && (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) {

 

 

Other Improvements:

 

https://github.com/acidvertigo/oscommerce2/commit/a9c4db8a10689a635ff7f91c096e4da610df03d3

 

https://github.com/acidvertigo/oscommerce2/commit/8370c02421e785dc0fcf9f85d87803e61cda725d

 

https://github.com/acidvertigo/oscommerce2/commit/50e29d01556f44cc74a723fbe1f565db44f1f96e

 

This is where the fault occurs on my site (I have // the foreach out for now)

 

// Return a product ID with attributes

function tep_get_uprid($prid, $params) {

if (is_numeric($prid)) {

$uprid = (int)$prid;

if (is_array($params) && (sizeof($params) > 0)) {

$attributes_check = true;

$attributes_ids = '';

reset($params);

while (list($option, $value) = each($params)) {

//foreach($params as $key => $value {

if (is_numeric($option) && is_numeric($value)) {

$attributes_ids .= '{' . (int)$option . '}' . (int)$value;

} else {

$attributes_check = false;

break;

Share this post


Link to post
Share on other sites

This is where the fault occurs on my site (I have // the foreach out for now)

 

// Return a product ID with attributes

function tep_get_uprid($prid, $params) {

if (is_numeric($prid)) {

$uprid = (int)$prid;

if (is_array($params) && (sizeof($params) > 0)) {

$attributes_check = true;

$attributes_ids = '';

reset($params);

while (list($option, $value) = each($params)) {

//foreach($params as $key => $value {

if (is_numeric($option) && is_numeric($value)) {

$attributes_ids .= '{' . (int)$option . '}' . (int)$value;

} else {

$attributes_check = false;

break;

 

Missing parenthesis in foreach cicle

 

Should be:

 

foreach($params as $key => $value) {

 

Correct code is here: https://github.com/acidvertigo/oscommerce2/blob/master/catalog/includes/functions/general.php

Share this post


Link to post
Share on other sites

A little micro - improvement for oscommerce 2.3.1

 

I've replaced the regex function to check for alphanumerical carachters to the faster ctype php function.

 

 

In catalog/includes/functions/general.php find:

 

if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
     } elseif ($type == 'chars') {
       if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;
     } elseif ($type == 'digits') {
       if (preg_match('/^[0-9]$/i', $char)) $rand_value .= $char;
     }
   }

   return $rand_value;
 }


 

change to:

 

if (ctype_alnum($char)) $rand_value .= $char;
     } elseif ($type == 'chars') {
       if (ctype_alpha($char)) $rand_value .= $char;
     } elseif ($type == 'digits') {
       if (ctype_digit($char)) $rand_value .= $char;
     }
   }

   return $rand_value;
 }


 

I have found, that I cannot log in as a customer with this mod.

Share this post


Link to post
Share on other sites

×