spring boot @ paypal
TRANSCRIPT
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/
Spring Boot @ PayPalFabio Carvalho and Eduardo Solis
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/2
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/3
Java at PayPal in numbers
329Applications
50Batch
247Services
32MessageDaemons
5.1BCalls/day
1149 Engineersdeveloping
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/4
Agenda
• History of architecture and Java at PayPal• Developer needs at PayPal• The Raptor framework• Raptor and Spring Boot• Adopting Spring Boot• RESTEasy Spring Boot starter• The future• Q&A
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/5
A timeline for Java at PayPal
C++Monolith
2004
C++Breakout
2007
First Java framework
s2008
ModernJava
development
2014
Microservices2016
Single, monolithic CGI application made up PayPal
Monolith broken into services, SOA is adopted with the use of a proprietary protocol
Java is introduced at PayPal. Two frameworks were created one for presentation (Spring MVC) and one for backend services (proprietary)
Early Java frameworks deprecated. A modern framework for backend services is introduced
Microservice, PaaS, docker, remote config, service discovery, resiliency, etc.
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/
The PayPal developer challengeThe average PayPal developer has to deliver• Agile Innovation under extreme tight deadlines• High quality (bugs are very expensive)• Security• Compliance (DSS, PCI, etc.)• Maintainability of applications at scale (upgrade, patches,
etc.)• Backwards compatibility to APIs• Great performance• Scalability • Resiliency• Business visibility (KPI)• Operational visibility for monitoring and alerting at scale
No room for error!!!
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/7
PayPal frameworks to the rescue!!!• Frameworks provide built in support for the concerns that developers deal with
• They are instrumented to have high visibility into what is going on
• They provide common patterns for developers to write code
• Make life easier (most of the time)
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/8
Introducing Raptor, a modern Java Framework• Initiative to create a single framework for Java
middleware
• Adoption of modern design principles
• Cloud and DevOps model for deployment and maintenance
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/9
Raptor design principles• Standards based and open source core
• JSR-330 (@Inject)• JSR-339 (JAX-RS)• JSR-303 (Bean Validation)• JPA• …
API
Implementation
• Component driven design for PayPal components
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/10
Raptor design principles
• Dependency injection to produce and weave functionality
@Inject @Endpoint(svc=“myservice”)WebTarget baseTarget;
• Pluggability for customers so they can extend or change the behavior of framework provided components
• Zero XML configuration but still allow XML for users that want to use it
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/11
Raptor principles• ”A la carte” functionality based on composition of different components (“profiles”)
<dependency> <groupId>com.paypal.api.platform</groupId> <artifactId>rest-profile-ppaas</artifactId> <type>pom</type>
</dependency>
• Profiles require minimal or no configuration to bring a feature into the application
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/12
Success!!!! But…• Although the first Raptor version was an overall success, its
adoption revealed a couple issues:• The framework was based on Tomcat with Spring so other
”flavors” of application had to carry the weight of a tomcat server
• WAR was the only packaging mechanism even if the app had nothing to do with the web/http (messaging)
• While our profiles were a great way to shrink and grow the functionality of the application there were cases where more granularity of features was needed
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/13
So, why should we change, if…• The current solution is still functional• It is cheaper in the short term to keep the current solution• It is less risky in the short term to keep the current solution• All Ops engineers and tools are already used and adapted to the
current solution
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/14
Similarities between Raptor and Spring Boot• Parent project and BOM• Starters vs Profiles• Metrics and monitoring
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/15
Reasons to use Spring Boot• Because Spring Boot is
great!!!
Screenshotfrom Spring BootWebsite! ;-)
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/16
More reasons to use Spring Boot
• Lighter container designed and optimized to contain one application only
• Simplified deployment architecture• Great Improvement in development experience• Operation simplicity, reducing maintenance and cost• Aligns with our Spring based portfolio• Aligns with our goal towards micro-services, docker and hybrid cloud
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/17
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/18
No RESTEasy Spring Boot starter?
…which JAX-RS implementation should we use?We want to be JAX-RS based, but…
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/19
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/20
Servlet container customization
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/21
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/22
Tomcat
Initialization order has been reversed…so, who is the container now?
Raptor
Spring
App
Spring
Raptor
Tomcat
App
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/23
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/24
Servlet container configuration
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/25
Servlet container configuration
x
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/26
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/27
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/28
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/29
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/30
A few rocks on the way• No RESTEasy Spring Boot starter?• Servlet container customization• Initialization order has been reversed• Servlet container configuration• Skinny jar approach (instead of a fat one)• JMX conflict• Nanny process, graceful and proper shutdown• Logging• Upgrading
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/31
Results in a few numbers• Raptor on Spring Boot released on April, 2016• Total of over 300 Raptor apps, over 100 already on Raptor on
Spring Boot• 200 million calls per day on Raptor on Spring Boot only (4.2 billion total)• Over 1100 Raptor developers, and many of them are much happier
now!!
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/32
Raptor starters
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/33
RESTEasy Spring Boot starter• Enables RESTEasy for Spring Boot applications• Supports JAX-RS providers, resources and sub-resources as Spring
beans• Supports automatic discovery and registration of multiple JAX-RS
Application classes as Spring beans• Supports optional registration of JAX-RS Application classes via class-
path scanning, or manually, via configuration properties• Leverages and supports RESTEasy configuration
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/34
import javax.ws.rs.ApplicationPath;import javax.ws.rs.core.Application;import org.springframework.stereotype.Component;
@Component@ApplicationPath("/v1/myapi/")public class ApplicationConfig extends Application{}
https://github.com/paypal/resteasy-spring-boot
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/35
The future• Raptor “Lite”• Transition to Spring Boot Ops, Monitoring and Health check features• Explore and probably introduce
– Spring Boot remote shell– Spring Boot DevTools– Spring Boot Groovy DSL– Client side load balancing
• Evaluate– Undertow (embedded container)– Spring Reactor and other alternatives to servlet model– Spring Cloud configuration service API (and annotations)– Service discovery– Experiment with protocols gRPC, Aeron, AMQP
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/36
Q&A
Unless otherwise indicated, these s l ides are © 2013-2016 Pivota l Software , Inc . and l icensed under a Creative Commons Attr ibution-NonCommerc ia l l i cense:
http:/ /c reativecommons .org/ l icenses/by-nc/3.0/
Learn More. Stay Connected.
[email protected]@paypal.com
https://github.com/paypalhttps://github.com/paypal/resteasy-spring-boot/
@springcentralspring.io/blog
@pivotalpivotal.io/blog
@pivotalcfhttp://engineering.pivotal.io