wix architecture at scale
play

Wix Architecture at Scale Aviran Mordo Head of Back-End Engineering - PowerPoint PPT Presentation

Wix Architecture at Scale Aviran Mordo Head of Back-End Engineering @ Wix @aviranm linkedin.com/in/aviran aviransplace.com Wix in Numbers Over 45,000,000 users 1M new users/month Static storage is >800TB of data 1.5TB new files/day 3


  1. Wix Architecture at Scale Aviran Mordo Head of Back-End Engineering @ Wix @aviranm linkedin.com/in/aviran aviransplace.com

  2. Wix in Numbers Over 45,000,000 users 1M new users/month Static storage is >800TB of data 1.5TB new files/day 3 data centers + 2 clouds (Google, Amazon) 300 servers 700M HTTP requests/day 600 people work at Wix, of which ~ 200 in R&D

  3. Initial Architecture Tomcat, Hibernate, custom web framework Built for fast development Stateful login (Tomcat session), Ehcache, file uploads No consideration for performance, scalability and testing Intended for short-term use Wix Lighttpd MySQL (file serving) (Tomcat) DB

  4. The Monolithic Giant One monolithic server that handled everything Dependency between features Changes in unrelated areas of the system caused deployment of the whole system Failure in unrelated areas will cause system wide downtime

  5. Breaking the System Apart

  6. Concerns and SLA Edit websites View sites, created Serving Media by Wix editor Data Validation High availability High availability Security / Authentication High performance High performance Data consistency High traffic volume Lots of static files Lots of data Long tail Very high traffic volume Viewport optimization Cacheable data

  7. Wix Segmentation Networking 2. Media Segment 1. Editor Segment 3. Public Segment

  8. Making SOA Guidelines Each service has its own database (if one is needed) Only one service can write to a specific DB There may be additional read-only services that directly accesses the DB (for performance reasons) Services are stateless No DB transactions Cache is not a building block, but an optimization

  9. 1. Editor Segment

  10. Editor Server Immutable JSON pages (~2.5M / day) Site revisions Active – standby MySQL cross datacenters Editor Server MySQL MySQL Active Archive Sites

  11. Protect The Data Protect against DB outage with fast recovery = replication Protect against data poisoning/corruption = revisions / backup Make the data available at all times = data distribution to multiple locations / providers

  12. Saving Editor Data Save Page(s) Upload Editor Static Browser 200 OK Server Grid Notify Download Page Save Page Notify Archive Archive (Google) (Amazon) MySQL MySQL Active Active DC replication Sites Sites MySQL Google MySQL Archive Cloud Archive Storage

  13. Self Healing Process Save Page(s) Upload Editor Static Browser 200 OK Server Grid Notify Download Page Save Page Notify Archive Archive (Google) (Amazon) MySQL MySQL Active Active DC replication Sites Sites MySQL Google MySQL Archive Cloud Archive Storage

  14. No DB Transactions Save each page (JSON) as an atomic operation Page ID is a content based hash (immutable/idempotent) Finalize transaction by sending site header (list of pages) Can generate orphaned pages, not a problem in practice

  15. 2. Media Segment

  16. Prospero – Wix Media Storage 800TB user media files 3M files uploaded daily 500M metadata records Dynamic media processing • Picture resize, crop and sharpen “on the fly” • Watermark • Audio format conversion

  17. Prospero Eventual consistent distributed file system Multi datacenter aware Automatic fallback cross DC Run on commodity servers & cloud

  18. Prospero – Wix Media Manager Tampa Google Cloud x36 T x36 T x32 Second fallback First fallback Austin If not in CDN CDN x36 Tx36 get image.jpg T x32

  19. 3. Public Segment

  20. Public Segment Roles Routing (resolve URLs) www.example.com Dispatching (to a renderer) HTML HTML SEO Renderer Renderer Rendering (HTML,XML,TXT) Flash Public Flash SEO Renderer Server Renderer Sitemap Robots.txt Renderer Renderer

  21. Public SLA Response time <100ms at peak traffic

  22. Publish A Site Publish site header (a map of pages for a site) Publish routing table Publish site header / routes Editor Segment Public Segment

  23. Built For Speed Minimize out-of-service hops (2 DB, 1 RPC) Lookup tables are cached in memory, updated every 5 minutes Denormalized data – optimize for read by primary key (MySQL) Minimize business logic

  24. How a Page Gets Rendered Bootstrap HTML template that contains only data Only JavaScript imports JSON data (site-header + dynamic data) No “real” HTML view

  25. Offload rendering work to the browser

  26. The average Intel Core i750 can push up to 7 GFLOPS without overclocking

  27. Why JSON? Easy to parse in JavaScript and Java/Scala Fairly compact text format Highly compressible (5:1 even for small payloads) Easy to fix rendering bugs (just deploy a new client code)

  28. Minimum Number of Public Servers Needed to Serve 45M Sites 4

  29. Public SLA Be Available 99.99999%

  30. Serving a Site – Sunny Day Browser Resources / Media CDN Statics http://example.wix.com Notify HTTP HTML site view Request HTTP Request Archive LB Store HTML to cache Public Renderer

  31. Serving a Site – DC Lost Browser CDN Statics http://example.wix.com HTTP Request Archive LB LB Public Public Renderer Renderer Change DNS

  32. Serving a Site – Public Lost Browser CDN Statics http://example.wix.com HTTP HTML Request Get Cached HTML Version Archive LB Public Renderer

  33. Living in the Browser JSON / Media Browser CDN Statics http://example.wix.com HTTP Fallback HTML Request Archive Fallback LB Editor Public Renderer

  34. Summary Identify your critical path and concerns Build redundancy in critical path (for availability) De-normalize data (for performance) Minimize out-of-process hops (for performance) Take advantage of client’s CPU power

  35. Q&A http://goo.gl/Oo3lGr Aviran Mordo Head of Back-End Engineering @ Wix @aviranm linkedin.com/in/aviran aviransplace.com

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend