Goals
- Identify Areas of Performance Problems
- Prioritize by Pain
- Short Term Fixes
- Long term Fixes
- Bencharks measurements
Areas of Performance Problems
- touching
- cascade of touching
- callbacks
- after_save, after_update
- state matchine transitions
- poor performing DB queries
- missing index
- order.update!, order.reload
- delete & recreate shipments (for no reason)
- delete & recreate adjustments (for no reason)
- adjustments & promotions
- very slow
- recalculation triggered too foten
- N + 1 queries
- Preferences & Configuration
Top 4 things that cause us problems
- order.update! & reload
- adjustments & promotions
- callbacks
- touching
Short Term Fixes
-
order.update! & reload
- less persistence
- what is the correct order of all calculations?
- what do we actually need to update?
- can we wait to persist things?
-
adjustments & promotions
- recalculate in memory
- persist only if changed
- investigate storing order data in cache
-
callbacks
- catalogue where & why?
- look by class (Order + children, Product + children)
- remove unnecessary
- simplify if possible
- do the same by checkout_flow
-
touching
- delay touch gem
- review if touches are needed
Long Term Fixes
-
order.update! & reload
- splite persistence from logic
- delay insertion until last possible moment
- eliminate the state machine
- improve the state maching & prevent bypassing
- eliminate order.reloads
- re-write controller
- eliminiate need for while order.next
-
adjustments & promotions
- explicitly define tax & shipping rather than grouping into adjustments
- delay insertion until last possible moment
- make the API better and use it internally
-
callbacks
- move to a set of service objects
- stop contributors from adding more callbacks
-
touching
- get support in Rails for delayed touching
- improve delay touch gem to batch update all records in a table
Benchmark Measurements
- What is important to be fast?
- checkout (start to finish)
- with promos, taxes, zones, multiple stock locations, etc.
- producxt create (with Variants)
- product show
- add to cart
- update cart
- promo recalculate
- home page
- checkout (start to finish)
- Tools for measuring performance
- flood & blits with JMeter scipts
- Investigate CI query reporting
- Target Benchmarks
- memory footprint
- average response time
Misc. Stuff
- active Job
- admin searcher class
- cart_link
- review configs that shouldbe on store
- index guest token
- country & state cache