WordPress Migration and Server Optimization for News & Market

rtCamp migrated News&Market’s WooCommerce powered WordPress multisite setup to a new and optimized server without losing any historical data and with zero downtime.

About the Client

Established in Taiwan in 2011, News&Market is an innovative online platform and was the first site in Taiwan devoted to reporting issues in agriculture, food safety and environmental justice in urban and rural communities.

A source of timely reporting, News&Market also needed a platform to promote environmentally friendly products, taking faith in the transformative potentials of consumer mobilization in the larger context of the market economy.

WordPress migration for News & Market

When rtCamp started on the project, News&Market had a subdirectory WordPress multisite setup with 10 subsites. The primary site was used for publishing news posts, while one of the subsites was running a WooCommerce powered shop. The shop had more than 550 products and an order history of more than 50,000 orders.

Running on a Linode server with outdated Nginx, MySQL and PHP versions, the site was constantly slow. CPU usage was high even during reasonable traffic, with occasional downtime. Updating a product from the backend resulted in >1 minute wait times.

Finally, the site was running outdated versions of WordPress, WooCommerce and over 150 plugins.

Site Cleanup

rtCamp started the project by setting up a new Linode server with the latest version of EasyEngine, our open-source server management tool. All the server-side software, including WordPress, WooCommerce and other plugins were updated to their latest versions.

The existing multisite was then cloned to this newly set up server. rtCamp then tested all the critical features and shop functionality, fixing anything that broke because of the updates.

rtCamp also worked with News&Market to review the plugins in use and remove more than 50 plugins whose functionality could easily be replicated via custom code. NewRelic was set up to monitor error logs and database queries.

Migration

rtCamp started the migration process by re-importing the content and database from the old server to new server. WooCommerce shop pages were configured to use pretty permalinks instead of the default WordPress permalinks, which made them easier to cache.

WooCommerce sets a session cookie for every new visitor by default. If a cookie header gets cached in Nginx’s fastcgi-cache, that cookie will be delivered to all visitors creating “session-conflict” or “cart-conflict”. This can cause one user’s cart items to appear in another visitor’s cart.

rtCamp used a custom variable to set a unique value for each shopping session and avoid any potential conflicts.

Since any store can receive orders around the clock, migrating without downtime is particularly important. rtCamp made the old server a reverse proxy for the new server, effectively switching them with zero downtime.

Server Optimization

In order to speed up site performance, rtCamp implemented some server-side optimisations.

  • Adding AWS Cloudfront for CDN.
  • Optimizing MySQL queries and adding indexes to database tables, guided by NewRelic data and MySQLTuner.
  • Switching to native Linux cron to deal with external an ERP system over its API.


Since these optimizations have taken effect, the site has been able to cope with several spikes without any downtime. The WordPress backend has become fully usable and loads much quicker than before. Server CPU load is predictable even under sustained traffic.

The WooCommerce store migration was completed without losing any historical data and with zero downtime.