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.
@elmanu#playframework
From PHP to the Play Framework in 3 months
Manuel Bernhardt
@elmanu
http://manuel.bernhardt.io
@elmanu#playframework
Agenda
• Background
• Building the new platform
• Data migration
• Operations
• Summary & Future
@elmanu#playframework
Your speaker
•Freelance software consultant
based in Vienna
!
•Web, web, web
•Scala, Akka, Play Fram...
@elmanu#playframework
Agenda
• Background
• Building the new platform
• Data migration
• Operations
• Summary & Future
@elmanu#playframework
Talenthouse
•www.talenthouse.com
!
•based in Los Angeles
!
•connecting brands and artists
!
•3+ mill...
@elmanu#playframework
Background
•Problems with the old site
• Slow
• Developed by an external company
• Hard to evolve
@elmanu#playframework
Background
•Solution: new site!
• Scala
• Play Framework
• AngularJS
• elasticsearch
• …
@elmanu#playframework
Background
•A few interesting aspects
• Source code may not be available
• Data spread out in many p...
@elmanu#playframework
Background
•A few interesting aspects
• Source code may not be available
• Data spread out in many p...
@elmanu#playframework
Agenda
• Background
• Building the new platform
• Data migration
• Operations
• Methodologies & Tool...
@elmanu#playframework
Building the new platform
@elmanu#playframework
Building the new platform
@elmanu#playframework
@elmanu#playframework
• MVC framework
!
• Compile as much as possible
• “Reactive”
@elmanu#playframework
http://www.reactive-manifesto.org
@elmanu#playframework
Load balancer
@elmanu#playframework
Load balancer
@elmanu#playframework
Building the new platform
Data access?
@elmanu#playframework
Building the new platform
Anorm
Data access?
Squeryl
@elmanu#playframework
Building the new platform
Anorm
Data access?
Squeryl
@elmanu#playframework
Building the new platform
Anorm
Data access?
Squeryl
SORM Tiramisu
@elmanu#playframework
Building the new platform
• Started with Anorm
• Too verbose
!
• Switched to Slick
• Plain SQL with ...
@elmanu#playframework
Building the new platform
def fetchItemWithRelevanceSort(userId: Long, skip: Int, limit: Int)!
(impl...
val query = sql"""!
with invites_for_market as (!
select #$inviteSL, #$inviteMarketSL!
from invite i!
inner join invite_ma...
@elmanu#playframework
Building the new platform
Front-end & UI
@elmanu#playframework
Building the new platform
Front-end & UI
@elmanu#playframework
Building the new platform
Front-end & UI
@elmanu#playframework
Building the new platform
• Recently open-sourced by Facebook
!
• Virtual DOM, fast
!
• Very easy to...
@elmanu#playframework
Building the new platform
Front-end & UI
@elmanu#playframework
Building the new platform
• Build pipeline using gulp.js & bower
!
• Assets pipeline
• LESS compilat...
@elmanu#playframework
Agenda
• Background
• Building the new platform
• Data migration
• Operations
• Summary & Future
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: source system(s)
@elmanu#playframework
Data migration: migration schedule
@elmanu#playframework
Data migration
• Akka to the rescue!
!
• Concurrent user migration
!
• Concurrent item migration
• U...
@elmanu#playframework
Data migration
User migrator
Worker Worker Worker Worker Worker
@elmanu#playframework
Data migration
Item migrator
@elmanu#playframework
Data migration
Item migrator
User item
migrator
User item
migrator
User item
migrator
@elmanu#playframework
Data migration
Item migrator
Item
migration
worker
User item
migrator
User item
migrator
User item
m...
@elmanu#playframework
Data migration
Item migrator
Item
migration
worker
User item
migrator
User item
migrator
User item
m...
@elmanu#playframework
Data migration
Item migrator
Item
migration
worker
User item
migrator
User item
migrator
User item
m...
@elmanu#playframework
Data migration
Item migrator
Item
migration
worker
User item
migrator
User item
migrator
User item
m...
@elmanu#playframework
Data migration
@elmanu#playframework
Agenda
• Background
• Building the new platform
• Data migration
• Operations
• Summary & Future
@elmanu#playframework
Operations
Operations
@elmanu#playframework
Operations
@YourTwitterHandle#DVXFR14{session hashtag} @elmanu#playframework
Sum
m
ary
&
Future
@elmanu#playframework
Summary & Future
• Play Framework does not get in the way
• Easy to deploy and operate
• Many, many ...
@YourTwitterHandle#DVXFR14{session hashtag} @elmanu#playframework
Q
&
A
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Project Phoenix - From PHP to the Play Framework in 3 months
Upcoming SlideShare
Loading in …5
×

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

2,365 views

Published on

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

Published in: Software, Technology, Education
  • Be the first to comment

  • Be the first to like this

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

×