Successfully reported this slideshow.

Project Phoenix - From PHP to the Play Framework in 3 months

0

Share

Loading in …3
×
1 of 63
1 of 63

Project Phoenix - From PHP to the Play Framework in 3 months

0

Share

Download to read offline

This is an experience report about Project Phoenix, aiming at porting a platform to the Play Framework with Scala in the short time period of 3 months. The presentation was given at Devoxx UK 2014

This is an experience report about Project Phoenix, aiming at porting a platform to the Play Framework with Scala in the short time period of 3 months. The presentation was given at Devoxx UK 2014

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Project Phoenix - From PHP to the Play Framework in 3 months

  1. 1. @elmanu#playframework From PHP to the Play Framework in 3 months Manuel Bernhardt @elmanu http://manuel.bernhardt.io
  2. 2. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  3. 3. @elmanu#playframework Your speaker •Freelance software consultant based in Vienna ! •Web, web, web •Scala, Akka, Play Framework ! •Vienna Scala User Group ! •Open-Source
  4. 4. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  5. 5. @elmanu#playframework Talenthouse •www.talenthouse.com ! •based in Los Angeles ! •connecting brands and artists ! •3+ million users
  6. 6. @elmanu#playframework Background •Problems with the old site • Slow • Developed by an external company • Hard to evolve
  7. 7. @elmanu#playframework Background •Solution: new site! • Scala • Play Framework • AngularJS • elasticsearch • …
  8. 8. @elmanu#playframework Background •A few interesting aspects • Source code may not be available • Data spread out in many places • Only 3 months time
  9. 9. @elmanu#playframework Background •A few interesting aspects • Source code may not be available • Data spread out in many places • Only 3 months time
  10. 10. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Methodologies & Tools • Summary & Future
  11. 11. @elmanu#playframework Building the new platform
  12. 12. @elmanu#playframework Building the new platform
  13. 13. @elmanu#playframework
  14. 14. @elmanu#playframework • MVC framework ! • Compile as much as possible • “Reactive”
  15. 15. @elmanu#playframework http://www.reactive-manifesto.org
  16. 16. @elmanu#playframework Load balancer
  17. 17. @elmanu#playframework Load balancer
  18. 18. @elmanu#playframework Building the new platform Data access?
  19. 19. @elmanu#playframework Building the new platform Anorm Data access? Squeryl
  20. 20. @elmanu#playframework Building the new platform Anorm Data access? Squeryl
  21. 21. @elmanu#playframework Building the new platform Anorm Data access? Squeryl SORM Tiramisu
  22. 22. @elmanu#playframework Building the new platform • Started with Anorm • Too verbose ! • Switched to Slick • Plain SQL with neat string interpolation • DSL for composing queries
  23. 23. @elmanu#playframework Building the new platform def fetchItemWithRelevanceSort(userId: Long, skip: Int, limit: Int)! (implicit s: Session): List[Item] = {! val q = for {! i <- items if !i.deleted! ! && i.visible_on_profile! ! && i.user_id === userId! } yield i! ! q.sortBy(item => (item.selected.desc, item.created_on.desc))! .drop(skip)! .take(limit)! .list! ! }
  24. 24. val query = sql"""! with invites_for_market as (! select #$inviteSL, #$inviteMarketSL! from invite i! inner join invite_market im! on i.id = im.invite_id! and im.market_id = ${marketId.id}! where i.art_type = ${artType.toString}! and i.visibility_state = ${InviteVisibilityState.Public}! and i.deleted = false! order by i.submission_start desc, i.id desc! limit $limit! offset $skip! )! ! select ifm.*, #$localInviteSL! from invites_for_market ifm! inner join local_invite li! on ifm.id = li.invite_id! and li.completed = true! order by ifm.submission_start desc, ifm.id asc! """! val queryResults = query.as[(Invite, InviteMarket, LocalInvite)].list!
  25. 25. @elmanu#playframework Building the new platform Front-end & UI
  26. 26. @elmanu#playframework Building the new platform Front-end & UI
  27. 27. @elmanu#playframework Building the new platform Front-end & UI
  28. 28. @elmanu#playframework Building the new platform • Recently open-sourced by Facebook ! • Virtual DOM, fast ! • Very easy to integrate in a page (less invasive than Angular) ReactJS
  29. 29. @elmanu#playframework Building the new platform Front-end & UI
  30. 30. @elmanu#playframework Building the new platform • Build pipeline using gulp.js & bower ! • Assets pipeline • LESS compilation • JS minification • Upload assets to Cloudfront • Integrates translations from Crowdin • Washes the dishes
  31. 31. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  32. 32. @elmanu#playframework Data migration: source system(s)
  33. 33. @elmanu#playframework Data migration: source system(s)
  34. 34. @elmanu#playframework Data migration: source system(s)
  35. 35. @elmanu#playframework Data migration: source system(s)
  36. 36. @elmanu#playframework Data migration: source system(s)
  37. 37. @elmanu#playframework Data migration: source system(s)
  38. 38. @elmanu#playframework Data migration: source system(s)
  39. 39. @elmanu#playframework Data migration: source system(s)
  40. 40. @elmanu#playframework Data migration: migration schedule
  41. 41. @elmanu#playframework Data migration • Akka to the rescue! ! • Concurrent user migration ! • Concurrent item migration • Using Play’s WS library for async calls to Youtube and friends
  42. 42. @elmanu#playframework Data migration User migrator Worker Worker Worker Worker Worker
  43. 43. @elmanu#playframework Data migration Item migrator
  44. 44. @elmanu#playframework Data migration Item migrator User item migrator User item migrator User item migrator
  45. 45. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker
  46. 46. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker File fetcher File fetcher
  47. 47. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker File fetcher File fetcher File uploader File uploader
  48. 48. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker File fetcher File fetcher File uploader Soundcloud worker File uploader
  49. 49. @elmanu#playframework Data migration
  50. 50. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  51. 51. @elmanu#playframework Operations Operations
  52. 52. @elmanu#playframework Operations
  53. 53. @YourTwitterHandle#DVXFR14{session hashtag} @elmanu#playframework Sum m ary & Future
  54. 54. @elmanu#playframework Summary & Future • Play Framework does not get in the way • Easy to deploy and operate • Many, many integrations ! • Many plans for the future • Live activity feed • Similarity search ! • Talenthouse is hiring!
  55. 55. @YourTwitterHandle#DVXFR14{session hashtag} @elmanu#playframework Q & A

×