![Page 1: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/1.jpg)
HOW WE TOOK OUR SERVER-SIDE APPLICATION TO THE CLOUD……and liked what we got
![Page 2: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/2.jpg)
Where we started What we did Paradigm shift
2
Agenda
![Page 3: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/3.jpg)
BACKGROUND
![Page 4: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/4.jpg)
4
Fred Simon @freddy33 Chief Architect of JFrog Also Head of DevOps Co-author of Artifactory
Who’s talking?
![Page 5: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/5.jpg)
5
Since 2006 Binary Repository Manager Open Source Standard Java Web Application
> Spring> Spring Security> Wicket> JCR> Jersey
Artifactory what?
![Page 6: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/6.jpg)
6
Yet Another Java Server App
![Page 7: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/7.jpg)
7
Community success JFrog established in 2008 JavaOne 2009
>Pro version>Software as a Service (SaaS version)
› Heavly used by OSS community
Moving Forward
That’s what this session is about!
![Page 8: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/8.jpg)
8
Benefits for the user:>Zero maintenance
› Backups› Updates› Infrastructure
>Support Drawbacks for the user:
>Can’t install user plugins
Artifactory SaaS
![Page 9: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/9.jpg)
9
etc.
Artifactory SaaS
![Page 10: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/10.jpg)
10
3 product flavors in production>Challenging support tasks>Completing, not competing
30 million requests/week>Mostly in the Pacific Time Monday mornings
4 TB of artifacts
Moving Forward
![Page 11: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/11.jpg)
11
A load of Artifacts!
![Page 12: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/12.jpg)
JOURNEY TO THE CLOUD
![Page 13: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/13.jpg)
THE *AAS BUZZ
![Page 14: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/14.jpg)
* As A Service
Self Service Multi-tenant
![Page 15: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/15.jpg)
15
Product Self Service
Multi-tenant
* aaS
Gmail Not *aaS, web-app
Google Apps SaaS
Google App Engine PaaS
Google Compute Engine IaaS
GaaE: Google as an Example
![Page 16: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/16.jpg)
16
Product Self Service
Multi-tenant
* aaS
Amazon store Not *aaS, web-app
aStore SaaS
Amazon Elastic Beanstalk PaaS
Amazon Elastic Cloud IaaS
AaaE: Amazon as an Example
![Page 17: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/17.jpg)
17
Multi-tenancy Platform selection
>PaaS or IaaS DB schema updates
The SaaS Pains - Overview
![Page 18: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/18.jpg)
18
Java 9 already! Until then select one of the
following:>Use single application, separate data>Use separated applications>Use separated processes
Multi-tenancy
![Page 19: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/19.jpg)
19
GaaE for Multi Tenancy Types
Product Muli-tenancy Type
Google Apps Data Separation
Google App Engine Application Separation
Google Compute Engine Process Separation
![Page 20: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/20.jpg)
20
Strategy Pros ConsSeparating data Normal Java Application Manual state
separation Complicated and
critical schemaSeparating application
No shared state Or is it?
Simple transition from existing
Stay tuned…
Separating processes No shared state Simple transition from
existing
JVM per tenant!
Comparing the Strategies
![Page 21: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/21.jpg)
Strategy Pros ConsSeparating data Normal Java Application Manual state
separation Complicated and
critical schemaSeparating application
No shared state Or is it?
Simple transition from existing
Stay tuned…
Separating processes No shared state Simple transition from
existing
JVM per tenant!
Comparing the Strategies
21
![Page 22: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/22.jpg)
Strategy Pros ConsSeparating data Normal Java Application Manual state
separation Complicated and
critical schemaSeparating application
No shared state Or is it?
Simple transition from existing
Stay tuned…
Separating processes No shared state Simple transition from
existing
JVM per tenant!
Comparing the Strategies
22
![Page 23: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/23.jpg)
Strategy Pros ConsSeparating data Normal Java Application Manual state
separation Complicated and
critical schemaSeparating application
No shared state Or is it?
Simple transition from existing
Stay tuned…
Separating processes No shared state Simple transition from
existing
JVM per tenant!
Comparing the Strategies
P
23
![Page 24: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/24.jpg)
24
Separate Application: Tomcat Root
┌── lib├── webapps│ ├── customer-name│ ├── other-customer-name│ └── many other customers└── other dirs (bin, conf, log, etc)
Tenant WARs
![Page 25: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/25.jpg)
25
Using standard Java WAR classloader isolation Creating standard WAR with dependencies in
‘lib’, classes in ‘classes’ Creating per-user database Done!
Separate Application
![Page 26: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/26.jpg)
26
Using standard Java WAR classloader isolation
Creating standard WAR with dependencies in ‘lib’, classes in ‘classes’
Creating per-user database Done! Perm Gen explodes after deploying 4 WARs
>Even when set to 1Gb!
Separate Application
![Page 27: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/27.jpg)
27
The solution – move libraries to shared classloader>Both 3rd party and application>25 Mbs of JAR files
Not as easy as it sounds Review the source code of 3rd party libraries
one by one>Open Source FTW
The Quest for Shared Libraries
![Page 28: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/28.jpg)
THE QUEST FOR SHARED LIBRARIES
![Page 29: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/29.jpg)
29
Perfect Make sure the context is bounded to
thread/war
Spring Framework
![Page 30: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/30.jpg)
30
public class AppCtxHolder implements ApplicationContextAware {private static ApplicationContext ctx;
public AppCtxHolder() { }
public void setApplicationContext(ApplicationContext applicationContext) {ctx = applicationContext;
}
public static ApplicationContext getApplicationContext() {return ctx;
} }
Spring Framework
![Page 31: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/31.jpg)
31
public class AppCtxHolder implements ApplicationContextAware {private static ApplicationContext ctx;
public AppCtxHolder() { }
public void setApplicationContext(ApplicationContext applicationContext) {ctx = applicationContext;
}
public static ApplicationContext getApplicationContext() {return ctx;
} }
Spring Framework
![Page 32: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/32.jpg)
32
public class AppCtxHolder implements ApplicationContextAware {private static ApplicationContext ctx;
public AppCtxHolder() { }
public void setApplicationContext(ApplicationContext applicationContext) {ctx = applicationContext;
}
public static ApplicationContext getApplicationContext() {return ctx;
} }
Spring Framework
![Page 33: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/33.jpg)
33
Was good New versions added static map of
applications>Lesson learned: Recheck on each
version upgrade
Apache Wicket
![Page 34: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/34.jpg)
34
They are not shared – good! Need global management to adjust
the size to match all the tenants>Without global thread pool
Thread Pools
![Page 35: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/35.jpg)
35
Logger fields are (almost) always static>Can’t fight it>We MITM-ed the
LoggerFactory >Keeps Loggers per
application instead of static
Logger
![Page 36: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/36.jpg)
36
Examples>Transaction ID>Tomcat ClassLoader
Solving race condition generates synchronous initialization
Race conditions on central locks
![Page 37: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/37.jpg)
37
CATS Software
![Page 38: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/38.jpg)
38
Heap-wide temp file cleaner thread >A static thread destroying the temp files
of the other tenants>Not as funny as it sounds
Jackrabbit
![Page 39: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/39.jpg)
39
Lucene and other cache solutions are adjusted for the whole heap size
Use SoftReference based caches
Heap-wide Caches
![Page 40: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/40.jpg)
THE QUEST FOR SHARED LIBRARIES: RESULTS
![Page 41: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/41.jpg)
41
┌── lib├── webapps│ ├── customer-name│ │ ├── favicon.ico│ │ ├── META-INF│ │ └── WEB-INF│ │ ├── web.xml│ │ └── classes│ │ └── DUMMY.TXT│ ├── other-customer-name│ │ ├── favicon.ico│ │ │ └── META-INF│ │ └── WEB-INF│ └── many other customers└── other dirs (bin, conf, log, etc)
Tomcat Root – Where’s the JARs?
Tenant WAR
Look, ma!No jars, nor classes!
![Page 42: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/42.jpg)
42
┌── lib│ ├── artifactory│ │ ├── artifactory-*.jar│ │ ├── jackrabbit-core-jfrog-2.2.8c.jar│ │ ├── spring-core-3.1.1.RELEASE.jar│ │ ├── wicket-core-1.5.3.jar│ │ └── other jars│ ├── catalina.jar│ ├── servlet-api.jar│ └── other jars├── webapps└── other dirs (bin, conf, log, etc)
Tomcat Root – In Global Lib!
Artifactory dependencies
Shared libs folder
Artifactory jars
Tenant WARs (without jars)
![Page 43: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/43.jpg)
43
Custom Tomcat (our own jars in Tomcat’s lib)
Custom Machine Image with our customized software and configuration
Infrastructure as a Service
PaaS or IaaS?
![Page 44: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/44.jpg)
44
Distributed software is concerned with DB upgrade procedures>User experience involved
Since we came from there, we have “Converters”>Our SaaS version got it for free
What was it about DB upgrade?
![Page 45: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/45.jpg)
THE DEVOPS
![Page 46: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/46.jpg)
46
Self Service Platform>Registration>Instance generation
› DB› Backup› Virtual Host› WAR
>Customer account management
Providing Self Service
![Page 47: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/47.jpg)
47
Customer account is only in SaaS Centralized Self-Service portal Intercommunication with the provisioned
application of specific tenant>UI Branding>Virtual host control>Backups
Separating Concerns
![Page 48: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/48.jpg)
48
4 TB of storage 33 TB of traffic per month Increasing overall performance
in an order of magnitude in the last 18 months
Outcome: DevOps
![Page 49: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/49.jpg)
THE PROCESS
![Page 50: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/50.jpg)
50
3 Versions 3 Deployment formats
>WAR>ZIP>RPM
Lots of dependencies
Diversity
![Page 51: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/51.jpg)
51
We eat our own dog food
Artifactory is built with Artifactory
Recursive Slide (w. baby picture)
![Page 52: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/52.jpg)
52
Snapshots are built, tested & deployed on your build server of choice>With Artifactory plugin
Artifactory “snapshot promotion” to sandbox
Right Tools for the Job
![Page 53: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/53.jpg)
53
Deploying to production using Chef Other options:
>Puppet>Build Server plugins>ZT LiveRebel>Scripts
Right Tools for the Job
![Page 54: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/54.jpg)
THE PARADIGM SHIFT
![Page 55: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/55.jpg)
55
Before:1. Planning downloadable version release2. Converting it to SaaS version
Today:1. Continuously release to the cloud2. Once in a while “freezing” it to
downloadable version
Reversing the Cycle
![Page 56: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/56.jpg)
56
>Rapid feedback>Host server access>Developers must think big>Standalone updates well tested by SaaS>Standalone application is kind of LTS
version
Consequences
![Page 57: How we took our server side application to the cloud and liked what we got](https://reader035.vdocument.in/reader035/viewer/2022062704/555a77cfd8b42a98568b481f/html5/thumbnails/57.jpg)