57
Production Ready Web Services with Dropwizard Portland Java User Group May 15, 2012 Sean Sullivan

Production Ready Web Services with Dropwizard

  • Upload
    sullis

  • View
    9.135

  • Download
    0

Embed Size (px)

DESCRIPTION

Portland Java User GroupMay 15, 2012

Citation preview

Page 1: Production Ready Web Services with Dropwizard

Production Ready Web Services with Dropwizard

Portland Java User GroupMay 15, 2012Sean Sullivan

Page 3: Production Ready Web Services with Dropwizard
Page 4: Production Ready Web Services with Dropwizard

• Gilt Groupe

• Dropwizard project

• Dropwizard at Gilt

Page 5: Production Ready Web Services with Dropwizard

Gilt Groupe

Page 6: Production Ready Web Services with Dropwizard

online retailer

Page 7: Production Ready Web Services with Dropwizard

May 2011

Page 8: Production Ready Web Services with Dropwizard

April 2012

Page 9: Production Ready Web Services with Dropwizard

What does Gilt sell?

Page 10: Production Ready Web Services with Dropwizard

Apparel

Page 11: Production Ready Web Services with Dropwizard
Page 12: Production Ready Web Services with Dropwizard
Page 13: Production Ready Web Services with Dropwizard
Page 14: Production Ready Web Services with Dropwizard

Kids toys and apparel

Page 15: Production Ready Web Services with Dropwizard
Page 16: Production Ready Web Services with Dropwizard

Home furnishings

Page 17: Production Ready Web Services with Dropwizard
Page 18: Production Ready Web Services with Dropwizard

Food

Page 19: Production Ready Web Services with Dropwizard
Page 20: Production Ready Web Services with Dropwizard

Local deals

Page 21: Production Ready Web Services with Dropwizard
Page 22: Production Ready Web Services with Dropwizard

Travel

Page 23: Production Ready Web Services with Dropwizard
Page 24: Production Ready Web Services with Dropwizard

Gilt technology

Page 25: Production Ready Web Services with Dropwizard

Portland NYC Dublin

Page 26: Production Ready Web Services with Dropwizard
Page 27: Production Ready Web Services with Dropwizard

Service oriented architecture

Page 28: Production Ready Web Services with Dropwizard

shopping cart service

checkout service

email service

payment service

product service

Page 29: Production Ready Web Services with Dropwizard

internal “service framework”

image credit: dealwithitportland.com

Page 30: Production Ready Web Services with Dropwizard

Dropwizard

Page 31: Production Ready Web Services with Dropwizard
Page 32: Production Ready Web Services with Dropwizard
Page 33: Production Ready Web Services with Dropwizard

• Jetty

• Jersey

• Jackson

• JDBI

• logback

• Yammer Metrics

• Google Guava

• Hibernate Validator

“Dropwizard consists mostly of glue code to automatically connect and configure these components”

Page 34: Production Ready Web Services with Dropwizard

Dropwizard modules

• dropwizard-core

• dropwizard-client

• dropwizard-db

• dropwizard-auth

• dropwizard-scala

• dropwizard-views

• dropwizard-testing

Page 35: Production Ready Web Services with Dropwizard

<dependencies> <dependency> <groupId>com.yammer.dropwizard</groupId> <artifactId>dropwizard-core</artifactId> <version>0.4.0</version> </dependency> <dependency> <groupId>com.yammer.dropwizard</groupId> <artifactId>dropwizard-scala</artifactId> <version>0.4.0</version> </dependency></dependencies>

Maven pom.xml

Page 36: Production Ready Web Services with Dropwizard

Java services extend com.yammer.dropwizard.Service

+

Page 37: Production Ready Web Services with Dropwizard

Scala services extend com.yammer.dropwizard.ScalaService

+

Page 38: Production Ready Web Services with Dropwizard

Service configuration

Page 39: Production Ready Web Services with Dropwizard

YAML + config class

Page 40: Production Ready Web Services with Dropwizard

import com.yammer.dropwizard.config.Configuration;

public class MyServiceConfiguration

extends Configuration {

// your config stuff

}

Page 41: Production Ready Web Services with Dropwizard

Other config

• com.yammer.dropwizard.config.HttpConfiguration

• com.yammer.dropwizard.config.LoggingConfiguration

• com.yammer.dropwizard.db.DatabaseConfiguration

Page 42: Production Ready Web Services with Dropwizard

Hello world

Page 43: Production Ready Web Services with Dropwizard
Page 44: Production Ready Web Services with Dropwizard

$ git clone git://github.com/sullis/dropwizard-helloworld.git

$ cd dropwizard-helloworld

$ mvn clean package

$ ./bin/dev.sh

Compile and run

Page 46: Production Ready Web Services with Dropwizard

Dropwizard at Gilt

Page 47: Production Ready Web Services with Dropwizard

gift certificate service

fraud service

Page 48: Production Ready Web Services with Dropwizard

Gift certificate demo

Page 49: Production Ready Web Services with Dropwizard

• Jackson ObjectMapper configuration

• Log4j appender config

• ZooKeeper registration

• MessagingManager class

dropwizard-gilt

Page 50: Production Ready Web Services with Dropwizard

https://groups.google.com/d/topic/dropwizard-user/sGEi3i8W1tY/discussion

Hibernate Validator + Scala case classes

Page 52: Production Ready Web Services with Dropwizard

SOA challenges

• deployment

• QA

• monitoring

• debugging

Page 53: Production Ready Web Services with Dropwizard

Questions?

Page 54: Production Ready Web Services with Dropwizard

THE END

Page 55: Production Ready Web Services with Dropwizard

Bonus slides

Page 56: Production Ready Web Services with Dropwizard

“Monitoring and QA are the same thing. You'd never think so until you try doing a big SOA. But when your service says "oh yes, I'm fine", it may well be the case that the only thing still functioning in the server is the little component that knows how to say "I'm fine, roger roger, over and out" in a cheery droid voice. In order to tell whether the service is actually responding, you have to make individual calls. The problem continues recursively until your monitoring is doing comprehensive semantics checking of your entire range of services and data, at which point it's indistinguishable from automated QA”

http://bit.ly/pityk6Steve Yegge, October 2011

Page 57: Production Ready Web Services with Dropwizard

http://bit.ly/pityk6Steve Yegge, October 2011

“If you have hundreds of services, and your code MUST communicate with other groups' code via these services, then you won't be able to find any of them without a service-discovery mechanism. And you can't have that without a service registration mechanism, which itself is another service. So Amazon has a universal service registry where you can find out reflectively (programmatically) about every service, what its APIs are, and also whether it is currently up, and where”