SlideShare a Scribd company logo
1 of 33
Evolving IGN’s new APIs with
            Scala



                  Manish Pandit
                  Oct 4th, 2012
About me


             Manish Pandit
      Director of Engineering, IGN
             @lobster1234
       linkedin.com/in/mpandit
About IGN
We are a leading online media and services company
obsessed with gaming and entertainment.

56MM Monthly Unique Views
737MM Monthly Page Views
20MM Monthly Video Views
My Objective
Is:
To get you excited about building APIs in Scala

Isn't:
To incite a functional vs. imperative, or Scala vs.
____ debate
Agenda
•   APIs at IGN
•   API Evolution
•   Why Scala
•   API Development with Scala
•   Monitoring, Maintaining, Evolving
•   Performance Management
APIs at IGN
• Offer SOA advantages
• Isolate the back end systems from the FE
• IGN is going where the audience is, fast
  – Mobile Devices, Consoles, TVs, Aggregators
• APIs are a specialized skillset
• Expand the development to outside
  developers
APIs at IGN : Numbers
• ~5 Billion requests a month
• Average Response time of under 20ms on
  cache misses
• 17 APIs between Social, OAuth, and Content
• Hardest hit APIs doing about 25K RPM at peak
Evolution
The API Evolution : V1 [2006]
• The CMS and the desktop site calling Java
  Services, which wrapped Oracle DB calls
  behind Hibernate.
• Caching with Memcache
  – Near-far Cache Architecture to address hot spots
• Not all content types were supported
• Schema was still too complex
The API Evolution : V2 [2009]
• Rails based Content API, Java based Social API
  –   Standards around request/response
  –   Automated Testing
  –   MongoDB NoSQL storage to simplify the schema
  –   Solr
• Video and Blogs served by V2 API
• Games and Articles still used V1
• Mixed-infrastructure with Rails and Java
  echosystem
• Performance sucked royally
The API Evolution : V3 [2012]
• A fresh look at the APIs and IGN’s direction
• First attempt to
  – Integrate all content types
  – Open up the APIs to external consumers
  – Evolve the CMS, traditionally a monolithic system
  – ElasticSearch
  – Varnish Response Caching
• A learning opportunity for traditional Java
  stack engineers
API Development
• MVC Model for APIs
  – View, which marshals/unmarshals request and
    response data
  – Controller, which picks the right model to serve
    the request
  – Model, which has the necessary logic to talk to the
    database, or other APIs to fetch data
Why Scala
• Performance tied to cores than processor
  speed, i.e. concurrency
• Ideal for API development – (relatively) simple
  to handle concurrency and immutability
• JVM based = Performance
• Re-use Java toolkits and libraries
• Concise, expressive code (1:2.5 with Java)
• Actor model makes the difficult parts easy
Why Scala
•   Richer Collections API
•   Traits enabling Mix-Ins and behavior re-use
•   Statically Typed w/Type inference
•   Functional
•   Growing developer community
•   REPL
•   Culture – learning, hacking and achieving
The Biggest Reason
• Just makes sense
The Biggest Reason
• Just makes sense
  – Pattern matching
  – Implicit conversions
  – Control abstractions for collection mapping,
    filtering, iterating
  – Guaranteed Singletons at the classloader level
  – Almost non-existent boilerplate
  ….Productive, and fun!
Picking up Scala : Week 1
• Scala for Java Developers fast-tracked the
  learning
• Syntax Familiarity
• Java without semicolons?
     def total(nums: List[Int]) :Int = {
       var sum:Int=0
       for(num<-nums) {
         sum+=num
       }
       sum
     }
Picking up Scala : Week 4
• Reduce the lines of code, embrace
  immutability, use the functional paradigms
  built into the language
• Unmystrify the implicits magic
    nums.foldLeft(0)((n,c) => n+c)
Picking up Scala : Today
• Focus on immutability
• Think functional – with the knowledge gained
  from using the functional aspects of the
  language, build control abstractions
• Keep learning and applying
API Components
•   Scalatra (View, Controller)
•   Lift-MongoRecord for MongoDB (Model)
•   Casbah for MongoDB
•   Play! Anorm for MySQL
•   Actors for tasks like syndication
•   Maven for Builds
•   MongoDB for persistance
Other API Components
•   Varnish Cache
•   Elasticsearch
•   Yammer Metrics (ping, healthcheck)
•   Swagger (self-documenting RESTful APIs)
•   3Scale for Partner APIs
•   IntelliJ IDEA and Eclipse with ScalaIDE
Challenges with Scala
• Learning Curve depends on the culture
  • TPS Cover Sheets, vs. Hack Nights


