s1 2gx 2011 - using grails on a public facing fortune 500 website

101
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

Upload: jim-shingler

Post on 10-May-2015

35.075 views

Category:

Technology


1 download

DESCRIPTION

Using Grails on a public facing Fortune 500 website

TRANSCRIPT

Page 1: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 2: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 3: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

AGENDA

• Background Biglots.com• Stats• Why Grails• Adopting Grails• Architecture• Plugins• Development Tools and Process• Performance• JVM Tuning• Monitoring

Page 4: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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.

Page 5: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Lots of Items, over 325KNot all items in all 1400 storesWebsite has to handle this

VERY Dynamic, High frequency of content change.

Page 6: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Business Partner – Marketing

Marketing owns website, sets functional direction, sets functional priorities, responsible for content creation and management.

Page 7: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 8: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

IT Non-Functional Requirements / Objectives

Minimize IT Support requiredSupportable by ITMust run on Windows ServersMust use SqlServer DBGive Business Partner tools they

needJava based

Page 9: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

http://rachelmariepaquin.files.wordpress.com/2011/02/tardis_2.jpg

Page 10: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM12/2003

Source: http://wayback.archive.org/web/*/http://www.biglots.com

Page 11: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

12/2004

Page 12: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

12/2005

Page 13: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

12/2006

Page 14: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

12/2007

Page 15: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

12/2008

Page 16: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

12/2009

Page 17: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

02/2011

Page 18: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Today

Page 19: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Biglots.com Corporate Lots2Give.com

KioskStoreLocator Services

Page 20: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Store LocatorAdvanced JavaScript

Google Maps

Page 21: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Weekly AdI2O Integration

Flash AdHTML Ad

Page 22: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Rewards ClubBack Office Integration

Web Services

Page 23: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Rewards ClubAccount Maint.

Back Office IntegrationWeb Services

Page 24: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Search Results Searchable / Elastic

Search Plugin

Page 25: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

DepartmentDynamic Changing

Images

Page 26: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

CatalogDynamic Items

PagingSorting

Breadcrumbs

Page 27: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

BACKGROUND – WWW.BIGLOTS.COM

Item DetailsSharing: Email, Twitter,

Facebook, . . . Might also like

Page 28: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CAMPAIGNS - EMAIL

Page 29: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WWW.BIGLOTS.COM

Page 30: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS

http://g-ecx.images-amazon.com/images/G/01/ciu/55/9c/5663228348a072b6d4473110.L._AA300_.jpg

Page 31: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS

Page ViewsPer Hour / Day / Week / Month / Qtr

Unique visitorsPer Hour / Day / Week / Month / Qtr

Frequency of Content Change5-15 / Week (Old Site 3-5 / Week)

Page 32: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CLICK TO EDIT MASTER TITLE STYLE

Click to edit Master text styles– Second level

Third level

PAGE VIEWS

Page 33: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – PAGE VIEWS (HOUR)

Page 34: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – PAGE VIEWS (DAY)

Page 35: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – PAGE VIEWS (WEEK)

Page 36: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – PAGE VIEWS (MONTH)

Page 37: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CLICK TO EDIT MASTER TITLE STYLE

Click to edit Master text styles– Second level

Third level

UNIQUE VISITORS

Page 38: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – UNIQUE VISITORS (HOUR)

Page 39: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – UNIQUE VISITORS (DAY)

Page 40: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – UNIQUE VISITORS (WEEK)

Page 41: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – UNIQUE VISITORS (MONTH)

Page 42: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CLICK TO EDIT MASTER TITLE STYLE

Click to edit Master text styles– Second level

Third level

MORE STATS

Page 43: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS

What happened?

Page 44: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS – WEBPAGETEST.ORG

Page 45: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

STATS

Page 46: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Why

Page 47: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Why Not?

Page 48: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Background: Java ShopSmall Shop (140 People in all of IT, 15 Java

Devs)

Limited experience w/ Web Technologies

