In the previous article I loaded Magento 2 (M2) with 1M+ SKUs. Today I will benchmark M2 against another open source eCommerce platform - WooCommerce (WM). We will compare how efficient these two frameworks handle more than 1 million unique products.
Disclaimer: M2 and WM are two different platforms designed for different needs. It is not technically correct to compare them. Magento 2 is a lot more complex and feature-rich than WooCommerce. Still there are times when one needs to decide between M2 and WM and this article might help him/her make the right decision.
Initial Installation
WooCommerce is a WordPress (WP) plugin. That said we need to install WP first.
WP installation is all automatic (like Magento). You follow the instructions and a setup script does all the work for you.
Once WP installed WM installation is just a matter of seconds. You download and copy WooCommerce module to plugins folder and activate it in WordPress backend dashboard.
How to Generate 1M SKUs for WooCommerce
How to load Magento 2 with 1M products was shown in one of my previous blog posts. Now I show to repeat the procedure for WooCommerce.
This task is pretty easy but might take a while. First we create a simple script uploadRandom.php:
<?php if (php_sapi_name() !== 'cli') { die('This script is meant to be run from the command line'); } set_time_limit(0); ini_set('max_execution_time',0); function find_wordpress_base_path() { $dir = dirname(__FILE__); do { if( file_exists($dir."/wp-config.php") ) { return $dir; } }while($dir = realpath("$dir/..")); return null; } function generateRandomString($length = 7) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[mt_rand(0, $charactersLength - 1)]; } return $randomString; } define('BASE_PATH', find_wordpress_base_path()."/"); define('WP_USE_THEMES', false); global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header; require(BASE_PATH.'wp-load.php'); for($i = 1; $i < 1000000; $i++){ try{ $sku = generateRandomString(); $price = 99.99; $post_id = wp_insert_post(array( 'post_title' => $sku , 'post_content' => 'Imported Product Content' , 'post_status' => 'publish' , 'post_type' => 'product' )); wp_set_object_terms($post_id,'simple','product_type'); update_post_meta( $post_id, '_visibility', 'visible' ); update_post_meta( $post_id, '_stock_status', 'instock'); update_post_meta( $post_id, 'total_sales', '0' ); update_post_meta( $post_id, '_downloadable', 'no' ); update_post_meta( $post_id, '_virtual', 'no' ); update_post_meta( $post_id, '_regular_price', $price ); update_post_meta( $post_id, '_sale_price', '' ); update_post_meta( $post_id, '_purchase_note', '' ); update_post_meta( $post_id, '_featured', 'no' ); update_post_meta( $post_id, '_weight', '' ); update_post_meta( $post_id, '_length', '' ); update_post_meta( $post_id, '_width', '' ); update_post_meta( $post_id, '_height', '' ); update_post_meta( $post_id, '_sku', $sku ); update_post_meta( $post_id, '_sale_price_dates_from', '' ); update_post_meta( $post_id, '_sale_price_dates_to', '' ); update_post_meta( $post_id, '_price', (float)$price ); update_post_meta( $post_id, '_sold_individually', 'yes' ); update_post_meta( $post_id, '_manage_stock', 'yes' ); update_post_meta( $post_id, '_backorders', 'no' ); update_post_meta( $post_id, '_stock', '100' ); echo ($sku." generatedn"); }catch(Exception $e){echo ($e->getMessage()."n");} }
The program is pretty self-explanatory. The function generateRandomString is used to create unique SKUs. The rest is just how you initialize WordPress and insert a simple product. I found it somewhere on StackExchange Q&A site.
Of course this script is not fast and on my 6 CPU core server it takes 3 sec to generate a new product or around 30k items per day. Not impressive when you have to have 1 million of them.
So I decided to introduce parallel computing concept to my experiment. I copied uploadRandom.php to uploadRandom2.php, uploadRandom3.php and uploadRandom4.php and changed SKU length so that there would be no duplicates:
$sku = generateRandomString(11); //I used 11,8,9 and 7
I started the scripts simultaneously and they were creating 120k products per day. I tried to add more scripts but the generation speed dropped so I kept just four of them.
It took around 10 days to finally have 1M+ simple products in the WooCommerce website.
Then I could begin to benchmark Magento 2 against WM.
Magento 2 vs WooCommerce Performance Benchmark
First I compared backend page speed. Since M2 loaded data with ajax calls I measured the full page load time of both platforms. I used Google Chrome Developer Tools to gather performance results.
Catalog > Products looked like this:
We can see M2 is almost 3 times faster than WooCommerce (we also see that M2 backend is not mobile friendly, unlike WM's one). And that was even true taking into account M2 had more products (1.4M) than WM (1.1M).
What happens with individual simple product edit pages?
Here WM is slightly faster.
Let's move on to frontend benchmarks. M2 has full page cache (FPC) functionality for frontend pages. WooCommerce doesn't. I would have to turn M2 FPC of to make the frameworks even.
php bin/magento cache:disable full_page Changed cache status: full_page: 1 -> 0
Catalog page results are here:
We see a catalog page loads in approximately the same amount of seconds.
What about a product page? Here are the results for a simple type item:
WooCommerce serves simple products slightly faster.
Let's try and compare the adding to cart functionality. I added a simple product to the cart and measured the time:
Magento 2 is a lot slower in that case. Indeed when you browse a WooCommerce site and add things to the cart it seems faster as compared to M2. Partly because WM cart area is simpler.
Checkout works better for WM as well:
As we can see WM's checkout is 2 times faster than M2's one.
Browsing Experience
Overall WooCommerce feels faster on frontend but slower in admin panel. When you try to checkout Magento 2 with 1 million products is just too slow to be used for production. Of course I am talking about a stock installation - I am sure it can be tuned to be super fast.
Benchmark Summary
Both Magento 2 and WooCommerce can handle huge number of unique products. M2 manages 1 million product faster in backend whereas WM is faster on frontend.
Still I can't say which one of the two frameworks is better for 1M SKUs. The choice depends purely on one's requirements. Magento 2 seems more flexible but WooCommerce is simpler and that always leads to a better performance.
Find this article useful? Share it on LinkedIn with your professional network, spread the knowledge!
If you find this post interesting do not hesitate to sign up for our newsletter and join the 1666 people who receive Magento news, tips and tricks regularly.
Thank You!
It's not fair comparison. What is the purpose of benchmarking frontend? It's so easy to cache this page so will not affect performance.
The real performance is when you compare "orders per minute". How many OPM both platform can handle?
I'm sure woocommerce will be left very very far behind. Because when creating order woocommerce add more than 50 row of postmeta to the table. Compare that to other ecommerce which have only couple row of data.
Found this article on google, great write up! Would love to see what speeds both sites can do when optimized
@Amine, I can't really say, I haven't tested.
Hi
What about 3 million categories
Is that possible for woocommerce?
Magento 2 really sux.
They think they are using Java.