java in cloud - adopt cloud dev's dharma
TRANSCRIPT
Java in Cloud — adopt Cloud Dev’s DHARMA
Hochi Chuang Sr Backend Engineer
Here2Shop.com
About me• Experiences
• Java experience - J2SE, Android, JEE
• Automation
• DevOps
• Here2Shop.com
• High volume eCommerce platform
• B2B2C - platform for both vendors and consumers
• Small team with demonstrated ideas/skills to achieve big dream!!
• We’re HIRING!!! —> send your resume to [email protected]
DHARMA Concepts• Cloud Developer’s DHARMA - JavaOne 2014
• Documented
• Highly cohesive/loosely coupled
• Automated from commit to Cloud
• Resource aware
• Monitored thoroughly
• Antifragile
Why Cloud?• Our goal
• Going BIG!!
• Flawless — hope so!!?
• Scale horizontally
• Fully automated
• High availability and quick response
Why Java?• Our goal
• Going BIG!! — proven
• Flawless — mature & conventions
• Fully automated — perfect integrated with Jenkins
• Lots of resources & community support
• Utilise AWS services to let us focus on core business implementations
Before You Go• AWS — tips should know before I started
• VPC
• Security groups
• Disable SSH to all servers
• Use AWS SDK for Java
• Centralised logs
• Automates everything
• IAM for access control
DHARMA• Documented
• Everything related to development process — Redmine wiki
• Instructions for newbie
• Development process — DO and DON’T
• Coding conventions, code formatting, Eclipse settings
• Environment setup, tools installation
• CI and release cycle
DHARMA• Technologies
• Architectural diagram
• Software layers
• API Docs — swagger
• Testing — unit / api / gui tests
• Security
DHARMA• Highly cohesive/loosely coupled
• Class level
• Single responsibility / interfaces
• Component level
• Divided by data stores / RESTful APIs
DHARMA• Automated from commit to cloud
• Jenkins!!
• Each commit — build + unit test
• Daily build — build + unit / api / gui test
• Deploy to Dev or Staging by promoting the build
• UAT on staging —> promote to production
DHARMA• Jenkins setup
• Build pipeline
• https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin
• Promoted build plugins
• https://wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin
DHARMA• Resource aware
• SES — starting quota 10,000/day, 5/sec
• S3 bucket per account — 100
• S3 bucket name: use ‘-’ instead of ‘.’ — SSL
• RDS IOPS — 3 IOPS / GB
DHARMA• Monitoring thoroughly
• For usage
• CloudWatch — instance metrics
• CloudTrail — API access logs
• For better security/details
• WAF — F5
• Nagios — company intranet and centralised logs on AWS
• Centralised, accessible and graph !!
DHARMA• Monitoring thoroughly
• Diagnostic tools
• top, htop, iftop, netstat, tcpdump, wireshark
• Java utils: jps, jstat, jmap, jhat, hprof
• Profiling tools: jProfiler, MAT, spring-insight
DHARMA• Antifragile
• In opposite to fragile — Application must be ROBUST
• Design for failure — Cloud Design Patterns
• retries — guava-retrying
• circuit-breaker — Netflix Hystrix
DHARMA• Antifragile
• Elastic Scaling
• Stateless components
• Distributed data stores — RDS / MongoDB / S3
• Caching — ElastiCache
• Search — CloudSearch