Use Spring and Hibernate

Page 49: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 50: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Winner

Page 51: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Factors: Must leverage existing skill sets and

experiences

Groovy leverages Java EcosystemGroovy leverages Java skill setsGrails leverage Spring, Hibernate and

many other industry standard frameworks

Page 52: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Factors: Has to be easy

Can use Groovy or JavaGroovy is easyGrails conventions Grails easy to move outside of

conventions when you need to

Page 53: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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 resultsWARNING: Grails development is very

addictive. MUST TEST

Page 54: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Factors: High developer productivity requiredGroovy and Grails allow great

developer productivityDevelopers produce a lot of

functionality quicklyConsistently beating effort estimates

WARNING: Grails development is very addictive. MUST TEST

Page 55: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Factors: Must scale easily

Grails scales like any other Java Web application, Same approach.

Page 56: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Factors: Tool support

IDE – STS (Eclipse)Proven industry standard frameworksProven industry standard infrastructure

Page 57: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

WHY GRAILS

Factors: Vendor support

The company behind Groovy and Grails

Page 58: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 59: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CLICK TO EDIT MASTER TITLE STYLE

Click to edit Master text styles– Second level

Third level

ADOPTING GRAILS

Page 60: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS

Multipronged approach– Jumpstart– Books– Other Resources

Page 61: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – GRAILS JUMPSTART TRAINING

http://upload.wikimedia.org/wikipedia/commons/4/4a/CBC_Classroom_1932.jpg

Page 62: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 63: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS - BOOKS

http://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/Statistics_norway_library.jpg

Page 64: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – BOOKS

Definitive Guide to GrailsDecember, 2006Graeme Rocher

January, 20092nd Edition

Graeme Rocher, Jeff Brown

Page 65: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – BOOKS

Beginning Groovy and Grails

June, 2008Christopher Judd, Joseph Nusairat, James Shingler

June, 2008Christopher Judd, Joseph Nusairat, James Shingler

Page 66: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – BOOKS

Grails Quick Start

October, 2009Dave Klein

The Pragmatic Bookshelf

Page 67: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – BOOKS

Grails In Action

May, 2009Glen Smith and Peter

Ledbrook

Page 68: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – BOOKS

Groovy In Action

January, 2007Dierk Koenig with Andrew

Glover, Paul King, Guillaume Laforge and Jon Skeet

Summer, 20122nd Edition

MEAP 10 Chapters AvailableDierk König, Guillaume Laforge, Paul King, Jon

Skeet, and Hamlet D'Arcy

Page 69: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – BOOKS

Other Books

Page 70: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – OTHER RESOURCES

Groovy Mag http://groovymag.com/

MichaelKismal

Page 71: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – OTHER RESOURCES

Grails Podcast http://www.grailspodcast.comThe 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

Page 72: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – OTHER RESOURCES

Groovy Blogs http://groovyblogs.org

Page 73: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – OTHER RESOURCES

Mail Groups and Forumshttp://grails.org/Mailing+listshttp://grails.org/Forums

Page 74: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ADOPTING GRAILS – OTHER RESOURCESTwitter – Some people to follow

Graeme Rochere - @graemerocher

Guillaumm Laforge - @glaforgeJeff Scott Brown -

@jeffscottbrownDierk Konig- @mittiePeter Ledbrook - @pledbrookBurt Beckwith - @burtbeckwithPaul King- @paulk_asertScott Davis - @scottdavis99Dave Klein - @daveklein

This is a good starting place, . . . . There are many more.

Page 75: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE

http://www.besthousedesign.com/wp-content/uploads/2008/10/openhouse-xten-02.jpg

Page 76: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE

Page 77: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE

X 2

Page 78: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE

X 4

Page 79: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE - CDNA new user request www.biglots.com

Akamai looks for cookie. Since it isn’t set send the request to BigLots Load Balancer

BigLots Load Balancer sends the request to an application server

Application Server returns response to BigLots Load Balancer with cookie set