• Scala is what you make of it
Awesome..?




http://scalaz.github.com/scalaz/scalaz-2.9.1-6.0.4/doc.sxr/scalaz/BKTree.scala.html
Challenges with Scala
• Scala is what you make of it
  – Middle ground – simple is beautiful
• Tooling not as rich as Java
  – Changing with Typesafe investing in ScalaIDE
Challenges with Scala
• Slow compilation based on the source
  – How well the code matches up to the JVM
    constructs
• No (binary) compatibility of dependencies for
  the major releases (2.8, 2.9, 2.10(?))
• Monitoring
  – No native instrumentation agents as they exist for
    Java
API Development : Deploying
• Continuous Deployment
  • Jenkins hooks to github
  • Pushes artifact(s) to Nexus
  • Fabric to push code to production (to be
    automated)
API Performance Management
• As far as Scala goes, the tips are not much
  different than Java
  – GC Tuning
  – Avoid shared state
  – Parallel collections
API Performance Management
• For the overall APIs, the performance tuning has
  many knobs to work around with
  – Stateless services
  – Async calls with Akka Agents
  – Response level cache
• Keep an eye on the database and network
  –   Control the payload size
  –   Use reasonable defaults
  –   Allow field filtering
  –   Paginate your response
Monitoring and Maintenance
• Newrelic
  – JVM stats, SQL trace
  – Supports Scala via annotations, but not as rich as
    Java
• Typesafe Console for Akka
Future of APIs at IGN
• Opening up the APIs
• Tests, tests, tests..
• Move towards simplifying the stack
  – sbt vs. maven
  – Typesafe stack
The IGN Tech Stack
Resources
• Do NOT use scaladoc as your 1st reference, at
  least initially
• StackOverflow
• Twitter’s Scala School
• Online blogs and tutorials
• Book: Scala for the Impatient
• Scala Meetup Groups in your area
• Coursera course on FP by Martin Odersky
Questions

More Related Content

What's hot

Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
Wen-Tien Chang
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen Cambridge
Phil Pursglove
 
Scala in the Enterprise
Scala in the EnterpriseScala in the Enterprise
Scala in the Enterprise
Eric Pederson
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
Mugunth Kumar
 

What's hot (20)

Apereo OAE - Bootcamp
Apereo OAE - BootcampApereo OAE - Bootcamp
Apereo OAE - Bootcamp
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
 
Scala for java developers 6 may 2017 - yeni
Scala for java developers   6 may 2017 - yeniScala for java developers   6 may 2017 - yeni
Scala for java developers 6 may 2017 - yeni
 
Full stack
Full stackFull stack
Full stack
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen Cambridge
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
 
From java to scala at crowd mix
From java to scala at crowd mixFrom java to scala at crowd mix
From java to scala at crowd mix
 
React.js for Rails Developers
React.js for Rails DevelopersReact.js for Rails Developers
React.js for Rails Developers
 
JIRA5 Introduction
JIRA5 IntroductionJIRA5 Introduction
JIRA5 Introduction
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
 
Migration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET CoreMigration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET Core
 
Scala in the Enterprise
Scala in the EnterpriseScala in the Enterprise
Scala in the Enterprise
 
Java SE 7 New Features and Enhancements
Java SE 7 New Features and EnhancementsJava SE 7 New Features and Enhancements
Java SE 7 New Features and Enhancements
 
Data normalization across API interactions
Data normalization across API interactionsData normalization across API interactions
Data normalization across API interactions
 
Building serverless app_using_aws_lambda_b4usolution
Building serverless app_using_aws_lambda_b4usolutionBuilding serverless app_using_aws_lambda_b4usolution
Building serverless app_using_aws_lambda_b4usolution
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
 
React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to rails
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
 

Viewers also liked

Onlinetools&amp;Job Search2010
Onlinetools&amp;Job Search2010Onlinetools&amp;Job Search2010
Onlinetools&amp;Job Search2010
Cindy Edwards
 
Dossier robotica Albert Claveria
Dossier robotica Albert ClaveriaDossier robotica Albert Claveria
Dossier robotica Albert Claveria
albert
 
Hummingbird Banding in Paridise, AZ
Hummingbird  Banding  in Paridise, AZHummingbird  Banding  in Paridise, AZ
Hummingbird Banding in Paridise, AZ
tdainsure
 
ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12
ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12
ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12
Christos Gotzaridis
 
Pp Kee Dome Web
Pp Kee Dome WebPp Kee Dome Web
Pp Kee Dome Web
Kee Safety
 
αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...
αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...
αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...
Christos Gotzaridis
 
Music Video Powerpoint
Music Video PowerpointMusic Video Powerpoint
Music Video Powerpoint
HayleyMoore
 

Viewers also liked (20)

Knowwi Intro 2010
Knowwi Intro 2010Knowwi Intro 2010
Knowwi Intro 2010
 
Onlinetools&amp;Job Search2010
Onlinetools&amp;Job Search2010Onlinetools&amp;Job Search2010
Onlinetools&amp;Job Search2010
 
Dossier robotica Albert Claveria
Dossier robotica Albert ClaveriaDossier robotica Albert Claveria
Dossier robotica Albert Claveria
 
Funcionlinealyafin
FuncionlinealyafinFuncionlinealyafin
Funcionlinealyafin
 
南東京I phone勉強会(stidev) 20101030
南東京I phone勉強会(stidev) 20101030南東京I phone勉強会(stidev) 20101030
南東京I phone勉強会(stidev) 20101030
 
Hummingbird Banding in Paridise, AZ
Hummingbird  Banding  in Paridise, AZHummingbird  Banding  in Paridise, AZ
Hummingbird Banding in Paridise, AZ
 
ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12
ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12
ΟΔΗΓΙΕΣ ΔΙΔΑΣΚΑΛΙΑΣ ΤΗΣ ΒΙΟΛΟΓΙΑΣ Α ΛΥΚΕΙΟΥ 2011-12
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Pp Kee Dome Web
Pp Kee Dome WebPp Kee Dome Web
Pp Kee Dome Web
 
Mapping an all-weather Tour de France
Mapping an all-weather Tour de FranceMapping an all-weather Tour de France
Mapping an all-weather Tour de France
 
Crash
CrashCrash
Crash
 
Small Group Makeup Workshops in Tauranga
Small Group Makeup Workshops in TaurangaSmall Group Makeup Workshops in Tauranga
Small Group Makeup Workshops in Tauranga
 
αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...
αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...
αρχαια ολυμπιακα αγωνισματα & σχολικη φυσικη μια διαθεματικη προταση για το λ...
 
Ppt Presentations Best Methods
Ppt Presentations Best MethodsPpt Presentations Best Methods
Ppt Presentations Best Methods
 
Osig Annual Report 2008
Osig Annual Report 2008Osig Annual Report 2008
Osig Annual Report 2008
 
RiciCreo sistema per la raccolta differenziata con dinamica di gamification
RiciCreo sistema per la raccolta differenziata con dinamica di gamificationRiciCreo sistema per la raccolta differenziata con dinamica di gamification
RiciCreo sistema per la raccolta differenziata con dinamica di gamification
 
Music Video Powerpoint
Music Video PowerpointMusic Video Powerpoint
Music Video Powerpoint
 
Nuestros Valores
Nuestros ValoresNuestros Valores
Nuestros Valores
 
Sacchetti Di Plastica
Sacchetti Di PlasticaSacchetti Di Plastica
Sacchetti Di Plastica
 
Reflecting On Research Outcomes - Ricardo's Presentation
Reflecting On Research Outcomes - Ricardo's PresentationReflecting On Research Outcomes - Ricardo's Presentation
Reflecting On Research Outcomes - Ricardo's Presentation
 

Similar to Evolving IGN’s New APIs with Scala

Apache Spark MLlib 2.0 Preview: Data Science and Production
Apache Spark MLlib 2.0 Preview: Data Science and ProductionApache Spark MLlib 2.0 Preview: Data Science and Production
Apache Spark MLlib 2.0 Preview: Data Science and Production
Databricks
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
Atlassian
 
Resume
ResumeResume
Resume
Mina k
 

Similar to Evolving IGN’s New APIs with Scala (20)

Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
 
Emulators as an Emerging Best Practice for API providers
Emulators as an Emerging Best Practice for API providersEmulators as an Emerging Best Practice for API providers
Emulators as an Emerging Best Practice for API providers
 
IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big Data
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Transitioning from Java to Scala for Spark - March 13, 2019
Transitioning from Java to Scala for Spark - March 13, 2019Transitioning from Java to Scala for Spark - March 13, 2019
Transitioning from Java to Scala for Spark - March 13, 2019
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Scala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
Scala and Spark are Ideal for Big Data - Data Science Pop-up SeattleScala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
Scala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
 
Frontend as a first class citizen
Frontend as a first class citizenFrontend as a first class citizen
Frontend as a first class citizen
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
A look ahead at RAP (ESE 2010)
A look ahead at RAP (ESE 2010)A look ahead at RAP (ESE 2010)
A look ahead at RAP (ESE 2010)
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java Appengine
 
