WooCommerce gives a lot of freedom and is an excellent choice for building out and scaling a custom store. But no matter what platform you use, scaling takes a unique set of tools and skillset. In this talk, we will explore what it takes to build an eCommerce store that is ready to scale, and what it takes to build enterprise eCommerce websites that perform at top speeds in high-growth environments.
4. 4
UBIQUITOUS
Works anywhere WordPress
does.
Similar technical requirements and
approaches.
Those requirements create certain
constraints on what can be done out
of the box.
CONFIGURABLE
Adaptable to many situations.
EXTENSIBLE
Customizable to specific
needs.
Custom functionality can be
introduced through plugins,
extensions, and themes.
WooCommerce aims to be:
Advanced configuration allows for
integrating with Redis and
memcache, load balancing
databases and web servers, and
much more.
5. 5
Pros
• If WordPress works, WooCommerce works. No
additional access/permissions required to create new
tables (easy to get up and running in any WordPress
environment). No code-level table creation/migration
failures.
• Works the way WordPress works. Benefits from many
existing mechanisms in WordPress (caching, data access
methods, taxonomies, etc). Translates easily to using WP
List Table and other internal concepts.
Cons
Ubiquitous
• Minimal consideration for the custom storage needs of
the data (numbers, booleans, etc).
• More complex data ends up being stored using “lowest
common denominator” approach in “meta”.
• Impossible to optimize for different access models (e.g.
heavy writing vs infrequent reads).
• Data intermingled with very different data types
(posts/content, products, and orders all in a shared
space).
Leverages WordPress tables to minimize external requirements and complexity.
6. 6
wp_posts thrash
• Lots of reads and writes (posts, products, orders), all
happening in the same table.
• Different usage models can make matters even worse
(large catalog, dynamic creation of product records,
content-heavy sites, etc).
wp_postmeta inflation
Two central issues
• Similar read/write contention.
• Postmeta stores additional data for all types; posts,
products, data. Compounds meta inflation.
• Most plugins and extensions have additional data
storage needs, multiplying the problem.
• Can easily create 20x (or more) the row count from the
posts table.
Most issues we’ve seen center around the two core tables, specifically related to order volume
10. 10
Data migration
• Non-technical users ideally need to be able to migrate
data to new structure without taking their store offline.
• For any active store, that means ongoing sync (vs one-off
migration), with the ability to turn on/off repeatedly in
case anything goes wrong.
• Migration could mean anything from very small stores
with “dozens” of orders, to very large stores with millions
of orders; all on varied hosting configurations.
• We don’t actually know what all of the data is—a lot of it
is just key/value pairs.
Backwards compatibility
Major challenges
• Merchants expect to click “Update” and have everything
work. We can’t break their stores in this scenario.
• Extension developers aren’t always actively updating
their extensions.
• Endless code exists that accesses data via WP helpers
(get_post()), or worse, via direct SQL.
• We have no control over what combination of software
(WordPress, WooCommerce, plugins) people are running
on their store.
Introducing custom tables on a single, controlled store is relatively easy.
Doing it for an entire ecosystem is exponentially more difficult.
11. 11
• Long road to updating “all”
extensions and code to support
new approach.
• Eventual goal is for new stores to
all start with custom order
tables.
• Existing stores will choose if they
migrate, based on needs and
compatibility.
• Research known problems and
existing solutions.
• Proposals to community and
discussion of known issues.
• Ensure full CRUD usage
throughout core.
• Introduce new tables and data
access (via CRUD).
• Build out migration routines and
management UI.
Research, feedback, MVP
• Early access to enable developers to
adapt their extensions etc.
• Developer-oriented opt-in for testing
and verifying.
• Detailed upgrade guides for
developers.
• Prove out migration routines in
various environments.
• Refine table structure and approach
based on more real-world testing.
• Work with hosts to understand
impacts
Opt-in availability
July, 2022
Eventual default
Solution development and rollout
Update & migrate
Test & refine
Define & build
12. 12
To keep WooCommerce moving
forward, we all need to adapt to this
change. We need to hear about
problems and unique situations,
understand what works and what
doesn’t, and get detailed technical
information to help build a solution
that works for everyone.
This is a major change, and we
can’t do it without community
involvement.
• Read the announcement post. Follow our developer blog for more updates.
• Follow progress in GitHub (entire project board).
• As early as possible, help us validate the approach, and let us know where it
doesn’t apply or work for stores you manage.
• Give us detailed technical feedback about what doesn’t work, and ideally why.
• If you run stores, build extensions, or write custom order code, move to the
CRUD layer (already stable and shipping in core for years) and be prepared for
additional changes. Start thinking about if you can need custom data storage.
▪ Review the proposed table structures and make sure your data would
fit in the proposed model. If not, let us know and help us come up with
a solution that works.
• Opt-in early (on a staging server!) and test normal operations + migration.
Give us detailed feedback on what works and what doesn’t. We especially
want to know about plugins/extensions that don’t work as expected.
The road ahead
Help us,
help you
14. How ElasticPress and Instant Results can
help you scale your WooCommerce store
SENIOR FRONT END ENGINEER
10up
Jacob Peattie
15. 15
Faceted search, or faceted navigation,
refers to the ability to filter search results
by additional options, particularly when
the available options update to reflect any
filters already applied.
eg. A color filter that only shows color
options that are available for the current
category.
Faceted search
• Not well suited to search.
▪ Getting relevant results.
▪ Searching custom fields.
▪ Synonyms and misspellings.
▪ Faceted search.
• MySQL database can be difficult to scale.
• WooCommerce making improvements.
How does the WordPress
database limit WooCommerce?
16. 16
ElasticPress is a WordPress plugin developed by 10up that
brings Elasticsearch to WordPress.
Elasticsearch is a storage engine designed for search.
• Relevant results.
• Custom fields.
• Synonyms.
• Faceted search.
• Scalable.
• Fast.
ElasticPress.io is a hosted service from 10up that you can
use with the ElasticPress plugin so that you don’t need to
manage your own Elasticsearch server.
What is ElasticPress?
19. 19
By offloading queries to Elasticsearch, ElasticPress:
• Ensures more relevant search results.
• Enables new features, such as:
▪ Fast autosuggest.
▪ Synonyms.
▪ Search the contents of files.
▪ Faceted search.
• Reduces the load on your database.
How does ElasticPress work?
20. 20
• Searches still query the MySQL database.
• WordPress still needs to be loaded.
▪ Could still be slow on poor hosting or when using
poorly optimised themes and plugins.
• Search results can’t update instantly.
What are the
limitations of this
approach?
21. 21
Instant Results is a new feature of ElasticPress:
• Results loaded with AJAX into a pop-up.
• Sends search queries directly to Elasticsearch via
an ElasticPress.io API.
• See results live as you type and filter.
What is ElasticPress Instant Results?
24. 24
How this helps:
• All the benefits of ElasticPress.
▪ More relevant results.
▪ Synonyms.
▪ Faceted search.
• 600% faster search results.
• Helps scale your site.
▪ Searching and filtering products can be the most expensive queries on a site.
▪ Instant Results searches don’t hit your web server or database at all, freeing
up resources.
How does Instant Results help?
25. 25
Start Using Instant Results Today
ElasticPress
The ElasticPress plugin is free to
download from the WordPress
plugin repository.
https://wordpress.org/plugins/elasticpress/
ElasticPress.io
You can sign up for a 14 day free
trial of ElasticPress.io at the
ElasticPress website.
https://www.elasticpress.io/
29. 29
• It’s supported! PHP 5/7 isn’t.
• Performance!
• Enables better Code
• Update only on testing environment!
• You want to move to PHP 8 ASAP
• Plugins/Themes that breaks can be
indicator of performance hogs
PHP8
30. 30
• Reverse Proxy
• Not on the same server
• Closer to the visitor -> faster request
• Can also mitigate Attacks
• Your server can be offline
• Only use your server run PHP
Content Delivery Network
31. 31
Time to First Byte
How long does it
take to receive the
first data from
your site
Good
conversation
starter with your
host
Can be optimized,
but maybe
prepare to switch
hosts
Everything
influences that:
• How much is going
on the server
• How fast is PHP
• Object caching
• Cold Caches
• MySQL
32. 32
Object Cache
Server that serves
data from
Memory
Memory is faster
than disk
Memcached or
Redis Plugins for
WordPress
Perfect base to
scale to multiple
servers
WordPress will
speed up right
away
Look out for the
right Invalidation
Object caching in
code
Be careful with
Ecommerce Pages
- WP Engine is
extending this
34. 34
Hard Steps for WordPress Scaling
ElasticSearch and
Custom
Development
Write MySQL
queries on a
different server
Use a Load
Balancing
Debug your
Performance with
tools like New
Relic or
Blackfire.io
Review every line
of plugins and
themes
Exit early and
other coding
patterns
35. 35
• State of the Art Search
• WordPress is not for searching
• External Server
• Facet Search
• Weight
• Synonyms
Elastic
36. 36
Premium Dedicated Environment
• Server platform matters
• Better at delivering dynamic content (up to
40% faster over shared)
• Best for scaling
Dedicated Servers
Online Offline
SSG Gateway
WP Engine API
Attached
Storage
Onlie VM
PHP MyAdmin
Bastion Cluster
Backup Snapshot
System
from
40. 40
Review the Code
Check Data Stores to tweak
requests
https://github.com/woocommerce/woocommerce/wi
ki/Data-Stores
Custom Tables for WooCommerce
are coming
https://developer.woocommerce.com/2022/01/17/th
e-plan-for-the-woocommerce-custom-order-table/