Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Migrate PHP E-Commerce Site to Go

1,013 views

Published on

Experience of migrate large PHP E-Commerce Site to Go

Published in: Technology
  • Be the first to comment

Migrate PHP E-Commerce Site to Go

  1. 1. Migrate PHP
 E-Commerce Site to Go Weng Wei, Zalora South East Asia Architect
 Dec 2013
  2. 2. Zalora South East Asia • Founded 2012 • Biggest Fashion E-Commence Site in SEA • SG MY ID HK VN TH PH BN • About 1000 employee(IT Department 40)
  3. 3. PoC start in Aug
  4. 4. 1st Release in Nov
  5. 5. Currently • 1st release has been rolled back • Restructuring, fighting for 2nd release
  6. 6. Today • Share my painful yet joyful experience
  7. 7. Original Platform • Classic LAMP • Alice: Front-end site for catalog display • Memcached / Solr • Bob: Back-end site for shopping cart & order processsing • MySQL
  8. 8. Why migrate? • PHP to memcached is fast, but php to solr… • PHP’s synchronous executing mechanism is the bottleneck • Related sharing from shooter.cn: https:// bitbucket.org/PinIdea/fcgi_ext/ (Chinese) • I enjoy challenge ^_^
  9. 9. • 1st release is experimental
  10. 10. • They said Google is “simple”, only 2 pages • zalora is two time complicate, it has 4 pages • catalog • product detail • shopping cart • payment
  11. 11. Experiment Plan • Rewrite “all 4 pages” in GO! • Maybe migrate “1 page” in GO first • nginx route different page to PHP / GO
  12. 12. nginx Alice memcache solrAll URLs BOB ZRS Tracking (GA / Webtrekk / etc) worker
  13. 13. Alice product
 cart.. catalog nginx Tracking (GA / Webtrekk / etc) Eve
 (GO) memcache solr BOB ZRS worker
  14. 14. Some Prerequisite
  15. 15. Compatible with PHP stack • Support PHP serialisation/deserialisation in GO • https://github.com/Wuvist/gophpserialize • https://github.com/Wuvist/gophpserialize/pull/1
  16. 16. Risk Management • Go / PHP stack co-exist • Go Deployment requite no code change at PHP stack • Separate deployment for Go • nginx switch • Go live & rollback at anytime
  17. 17. PM’s request • user experience of catalog page need improvement • PM:”Give me AJAX…”
  18. 18. Look Good • Step by step improvement • Improve user experience: meet PM’s need • Migrate tech stack: R & D like challenge
  19. 19. Ambitious Plan • Split Alice PHP(Alice): • AngularJS (Eve) Front-end MVVM • GO (Costa) Back-end API
  20. 20. No more PHP • AngularJS for all page rendering • GO for all API
  21. 21. • Everything was good, GO live! • Until I took an arrow on my knee • Until I share the new page link to Facebook
  22. 22. OpenGraph • Unlike Google Plus, FB crawler doesn’t support AJAX • All FB OpenGraph meta(title / text / picture) are wrong • OpenGraph is important to marketing
  23. 23. • AngularJS + Go API architecture is not design to support such case • Eve (AngularJS) approach can’t be used
  24. 24. Other Concern • Why AngularJS? Can’t just jQuery? • PHP page rendering is fast
  25. 25. Costa (GO) is cool
  26. 26. 2nd Release • PHP + GO, targeted mid Dec • No AngularJS
  27. 27. Experience • “Think more before do” • PHP is good for what it does • Team consensus is more important • Better understanding of Go’s potential
  28. 28. • New department for migrate back-end modules
  29. 29. Go’s potential • GroupCache (Migrate Memcached) • Shopping Cart • Order Processing • Full Page cache on CDN
  30. 30. Q & A

×