Apache Spark MLlib 2.0 Preview: Data Science and Production
Apache Spark MLlib 2.0 Preview: Data Science and ProductionApache Spark MLlib 2.0 Preview: Data Science and Production
Apache Spark MLlib 2.0 Preview: Data Science and Production
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
Varun-CV-J
Varun-CV-JVarun-CV-J
Varun-CV-J
 
Ohio Devfest - Visual Analysis with GCP
Ohio Devfest - Visual Analysis with GCPOhio Devfest - Visual Analysis with GCP
Ohio Devfest - Visual Analysis with GCP
 
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
 
Resume
ResumeResume
Resume
 
IGN's V3 API
IGN's V3 APIIGN's V3 API
IGN's V3 API
 

More from Manish Pandit

OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixOSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
Manish Pandit
 

More from Manish Pandit (20)

Disaster recovery - What, Why, and How
Disaster recovery - What, Why, and HowDisaster recovery - What, Why, and How
Disaster recovery - What, Why, and How
 
Serverless Architectures on AWS in practice - OSCON 2018
Serverless Architectures on AWS in practice - OSCON 2018Serverless Architectures on AWS in practice - OSCON 2018
Serverless Architectures on AWS in practice - OSCON 2018
 
Disaster Recovery and Reliability
Disaster Recovery and ReliabilityDisaster Recovery and Reliability
Disaster Recovery and Reliability
 
OAuth2 primer
OAuth2 primerOAuth2 primer
OAuth2 primer
 
Immutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsImmutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and Jenkins
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and Java
 
AWS Primer and Quickstart
AWS Primer and QuickstartAWS Primer and Quickstart
AWS Primer and Quickstart
 
Securing your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID ConnectSecuring your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID Connect
 
Silicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API AntipatternsSilicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API Antipatterns
 
Scalabay - API Design Antipatterns
Scalabay - API Design AntipatternsScalabay - API Design Antipatterns
Scalabay - API Design Antipatterns
 
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixOSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
 
API Design Antipatterns - APICon SF
API Design Antipatterns - APICon SFAPI Design Antipatterns - APICon SF
API Design Antipatterns - APICon SF
 
Motivation : it Matters
Motivation : it MattersMotivation : it Matters
Motivation : it Matters
 
Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2
 
Scala at Netflix
Scala at NetflixScala at Netflix
Scala at Netflix
 
Java and the JVM
Java and the JVMJava and the JVM
Java and the JVM
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you REST
 
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDBSilicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDB
 
NoSQLCamp : MongoDB at IGN
NoSQLCamp : MongoDB at IGNNoSQLCamp : MongoDB at IGN
NoSQLCamp : MongoDB at IGN
 
