Java Best Practices
Tools, Performance, and Deployment
January 28, 2015
#forcewebinar
Speakers
Joe Kutner
Heroku
@codefinger
Bruce Eckel
MindView
@BruceEckel
James Ward
Salesforce.com
@_JamesWard
#forcewebinar
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the
assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we
make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber
growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new
products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in
our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions,
the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth,
new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger
enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-
Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures are available on the SEC Filings section of the
Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered
on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc.
assumes no obligation and does not intend to update these forward-looking statements.
#forcewebinar
Go Social!
Salesforce Developers
+Salesforce Developers
Salesforce Developers
Salesforce Developers The video will be posted to YouTube
& the webinar recap page
(same URL as registration).
This webinar is being recorded!
@salesforcedevs / #forcewebinar
#forcewebinar
▪ Don’t wait until the end to ask your question!
– Questions will be queued and answered at the end.
▪ Respect Q&A etiquette
– Please don’t repeat questions.
▪ Stick around for live Q&A
– Speakers will tackle your questions at the end.
▪ Head to Developer Forums
– More questions? Visit developer.salesforce.com/forums
Have Questions?
#forcewebinar
Agenda
1. Java Tooling the Sucky Parts
2. Java Deployment the Sucky Parts
3. Discussion / Q&A
Java Tooling
The Sucky Parts
#forcewebinar
10 Page Wikis to Setup Dev Environments Suck
 Setting up a new dev envs should be no more than:
1. Install the JDK
2. Clone / checkout the SCM repo
3. Run the build / start the app
#forcewebinar
Incongruent Deployment Environments Suck
CI Built
Artifact
Staging
Production
#forcewebinar
Manually Managed Dependencies Suck
WEB-INF/lib/foo.jar
#forcewebinar
Long Development/Validiation Cycles Really Suck
Auto-Run
Tests
Auto-
Refresh
Browser
Make
Code
Change
Java
Scala
Groovy
Clojure
JRuby
#forcewebinar
.war
Traditional WAR file deployment…
#forcewebinar
Why WAR?
#forcewebinar
What does modern Java
deployment look like?
#forcewebinar
Modern Java Deployment is…
Containerless
#forcewebinar
.jar
Modern Java Deployment
#forcewebinar
Demo!
#forcewebinar
The Twelve Factor App
#forcewebinar
The Twelve Factor App is..
 a manifesto
 a methodology
 a collection of experiences
#forcewebinar
Its Goals are
 scalability
 maintainability
 portability
#forcewebinar
It does this through…
Declarative Setup
 explicit dependencies
 external configuration
Clean Contracts
 between your app and its platform
 reduced coupling
Minimum Divergence
 between each deployment
 between dev and prod environments
#forcewebinar
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
Twelve Factors
#forcewebinar
VI. Processes
Stateless
#forcewebinar
VIII. Concurrency
§Scale out
§Scale up
#forcewebinar
$ heroku ps:scale web=3
VIII. Concurrency
§Scale out
§Scale up
#forcewebinar
web.1
web.2
worker.1 clock.1
Workload Diversity
worker.2
worker.3
VIII. Concurrency
#forcewebinar
IX. Disposability
Fast startup and graceful shutdown
§Spring Boot and Play do this for you…
§As opposed to big App Servers that take
several minutes to boot
#forcewebinar
X. Dev/Prod Parity
Keep dev, staging, prod and everything in
between as similar as possible
#forcewebinar
X. Dev/Prod Parity
Keep dev, staging, prod and everything in between as similar as possible
dev
sqlite
postgres
stage
mysql
postgres
prod
postgres
postgres
=
≠
=
=
≠
=
#forcewebinar
dev
jetty
null
stage
jetty
null
prod
jboss
null
=
≠
=
=
≠
=
X. Dev/Prod Parity
Keep dev, staging, prod and everything in between as similar as possible
#forcewebinar
XI. Logs
Treat logs as event streams
#forcewebinar
Treat logs as event streams
2014-09-10T22:38:43.427311+00:00 heroku[worker]: ...
2014-09-10T22:38:49.629790+00:00 heroku[web.1]: Starting process...
2014-09-10T22:39:22.056033+00:00 heroku[router]: at=info method=...
2014-09-10T22:38:43.427311+00:00 heroku[postgres]: ...
2014-09-10T22:38:43.427311+00:00 heroku[api]: Release v34 created...
2014-09-10T22:38:49.629790+00:00 heroku[web.1]: Starting process ...
2014-09-10T22:39:22.056033+00:00 heroku[router]: GET mysite.com/ ...
Event Stream
DB Web Worker
XI. Logs
#forcewebinar
XII. Admin Processes
Admin and management tasks should be one-off
processes
#forcewebinar
XII. Admin Processes
Admin and management tasks should be one-off
processes
$ heroku run console
#forcewebinar
XII. Admin Processes
Admin and management tasks should be one-off
processes
web1
web2
web3
admin
#forcewebinar
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
Twelve Factors
#forcewebinar
Further Reading
Heroku DevCenter: devcenter.heroku.com
Spring Boot Example: https://github.com/kissaten/spring-boot-executable
Twitter: @codefinger
#forcewebinarChallenge Yourself! http://developer.salesforce.com/trailhead
• Interactive learning paths
• Earn badges and points
• Declarative and Programmatic
BRAND NEW! Introducing Trailhead
#forcewebinar
New App Builders
http://www.udacity.com/salesforce
http://ccoenraets.github.io/salesforce-
developer-workshop
Developer Workshop
Fast Track Tutorial for Experienced
Developers
Experienced App Builders
More Free Online Tutorials
#forcewebinar
Survey
Your feedback is crucial to the success
of our webinar programs. Thank you!
http://bit.ly/JavaWebinar2015
#forcewebinar
#forcewebinar
Q & A
Joe Kutner
Heroku
@codefinger
Bruce Eckel
MindView
@BruceEckel
James Ward
Salesforce.com
@_JamesWard
Thank You
Thank You

Java Best Practices - Tools, Performance, and Deployment