I am preparing a OC (1.4.8) site that will have around 3-4000 categories and around 12 million products... just wondering if anyone has a similarly sized site and what (if any) performance issues were encountered...?
FWIW I have already some issues with the categories (which are quite heavily nested) build/display on the catalog index page and I needed to add an index on category.parent_id to get it to perform...
So anyone running a similar sized OC site that has any tips?
TIA
rich
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
This Is what I've found:
Caching of categories:
in catalog/controller/common/header.php
Find:
Code: Select all
$this->data['categories'] = $this->getCategories(0);
Code: Select all
$category_tree_data = $this->cache->get('categories.0');
if(!$category_tree_data) {
$category_tree_data = $this->getCategories(0);
$this->cache->set('categories.0', $category_tree_data);
}
$this->data['categories'] = $category_tree_data;
in catalog/controller/product/search.php
Find:
Code: Select all
$this->data['categories'] = $this->getCategories(0);
Code: Select all
$category_tree_data = $this->cache->get('categories.0');
if(!$category_tree_data) {
$category_tree_data = $this->getCategories(0);
$this->cache->set('categories.0', $category_tree_data);
}
$this->data['categories'] = $category_tree_data;
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Xsecrets wrote:Just out of curiosity how are you going to get that many products into the store, and what in the world are you selling with that many products? I think amazon only has about 2 million products.

Good luck, and tell us how it goes.
The data suppliers advised me below...
>>The counts for last month’s load were as follows. You can expect a slight increase.
>>US=6,518,319
>>UK=4,372,571
Incredible numbers which I too find hard to believe but there you go...
Will keep you posted, but any other tips - apart from run away...!

Rich

Once my data load process had finished the product/product_description tables have 7.1m records (a few million less than originally anticipated thankfully).
Naturally the code/database hit many brick walls with this volume of data and I have resolved many by adding indexes and denormalising where necessary and changing the database design with associated code changes.. still have loads to do I will need to integrate the OS Sphinx search engine (http://sphinxsearch.com/) for keyword searches as MySQL fulltext indexes can't really cope ...
Just want to say that OC code is very well organised and very easy to understand how it hangs together which has made my task a damned sight easier.
Fun times

Cheers
Rich
It is an extra level of hierachy that I think could really help a very big shop with both product organisation and performance.
Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products
Hi Marcellotek wrote:Hi Rich
Are there any news/updates about your performance optimizing stuff? Is it possible to see how you integrated sphinx (or available as extension?). Just curious.
bye
Marcel
Well I downloaded and compiled Sphinx v0.9.9 http://sphinxsearch.com/downloads/release/ and I also installed the sphinx client PECL extension http://pecl.php.net/package/sphinx. Then it was a case of looking at what search options were to be made available to the site user -- as my site was an online book store the search options were
Author name
Title
Multiple ISBN numbers
Publisher
Categories
Then it is a question of defining the SQL queries to obtain the required results and putting them in the sphinx configuration file so it can build the indexes based on the queries. Below is an example:-
source getProductsByPublisher
{
type = mysql
sql_host = xxxxx
sql_user = xxxxx
sql_pass = xxxxx
sql_db = xxxxx
sql_port = 3306 # optional, default is 3306
sql_sock = /tmp/mysql.sock
sql_query = \
SELECT p.product_id, m.name \
FROM product AS p \
INNER JOIN manufacturer AS m ON (m.manufacturer_id = p.manufacturer_id)
sql_query_info = \
SELECT p.product_id, m.name \
FROM product AS p \
INNER JOIN manufacturer AS m ON (m.manufacturer_id = p.manufacturer_id) \
WHERE p.product_id = $id
}
In my case as the product data is loaded by a batch process I had to rebuild the sphinx indexes after each load process using the sphinx tool as follows --> <installdir>/bin/indexer --all. Also the sphinx listener daemon (searchd) needs to be running which passes data between Opencart and the sphinx engine however it must be shutdown when the re-indexing operation is running.
Next the Opencart product model code needs to be altered to use Sphinx rather than querying the MySQL database directly -- below is an example:-
$sphinx = new SphinxClient; // Instantiate PECL client
$sphinx->setServer('hostname',9999); // Hostname and port number that searchd is listening on
$mode = (strpos($keyword,'"') !== false ? SPH_MATCH_PHRASE : SPH_MATCH_ANY); // See if a phrase is being searched for
$sphinx->setMatchMode($mode);
$sphinx->setMaxQueryTime(100);
$sphinx->setLimits(0,2000,0,0);
// Get results from sphinx
$results = $sphinx->query($keyword,'getProductsByTitle');
$results['matches'] will contain an array of product ID values of all the matching products so when the Opencart query is issued the query's 'WHERE' clause should have added 'AND product.product_id IN (999,999,999) where 999 is the imploded list of IDs returned from Sphinx. There is also a command line tool (bin/search) supplied with Sphinx to test search queries.
In my case the products table is around 8.5 million rows now and sphinx performs really well so it is definitely worth using if you have a large product table.
Hope the above is of interest!
Cheers
Rich
Not a word I use frequently, but that is awesome.rich06 wrote:Make that 12.5 million rows now....rich06 wrote:
In my case the products table is around 8.5 million rows now and sphinx performs really well so it is definitely worth using if you have a large product table.
Rich

As a side note - I'd love to see Sphinx integrated as part of Opencart some time, or maybe as an extension.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Ohh, point taken. So for technical reasons it's not a runner (as we say over here). I guess I've only read about what it can do, not how it's installed.Xsecrets wrote:Maybe an extension, but you can't integrate something they you are guaranteed almost no host will ever have installed by default into the core.
http://www.opencart.com/index.php?route ... n_id=11734
Users browsing this forum: No registered users and 62 guests