MongoSF 2011 - Using MongoDB for IGN's Social Platform
MongoSF 2011 - Using MongoDB for IGN's Social PlatformMongoSF 2011 - Using MongoDB for IGN's Social Platform
MongoSF 2011 - Using MongoDB for IGN's Social Platform
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Evolving IGN’s New APIs with Scala

  • 1. Evolving IGN’s new APIs with Scala Manish Pandit Oct 4th, 2012
  • 2. About me Manish Pandit Director of Engineering, IGN @lobster1234 linkedin.com/in/mpandit
  • 3. About IGN We are a leading online media and services company obsessed with gaming and entertainment. 56MM Monthly Unique Views 737MM Monthly Page Views 20MM Monthly Video Views
  • 4. My Objective Is: To get you excited about building APIs in Scala Isn't: To incite a functional vs. imperative, or Scala vs. ____ debate
  • 5. Agenda • APIs at IGN • API Evolution • Why Scala • API Development with Scala • Monitoring, Maintaining, Evolving • Performance Management
  • 6. APIs at IGN • Offer SOA advantages • Isolate the back end systems from the FE • IGN is going where the audience is, fast – Mobile Devices, Consoles, TVs, Aggregators • APIs are a specialized skillset • Expand the development to outside developers
  • 7. APIs at IGN : Numbers • ~5 Billion requests a month • Average Response time of under 20ms on cache misses • 17 APIs between Social, OAuth, and Content • Hardest hit APIs doing about 25K RPM at peak
  • 9. The API Evolution : V1 [2006] • The CMS and the desktop site calling Java Services, which wrapped Oracle DB calls behind Hibernate. • Caching with Memcache – Near-far Cache Architecture to address hot spots • Not all content types were supported • Schema was still too complex
  • 10. The API Evolution : V2 [2009] • Rails based Content API, Java based Social API – Standards around request/response – Automated Testing – MongoDB NoSQL storage to simplify the schema – Solr • Video and Blogs served by V2 API • Games and Articles still used V1 • Mixed-infrastructure with Rails and Java echosystem • Performance sucked royally
  • 11. The API Evolution : V3 [2012] • A fresh look at the APIs and IGN’s direction • First attempt to – Integrate all content types – Open up the APIs to external consumers – Evolve the CMS, traditionally a monolithic system – ElasticSearch – Varnish Response Caching • A learning opportunity for traditional Java stack engineers
  • 12. API Development • MVC Model for APIs – View, which marshals/unmarshals request and response data – Controller, which picks the right model to serve the request – Model, which has the necessary logic to talk to the database, or other APIs to fetch data
  • 13. Why Scala • Performance tied to cores than processor speed, i.e. concurrency • Ideal for API development – (relatively) simple to handle concurrency and immutability • JVM based = Performance • Re-use Java toolkits and libraries • Concise, expressive code (1:2.5 with Java) • Actor model makes the difficult parts easy
  • 14. Why Scala • Richer Collections API • Traits enabling Mix-Ins and behavior re-use • Statically Typed w/Type inference • Functional • Growing developer community • REPL • Culture – learning, hacking and achieving
  • 15. The Biggest Reason • Just makes sense
  • 16. The Biggest Reason • Just makes sense – Pattern matching – Implicit conversions – Control abstractions for collection mapping, filtering, iterating – Guaranteed Singletons at the classloader level – Almost non-existent boilerplate ….Productive, and fun!
  • 17. Picking up Scala : Week 1 • Scala for Java Developers fast-tracked the learning • Syntax Familiarity • Java without semicolons? def total(nums: List[Int]) :Int = { var sum:Int=0 for(num<-nums) { sum+=num } sum }
  • 18. Picking up Scala : Week 4 • Reduce the lines of code, embrace immutability, use the functional paradigms built into the language • Unmystrify the implicits magic nums.foldLeft(0)((n,c) => n+c)
  • 19. Picking up Scala : Today • Focus on immutability • Think functional – with the knowledge gained from using the functional aspects of the language, build control abstractions • Keep learning and applying
  • 20. API Components • Scalatra (View, Controller) • Lift-MongoRecord for MongoDB (Model) • Casbah for MongoDB • Play! Anorm for MySQL • Actors for tasks like syndication • Maven for Builds • MongoDB for persistance
  • 21. Other API Components • Varnish Cache • Elasticsearch • Yammer Metrics (ping, healthcheck) • Swagger (self-documenting RESTful APIs) • 3Scale for Partner APIs • IntelliJ IDEA and Eclipse with ScalaIDE
  • 22. Challenges with Scala • Learning Curve depends on the culture • TPS Cover Sheets, vs. Hack Nights • Scala is what you make of it
  • 24. Challenges with Scala • Scala is what you make of it – Middle ground – simple is beautiful • Tooling not as rich as Java – Changing with Typesafe investing in ScalaIDE
  • 25. Challenges with Scala • Slow compilation based on the source – How well the code matches up to the JVM constructs • No (binary) compatibility of dependencies for the major releases (2.8, 2.9, 2.10(?)) • Monitoring – No native instrumentation agents as they exist for Java
  • 26. API Development : Deploying • Continuous Deployment • Jenkins hooks to github • Pushes artifact(s) to Nexus • Fabric to push code to production (to be automated)
  • 27. API Performance Management • As far as Scala goes, the tips are not much different than Java – GC Tuning – Avoid shared state – Parallel collections
  • 28. API Performance Management • For the overall APIs, the performance tuning has many knobs to work around with – Stateless services – Async calls with Akka Agents – Response level cache • Keep an eye on the database and network – Control the payload size – Use reasonable defaults – Allow field filtering – Paginate your response
  • 29. Monitoring and Maintenance • Newrelic – JVM stats, SQL trace – Supports Scala via annotations, but not as rich as Java • Typesafe Console for Akka
  • 30. Future of APIs at IGN • Opening up the APIs • Tests, tests, tests.. • Move towards simplifying the stack – sbt vs. maven – Typesafe stack
  • 31. The IGN Tech Stack
  • 32. Resources • Do NOT use scaladoc as your 1st reference, at least initially • StackOverflow • Twitter’s Scala School • Online blogs and tutorials • Book: Scala for the Impatient • Scala Meetup Groups in your area • Coursera course on FP by Martin Odersky