Difference between revisions of "X-Cart:Performance tips"

From X-Cart 4 Classic
Jump to: navigation, search
Line 51: Line 51:
 
Execute the following sql query for each x-cart table
 
Execute the following sql query for each x-cart table
  
 +
<pre>
 
OPTIMIZE TABLE <table_name>;
 
OPTIMIZE TABLE <table_name>;
 +
</pre>
  
 
where replace <table_name> with the name of a table. You will find the list of x-cart tables using the next sql query:
 
where replace <table_name> with the name of a table. You will find the list of x-cart tables using the next sql query:
  
 +
<pre>
 
SHOW TABLES;
 
SHOW TABLES;
 +
</pre>
  
 
For v.4.1.x:
 
For v.4.1.x:
Line 69: Line 73:
 
You may try to put the following lines in the php.ini file:
 
You may try to put the following lines in the php.ini file:
  
<code>
+
<pre>
 
output_handler =
 
output_handler =
 
zlib.output_compression = On
 
zlib.output_compression = On
 
zlib.output_compression_level = 1
 
zlib.output_compression_level = 1
</code>
+
<pre>
  
 
You can put any figure in the compression level between -1 and 9, just muck around and see what works best for your particular store.
 
You can put any figure in the compression level between -1 and 9, just muck around and see what works best for your particular store.
Line 79: Line 83:
 
Or if you are using Apache server and .htaccess files are enabled you may try to add
 
Or if you are using Apache server and .htaccess files are enabled you may try to add
  
<code>
+
<pre>
 
php_flag zlib.output_compression On
 
php_flag zlib.output_compression On
</code>
+
</pre>
  
 
to the .htaccess in the store root.
 
to the .htaccess in the store root.
Line 97: Line 101:
 
Search engines may crawl your site and cause a performance degradation. You may slow down the robots crawling your site by adding the following line into robots.txt file (in the root of your web site):
 
Search engines may crawl your site and cause a performance degradation. You may slow down the robots crawling your site by adding the following line into robots.txt file (in the root of your web site):
  
<code>
+
<pre>
 
User-Agent: *
 
User-Agent: *
 
Crawl-Delay: 10
 
Crawl-Delay: 10
</code>
+
</pre>
  
 
[[Category:X-Cart developer guide]]
 
[[Category:X-Cart developer guide]]
 
[[Category:Troubleshooting]]
 
[[Category:Troubleshooting]]

Revision as of 12:25, 8 January 2010

There are several options that may help you to speed up site. Try them out first.

1. Moving images to file system. For v.3.5.x and 4.0.x

Move images from database to file system: admin zone -> ‘Images location’ (‘Store images in’, choose ‘File system’) After that modify original .htaccess file (in /files directory): change the code to

<FilesMatch "\.(gif|jpe?g|png|GIF|JPE?G|PNG)$"> Allow from all </FilesMatch> Deny from all

2. Toggling off atracking statistics

For v3.4.x:

in the customer/auth.php file, make the line

include "../include/atracking.php";

as follow:

#include "../include/atracking.php";

For v3.5.x and 4.0.x:

the statistics is disabled via admin zone, 'General settings': uncheck 'Enable tracking statistics gathering' field.

For v.4.1.x:

the statistics is disabled via admin zone, 'General settings/Advanced Statistics options': uncheck 'Enable tracking statistics gathering' field.

3. Cleaning statistics tables

For v.3.5.x and 4.0.x.

In the admin back-end of x-cart: ‘Summary’ page - > ‘Statistics clearing’.

For v.4.1.x: Statistics can be cleared via admin area: 'Summary' page, section 'Tools/Statistics clearing'.

4. Optimizing sql tables

For v.3.5.x and 4.0.x

Execute the following sql query for each x-cart table

OPTIMIZE TABLE <table_name>;

where replace <table_name> with the name of a table. You will find the list of x-cart tables using the next sql query:

SHOW TABLES;

For v.4.1.x:

tables are optimized via admin area: page 'Summary', section 'Tools/Optimize tables'.

5. Generating HTML catalog

Additionally, it is advisable to create HTML catalog. After generation of HTML catalog, your customer zone is presented as a set of static pages linked together without actual PHP scripts execution and database queries. It may significantly lower loading of your server.

6. Compression of html source

You may try to put the following lines in the php.ini file:

output_handler =
zlib.output_compression = On
zlib.output_compression_level = 1
<pre>

You can put any figure in the compression level between -1 and 9, just muck around and see what works best for your particular store.

Or if you are using Apache server and .htaccess files are enabled you may try to add

<pre>
php_flag zlib.output_compression On

to the .htaccess in the store root.

7. Installing Zend Optimizer

You can install Zend Optimizer (http://zend.com/store/products/zend-optimizer.php)

8. Installing mod_deflate

You may ask your hosting administrators to install mod_deflate (Apache 2.0.x) or mod_gzip (Apache 1.3.x).

9. Slow down SE crawlers

Search engines may crawl your site and cause a performance degradation. You may slow down the robots crawling your site by adding the following line into robots.txt file (in the root of your web site):

User-Agent: *
Crawl-Delay: 10