braffas Posted June 2, 2017 Posted June 2, 2017 I just wanted to say thank you to the 30bz team. I was thrilled when i first learned about the project 2 weeks ago, and now our shop has finally migrated to 30bz :) The migration gave me no problems with the modules i wrote myself, and only minor problems with some of the modules i purchased. We ship about 250 orders each days, and we got around 200k products in the database, and i must say, 30bz runs like a dream! So thank you so much for turning this project in the right direction. Keep up the good work!
Briljander Posted June 8, 2017 Posted June 8, 2017 Wow, 200k products. Thought that was almost impossible due to slowness? What is your setup?
braffas Posted June 8, 2017 Author Posted June 8, 2017 Production server is a dedicated box with 64gb / E5-1650 Running: Debian 8 / Apache 2.4 / PHP 5.6 (FPM) / Mariadb 10.1 / Redis 3.2.9 The shop also runs fine with the same setup on a 2gb Vagrant box (what i use for development). I had to do overrides to some core classes and tweak some modules to make it work with 200k products. Mostly limits to ajax calls / pagination (back office) One thing i had to change after migrating to 30bz was the way that supplier and manufacturer rewrites are handled. That slowed down the site quite a bit (on those pages). i will post the change i made when i get back to work, since it may be useful for someone else with 40k+ manufactures / suppliers.
Briljander Posted June 8, 2017 Posted June 8, 2017 @braffas Tack för svar! Nice to hear that it works good. I don't have that many orders or products (yet) but my goal is to have 200k+ searchable products.
braffas Posted June 9, 2017 Author Posted June 9, 2017 @mdekker It's mainly the database lookup (this call getManufacturers) i fixed it by adding cache to the lookup in these 2 methods (below) I delete the all cache every morning after our automatic updates. But one could delete the rewrites from cache on the manufacturer / supplier update/add hooks Another solution (probably better for compatibility) would adding the rewrite directly to the the manufacturer/supplier tables. (maybe in a future 30bz update? :)) Original versions (in Dispatcher.php) protected function supplierID($rewrite) { // Rewrite cannot be empty if (empty($rewrite)) { return 0; } $context = Context::getContext(); $suppliers = Supplier::getSuppliers(false, $context->language->id, true); foreach ($suppliers as $supplier) { if (Tools::link_rewrite($supplier['name']) === $rewrite) { return (int) $supplier['id_supplier']; } } return 0; } protected function manufacturerID($rewrite) { // Rewrite cannot be empty if (empty($rewrite)) { return 0; } $context = Context::getContext(); $manufacturers = Manufacturer::getManufacturers(false, $context->language->id, true); foreach ($manufacturers as $manufacturer) { if (Tools::link_rewrite($manufacturer['name']) === $rewrite) { return (int) $manufacturer['id_manufacturer']; } } return 0; } My overrides with cache. Speed increase ~3 sec to ~0.90 protected function manufacturerID($rewrite) { if (empty($rewrite)) { return 0; } $context = Context::getContext(); if (!$manufacturer_rewrites = Cache::getInstance()->get('manufacturer_rewrites')) { $manufacturers = Manufacturer::getManufacturers(false, $context->language->id, true); foreach ($manufacturers as $manufacturer) { $manufacturer_rewrites[Tools::link_rewrite($manufacturer['name'])] = $manufacturer['id_manufacturer']; } Cache::getInstance()->set("manufacturer_rewrites", $manufacturer_rewrites, 86400); } $id_manufacturer = (int)$manufacturer_rewrites[$rewrite]; return $id_manufacturer; } protected function supplierID($rewrite) { if (empty($rewrite)) { return 0; } $context = Context::getContext(); if (!$supplier_rewrites = Cache::getInstance()->get('supplier_rewrites')) { $suppliers = Supplier::getSuppliers(false, $context->language->id, true); foreach ($suppliers as $supplier) { $supplier_rewrites[Tools::link_rewrite($supplier['name'])] = $supplier['id_supplier']; } Cache::getInstance()->set("supplier_rewrites", $supplier_rewrites, 86400); } $id_supplier = (int)$supplier_rewrites[$rewrite]; return $id_supplier; }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now