S1 2GX 2011 - Using Grails on a public facing Fortune 500 website
1. CLICK TO EDIT MASTER TITLE STYLE
Click to edit Master text styles
– Second level
Third level
Using Grails on a public facing
Fortune 500 website
10/26/2011
2. Introduction
Jim Shingler
• Lead Technical Architect for Big Lots
• Beginning Groovy and Grails – Co-Author
• Griffon In Action – Co-Author
• Co-Creator of FallME (IOC Container for JavaME)
• Grails and Griffon plugin contributor
• Speaker
3. Agenda
• Background Biglots.com
• Stats
• Why Grails
• Adopting Grails
• Architecture
• Plugins
• Development Tools and Process
• Performance
• JVM Tuning
• Monitoring
4. BACKGROUND – WWW.BIGLOTS.COM
Biglots is the nation's largest
broadline closeout retailer, Big Lots
has the power to negotiate the best
deals in the business. We sell a broad
range of high-quality, brand-name
products, including consumables,
seasonal items, furniture,
housewares, toys, electronics, home
decor, tools and gifts.
5. BACKGROUND – WWW.BIGLOTS.COM
Lots of Items, over 325K
Not all items in all 1400 stores
Website has to handle this
VERY Dynamic,
High frequency of content change.
6. BACKGROUND – WWW.BIGLOTS.COM
Business Partner – Marketing
Marketing owns website, sets
functional direction, sets functional
priorities, responsible for content
creation and management.
7. BACKGROUND – WWW.BIGLOTS.COM
Business Functional Requirements /
Objectives
Bring Website development in-house
Faster content creation and
deployment
Give Business Partner more control
No Style, Layout Changes
8. BACKGROUND – WWW.BIGLOTS.COM
IT Non-Functional Requirements /
Objectives
Minimize IT Support required
Supportable by IT
Must run on Windows Servers
Must use SqlServer DB
Give Business Partner tools they
need
Java based
48. WHY GRAILS
Background:
Java Shop
Small Shop (140 People in all of IT, 15 Java Devs)
Limited experience w/ Web
Technologies
Use Spring and Hibernate
49. WHY GRAILS
Factors:
Must leverage existing skill sets and
experiences
Has to be easy
Must be rapid
High developer productivity required
Must scale easily
Tool support
Vendor support
50. WHY GRAILS
Some Options Considered:
Struts
JSF / Seam
Wicket
Rails
PHP
Grails
Choose Grails:
Experience implementing Wholesale Handheld System
-Flex, Handheld, and Web interfaces
-Connected to Local DB and SAP
51. WHY GRAILS
Factors:
Must leverage existing skill sets and
experiences
Groovy leverages Java Ecosystem
Groovy leverages Java skill sets
Grails leverage Spring, Hibernate and many
other industry standard frameworks
52. WHY GRAILS
Factors:
Has to be easy
Can use Groovy or Java
Groovy is easy
Grails conventions
Grails easy to move outside of conventions
when you need to
53. WHY GRAILS
Factors:
Must be rapid
Grails development is very addictive, You
get lots done with very little coding
compared to the old ways
Fast results
WARNING: Grails development is very
addictive. MUST TEST
54. WHY GRAILS
Factors:
Highdeveloper productivity required
Groovy and Grails allow great developer
productivity
Developers produce a lot of functionality
quickly
Consistently beating effort estimates
WARNING: Grails development is very
addictive. MUST TEST
55. WHY GRAILS
Factors:
Must scale easily
Grails scales like any other Java Web
application, Same approach.
56. WHY GRAILS
Factors:
Tool support
IDE – STS (Eclipse)
Proven industry standard frameworks
Proven industry standard infrastructure
58. WHY GRAILS
Factors:
Must leverage existing skill sets and
experiences
Has to be easy
Must be rapid
High developer productivity required
Must scale easily
Tool support
Vendor support
59. CLICK TO EDIT MASTER TITLE STYLE
Click to edit Master text styles
– Second level
Third level
ADOPTING GRAILS
61. ADOPTING GRAILS – GRAILS JUMPSTART
TRAINING
http://upload.wikimedia.org/wikipedia/commons/4/4a/CBC_Classroom_1932.jpg
62. ADOPTING GRAILS – GRAILS JUMPSTART
TRAINING
Grails Course
Taught by Jeff Brown
- 4 Day On-Site
- Elected +1 Day Consulting
- 8 developers
Video sample of coarse:
http://www.springsource.com/training/free-online-video-metaprogramming-
groovy
64. ADOPTING GRAILS – BOOKS
Definitive Guide to Grails
December, 2006
Graeme Rocher
January, 2009
2nd Edition
Graeme Rocher, Jeff
Brown
65. ADOPTING GRAILS – BOOKS
Beginning Groovy and Grails
June, 2008
Christopher Judd, Joseph
Nusairat, James Shingler
66. ADOPTING GRAILS – BOOKS
Grails Quick Start
October, 2009
Dave Klein
The Pragmatic Bookshelf
67. ADOPTING GRAILS – BOOKS
Grails In Action
May, 2009
Glen Smith and Peter
Ledbrook
68. ADOPTING GRAILS – BOOKS
Groovy In Action
January, 2007
Dierk Koenig with Andrew
Glover, Paul King, Guillaume
Laforge and Jon Skeet
Summer, 2012
2nd Edition
MEAP 10 Chapters Available
Dierk König, Guillaume
Laforge, Paul King, Jon
Skeet, and Hamlet D'Arcy
70. ADOPTING GRAILS – OTHER RESOURCES
Groovy Mag http://groovymag.com/
Michael
Kismal
71. ADOPTING GRAILS – OTHER RESOURCES
Grails Podcast
http://www.grailspodcast.com
The Grails Podcast is a bi-weekly podcast
about the Groovy scripting language,
the Grails Web Framework and more. It is
run by Glen Smith from Canberra, Australia
and Sven Haiges
72. ADOPTING GRAILS – OTHER RESOURCES
Groovy Blogs http://groovyblogs.org
73. ADOPTING GRAILS – OTHER RESOURCES
Mail Groups and Forums
http://grails.org/Mailing+lists
http://grails.org/Forums
74. ADOPTING GRAILS – OTHER RESOURCES
Twitter – Some people to follow
Graeme Rochere - @graemerocher
Guillaumm Laforge - @glaforge
Jeff Scott Brown - @jeffscottbrown
Dierk Konig- @mittie
Peter Ledbrook - @pledbrook
Burt Beckwith - @burtbeckwith
Paul King- @paulk_asert
Scott Davis - @scottdavis99
Dave Klein - @daveklein
This is a good starting place, . . . . There are many more.
79. ARCHITECTURE - CDN
1 A new user request www.biglots.com
2 Akamai looks for cookie. Since it isn’t set
send the request to BigLots Load
Balancer
3 BigLots Load Balancer sends the request
to an application server
4 Application Server returns response to
BigLots Load Balancer with cookie set
5 BigLots Load Balancer returns response
to Akamai
6 Akamai returns response to user
7 User makes additional request in same
session
8 Akamai looks for cookie. Since it is found,
it is mapped to the appropriate application
server
9 Akamai sends request to the appropriate
application server
10 Application server returns response to
Akamai
11 Akamai returns response to user
82. DEVELOPMENT TOOLS AND PROCESS
IDE: Springsource Tool Suite (STS)
CI: Bamboo
Issue Tracking: Jira
Wiki: Confluence
SCM: Subversion
Browsers: All, Favor Firefox and
Chrome
Local Dev
- Tomcat, MySQL, HSQL, Grails 1.3.7
90. PERFORMANCE & TUNING - JVM TUNING
Log It
-Xloggc:D:apps...logsgc_hnwip00109_ent1.log
-XX:+PrintGC
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintHeapAtGC
-XX:+PrintTenuringDistribution
Manage Sizing
-XX:MaxPermSize=512m <Permanent Gen Size>
-Xms4096m <Old Gen Initial Heap Size>
-Xmx4096m <Old Gen Maximum Heap Size>
-XX:NewSize=1792m <New Gen (nursery) Size>
-Xss384k <Stack Size>
Collectors
-XX:+UseConcMarkSweepGC <Old Gen – Concurrent Collector (Low Pause)>
-XX:+UseParNewGC <Young Gen - Parallel Collect (Low Pause)>
-XX:+CMSClassUnloadingEnabled <GC Sweep PermGen – Remove Unused Classes>
91. PERFORMANCE & TUNING
Manage Static Content / Assets
Use a Web Server and Application
Server
Move Static Content to Web Server
and Content Delivery Network (CDN)
What
happened?
92. PERFORMANCE & TUNING
Manage Static Content / Assets
Use Best Practices
http://stevesouders.com/hpws/rules.php
http://developer.yahoo.com/performance/rules.html
http://juddsolutions.com/downloads/10_performance_tips.pdf
93. PERFORMANCE & TUNING
In efficient code
list.each{item -> …} vs for(item in list)
Closure
Vs
Code Block
Advice: You might want to see
how it impacts your
application
95. PERFORMANCE & TUNING
In efficient code
Learn more about Groovy and Grails
http://blog.springsource.com/2010/06/23/gorm-gotchas-part-1/
http://blog.springsource.com/2010/07/02/gorm-gotchas-part-2/
http://blog.springsource.com/2010/07/02/gorm-gotchas-part-3/
Tuning Your Grails Applications
http://www.youtube.com/watch?v=gl83-80Qq94
96. CLICK TO EDIT MASTER TITLE STYLE
Click to edit Master text styles
– Second level
Third level
MONITORING
97. MONITORING - OPERATIONAL
Internal Monitoring: Detailed information on the
server (Box), Web Server (IIS), Application
Server (TC), Applications
Internal Monitoring: Alerting server
(Box), OS, Server Logs, Application Logs
External Monitoring: User Experience, Runs
scripts around the country.
External Monitoring: Constantly monitoring
security of the web sites
98. MONITORING - ANALYTICAL
External Monitoring: All of the analytics that the
business people want
External Monitoring: More analytics
External Edge Monitoring: Unique
Visitors, Popular pages, Errors, …
100. Q & A DISCUSSION
Question and Answer
Discussion
@JShingler
http://www.linkedin.com/in/jimshingler
http://jshingler.blogspot.com/
ShinglerJim at gmail.com
101. CLICK TO EDIT MASTER TITLE STYLE
Click to edit Master text styles
– Second level
Third level
Thank You
Editor's Notes
Early DaysNew StoreCorp Conf CallStore LocatorCorpCorp Conf CallInvestor RelationsCommunity RelationsJobsNews Center
Online AdsTipsEmail Campaigns
Advertisements (Furnature)Toys For TotsWholesale Business
-Redesign-Buzz Screens More Ads-Aisle By Aisle
Departments / CatalogsDealsMore Ads
More Refinement
Site Redesign CleanerAll about Retail Separate Corp SiteBuzzClub more pronounced
Grails Port**Introduced Search capability BIG HIT 3rd most popular page
Featured Items
Help Customer Find Store
Third Party Partner for Flash / HTML Ads
Buzz Club-How long until I get a reward
Accoutn Info and what your interested in and more Ads
Items in a catalogBreadcrumbsMulti Page / View All / Sort
Details on individual itemSocial Media LinksRelated Items “Might Also Like”
Campaigns – Emails-Coordinated with website changesDrive Customers to the website2-3 Emails / Week
18 Release in a little less than a yearBlue are Major ReleaseRed Minor / bug fixGreen Special Event
StatsPages hitsRequestsResponse time (Different Parts of Country)
StatsPages hitsRequestsResponse time (Different Parts of Country)
~ 160K / Hr
~2M / Day
~10M Week
~35M / Month
~40K / Hr
~550K / Day
~2M / Week
~6.5M Month
StatsPages hitsRequestsResponse time (Different Parts of Country)
Stats2010 – Load Times and Fully Loaded TimeSignificantly Faster
StatsPages hitsRequestsResponse time (Different Parts of Country)
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Why GrailsOptions InvestigateStrutsJSF / SeamWicketRailsGrailsPHPBiglots is a Java ShopChoose Grails Experience implimenting Wholesale Handheld SystemFlex, Handheld, and Web interfacesConnected to Local DB and SAP
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
Adopting Grails
ArchitecturePictureDMZLoad BalancerApplication ServerDatabase ServerHyperic ServerTwo NodesIIS over 4 TomcatsSearch – Started with Searchable, Switching to Elastic
ArchitecturePictureDMZLoad BalancerApplication ServerDatabase ServerHyperic ServerTwo NodesIIS over 4 TomcatsSearch – Started with Searchable, Switching to Elastic
ArchitecturePictureDMZLoad BalancerApplication ServerDatabase ServerHyperic ServerTwo NodesIIS over 4 TomcatsSearch – Started with Searchable, Switching to Elastic
ArchitecturePictureDMZLoad BalancerApplication ServerDatabase ServerHyperic ServerTwo NodesIIS over 4 TomcatsSearch – Started with Searchable, Switching to Elastic