A wee venting on the Challenge 30. Where to begin?  [image source](http://ift.tt/2iOFNPb) We have a client that has a WordPress website. They sell all kinds of products to a range of businesses. They wanted an eCommerce solution that runs on Wordpress that will also talk to their financial database. No problem. WooCommerce will do pretty much what they want – except talk to their database. That’s where I come in. I wrote a bridge that lets the website be managed from the financial database. i.e. products, orders, customers etc can all be managed from the back end, mostly automatically. We made up a development server, I did the coding, put it up, got it talking and playing nicely with everyone. It was pretty cool. A salesperson could walk down an isle with a scanner, scan a barcode and hit a button to place an order. Sweet! The client was happy, the boss was happy, I was happy. Time to make it all live. That’s when happiness ended. It turns out the live data is different from the test data – it’s larger and more complex by a magnitude of over 4 times. So the server has to do more than 4 times the work it had to do on the test server (and it was already creaking then!). WooCommerce is probably quite good if it is used as intended – managing a single record at a time. But I’m trying to bulk load an entire catalogue and I can’t even get the first page to load without it crashing the server and being spat out again. To give you some idea, each product inserts 43 records into the main table – one as the main product the rest for the different variations. For each main product - it inserts 47 records into a settings table - And 42 records into a categories table For each variation of a product - it inserts 17 records into the settings table - And 1 record into the categories table So for each product ‘set’ the code has to execute at a minimum: - 1 main record + 47 settings records plus 42 category records plus 42 variation records plus 42 x 17 settings records plus one category record That adds up to around 630 queries for each ‘product set’. Multiply that by 60 products per page of data from the financial database and you get 37800 queries. **That’s a staggering amount!** Now multiply that by 29 pages (1096200 queries!) and you can see why the server was not overly happy about it. And that is done as efficiently as I can. The WooCommerce plugin is designed to work with a single product at once, so there are no optimisations at all in it. So I spent a bunch of time before Christmas and over the last couple of days trying to essentially reverse engineer the plugin and do the import in a way that the database can handle. I got this all working today (I think) on my development machine, happy with that! I uploaded it to the server and nothing happened. No error messages, nothing. After much digging around I find out that the server configuration itself is different and my code won’t run on it. So I’m going to have a cup of tea (because I don’t smoke… yet) and sit in the sun for a bit. These are the days when I wish I was back working on the pig farm. Your boots might be covered in pig poo, but at the end of the day you could have a shower and go home and forget about it. I have to have this fixed by Monday at the latest, or I’m in stinky brown stuff up to my neck, and a shower won’t fix that. ### But on the plus side… My knees and legs don’t hurt too much after yesterday’s run. I think they are finally starting to get the hang of it. So I’ll keep on with the stretching and keep on with the running, and of course I’ll keep on Steeming. Hope you all had a good Friday. ---- Are you new to Steemit and trying to figure out what it's all about? Head over to: http://ift.tt/2gpEq4t. It's the best place to get a handle on what the platform is all about. ---- | Steem Power | Curation | Reputation | Posts | Powering up | | --------- | --------------| --------------| -------------- | ---------- | http://ift.tt/2izp8fC | http://ift.tt/2hBMvXw | http://ift.tt/2iqT51e |http://ift.tt/2hC7Qjh | http://ift.tt/2hE8iPb | Get your own badges from: http://ift.tt/2b7qhpH http://ift.tt/eA8V8J http://ift.tt/2ihUDdr
ADS HERE !!!