Upload
spark-solutions
View
2.666
Download
0
Embed Size (px)
Citation preview
Powered by
Me llamo MiguelI do this
My Team
“Mermaid Tucker”
#[email protected] @mtazva
Online StoreThe Pit of Success
[Powered by
Spree]
Why Spree?
● Easily Customizable
● Fully Featured
● Existing API
● Highly Extensible
● Great Community!
by developersfor developers
Simplifying the Experience● Grid-based options building● Simple customization via themes engine● Automatic PayPal activation● Automatic domain management● Automatic SSL management● Automatic label printing● Hiding the dirty details
Magnifying the Impact● Automatic email marketing integration● Simple and automatic Facebook store● One-click product reviews engine
SaaS-ification● Multi-tenancy● Themes engine● Internal integrations (single sign-on, domains, others)● GoDaddy branding
We are the 1%
Making the SaleGet Published
Making the SaleGet Social!
Scaling Spree - Tech Stack● CentOS 6● Ruby 2.2● Ceph (internal cloud storage)● Github / GHE● Jenkins for CI/CD● Puppet● Hadoop● StatsD and Graphite● NewRelic● SumoLogic● Honeybadger
● Apache Traffic Server 5.3● HAProxy 1.5● Apache 2.2● Unicorn 4.9● Rails 4.1 [https://github.com/spree/spree/pull/7192]
● Spree 2.2● Bootstrap 3● React 0.14● Delayed Job● Memcached● MySql 5.5● Akamai CDN
Scaling Spree - ArchitectureA10
CommonDB
API(4)
App(6)
MerchantDB
ATS
HAProxy
ATS
HAProxy
ATS
HAProxy
ATS
HAProxy
SSL Termination
Redundancy
Horizontal Scaling
Context-specific dataGlobal metadata
Job(4)
Memcached(4)
Scaling Spree - Performance● 10s of thousands of unique live storefronts● ~1.5M page views per day● Average page response time ~2.5s● Average server response ~300ms● Capable of ~400rps per app server before performance degrades● >99.99% uptime
The ActiveRecord Callbacks Problem● Obscure business logic. Explicit => Implicit● Often have unintended side effects● Require deep understanding of AR internals● Can cause a chain reaction performance nightmare
that!
The AR Callbacks Problem
Option Type Product
Taxonomy
Taxon
Option Value1:1 1:M
1:M
1:M
Variant
1:M1:1
parent
Variant
Product
Taxonomy
Taxon
belongs_to :option_type,touch: trueafter_touch :touch_all_variants after_touch :touch_all_produ
cts
belongs_to :product, touch: true
after_save :run_touch_callbacksafter_touch :touch_taxons after_touch :touch_parent
Yo DawgI heard you like ActiveRecord Callbacks
So I added a callback that will call you backWhen your callback calls my callback
The AR Callbacks Problem
A Stop Gap Solutionhttps://github.com/godaddy/activerecord-delay_touching
ActiveRecord::Base.delay_touching do # touch_all_the_thingsend
The AR Callbacks ProblemWhat do we do?
Be more explicit with Service Objects
OptionValueUpdater.new(option_value).call
● Explicit, clear business logic● No hidden side effects● No magic to understand● Aggregation of bulk updates
My time with Rails is up (Piotr Solnica)http://solnic.eu/2016/05/22/my-time-with-rails-is-up.html
“People are attracted by Rails because it gives you a false sense of simplicity, whereas what really happens is that complexity is being hidden by convenient interfaces. [...] ActiveRecord is just one, representative example, [...].”
All Things in Moderation
Rails has won: The Elephant in the Room (Fabio Akita)http://www.akitaonrails.com/2016/05/23/rails-has-won-the-elephant-in-the-room “[…] for all intents and purposes, Active Record still does much better than average. But if you're big, you should be careful. That's all.”
Spree Wish ListImprove Order Consistency● Do not trigger order recalculation once complete (or at least be more
explicit)○ Some operations can cause completed orders to be recalculated
● Snapshot product details on orders○ Modifying product information is reflected in completed orders
TIME CHECK
Spree Wish ListMaintain Clear Upgrade Paths● Semantic versioning ● Non-breaking data migrations● Upgrades without downtime
Spree Wish ListPreview/Publish Mechanism● Allow site changes to be staged and viewed before making live
Spree Wish ListSimplify Customization● Better hooks for overriding flows and replacing features
○ Dependency Injection○ Configurable Service Locators○ Integration Hooks in Service Objects
Spree Wish ListSupport Automated Integrations● First class application marketplace
○ Engine to plugin extensions without development work○ Oauth-based activation and requirements-based authorization
■ Generates unique, role-based api users
Spree :)
Spree Wish ListKeep on Being You!!● Retain a helpful and collaborative community● Share and learn from each other
At GoDaddywe're pulling for small business.Help us transform the global economy, one entrepreneur at a time.