BigLots Load Balancer returns response to Akamai

Akamai returns response to user

User makes additional request in same session

Akamai looks for cookie. Since it is found, it is mapped to the appropriate application server

Akamai sends request to the appropriate application server

Application server returns response to Akamai

Akamai returns response to user

1

2

3

4

5

6

7

8

9

10

11

Page 80: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE – FUNCTIONAL PLUGINS

Spring Security Core Spring Cache Elastic Search (Previously Searchable) Quartz Mail JQuery JQuery UI CKeditor Export Ref Code Sanitizer Recaptcha

Page 81: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

ARCHITECTURE – DEVELOPMENT PLUGINS

Code NarcGMetricsCode CoverageMelody

Page 82: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

DEVELOPMENT TOOLS AND PROCESS

IDE: Springsource Tool Suite (STS)

CI: BambooIssue Tracking: JiraWiki: ConfluenceSCM: SubversionBrowsers: All, Favor Firefox and

ChromeLocal Dev

- Tomcat, MySQL, HSQL, Grails 1.3.7

Page 83: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

DEVELOPMENT TOOLS AND PROCESS

Environments– Local– Dev– QA– Staging– Prod

Page 84: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

http://www.greatoccupations.com/wp-content/uploads/2010/02/measure.jpg

Measure !!!Don’t Guess

Page 85: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

javamelody

JMXGoogle Page

Speed

YSlow

HTTPFox

Page 86: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

Reduce DB CallsTune Garbage CollectionManage Static Content / AssetsIn efficient code

Page 87: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

Reduce DB CallsHibernate Caching

http://grails.org/doc/latest/guide/single.html#5.5.2.2 Caching Strategy

Examine Lazy vs Eager Fetch http://grails.org/doc/latest/guide/single.html#5.3.4 Eager and Lazy Fetching

Higher Level Caching using Spring Cache

Indexes (DB Access Analysis) http://grails.org/doc/latest/ref/Database%20Mapping/indexColumn.html

Page 88: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

Tune Garbage CollectionTools: Visual VM, Hyperic, OthersAvoid / Reduce GC Pause

Easier with multi core server

Additional Resources http://www.slideshare.net/kensipe/debugging-your-production-jvm

Page 89: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING - JVM TUNING

Page 90: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING - JVM TUNINGLog It

-Xloggc:D:\apps\...\logs\gc_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>

Page 91: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

Manage Static Content / AssetsUse a Web Server and

Application ServerMove Static Content to Web

Server and Content Delivery Network (CDN)

What happened?

Page 92: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

Manage Static Content / AssetsUse Best Practices

http://stevesouders.com/hpws/rules.php

http://developer.yahoo.com/performance/rules.html

http://juddsolutions.com/downloads/10_performance_tips.pdf

Page 93: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

In efficient codelist.each{item -> …} vs for(item

in list) ClosureVs

Code Block

Advice: You might want to see how it impacts your

application

Page 94: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

In efficient codeBest Practices

Cobertura

Page 95: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

PERFORMANCE & TUNING

In efficient codeLearn more about Groovy and

Grails

Tuning Your Grails Applications

http://www.youtube.com/watch?v=gl83-80Qq94

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/

Page 96: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CLICK TO EDIT MASTER TITLE STYLE

Click to edit Master text styles– Second level

Third level

MONITORING

Page 97: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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

Page 98: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

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, …

Page 99: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

SECURITY

External Monitoring: Constant Security Monitoring

Internal Monitoring: QA Time Security Check

Page 100: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

Q & A DISCUSSION

Question and Answer

Discussion

@JShinglerhttp://www.linkedin.com/in/jimshingler

http://jshingler.blogspot.com/ShinglerJim at gmail.com

Page 101: S1 2GX 2011 - Using Grails on a public facing  Fortune 500 website

CLICK TO EDIT MASTER TITLE STYLE

Click to edit Master text styles– Second level

Third level

Thank You