View
327
Download
2
Category
Preview:
Citation preview
1 Cloud Saturday Atlanta
David Scruggs@davescruggsPrincipal Solution Engineer, Salesforce
Introduction to the Heroku Platform
2 Cloud Saturday Atlanta
David Scruggs Salesforce I need to restart my blog dscruggs@salesforce.com @davescruggs I started off doing robotics work in the early 1990’s, then
moved to startups through the rest of the 90’s. Afterwards, I’ve been a technical specialist in Java, .NET, and Cloud technologies for the past 15 years.
My Bio
3 Cloud Saturday Atlanta
Platinum Sponsors
4 Cloud Saturday Atlanta
Gold Sponsors
5 Cloud Saturday Atlanta
See website for more info and directions
atlanta.cloudsaturday.com
Continue the conversation…
6 Cloud Saturday Atlanta
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 any litigation, risks associated with completed and any 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-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These 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.
Safe Harbor
7 Cloud Saturday Atlanta
A proven system with
a manifesto,
a methodology,
a collection of experiences
Having the goals
scalability,
maintainability,
portability
And usesdeclarative
setup
clean contracts
minimum divergence
Heroku is an opinionated PaaS based on a 12-Factor philosophy that is
8 Cloud Saturday Atlanta
Codebase:• One codebase
tracked in revision control, many deploys
Dependencies:• Explicitly declare
and isolate dependencies
Config:• Store config in the
environment
Backing Services:• Treat backing
services as attached resources
Build, release, run:• Strictly separate
build and run stages
Processes:• Execute the app as
one or more stateless processes
Port binding:• Export services via
port binding
Concurrency:• Scale out via the
process model
Disposability:• Maximize
robustness with fast startup and graceful shutdown
Dev/prod parity:• Keep development,
staging, and production as similar as possible
Logs:• Treat logs as event
streams
Admin processes:• Run
admin/management tasks as one-off processes
12 Factor Philosophy
9 Cloud Saturday Atlanta
Dynos:Run virtually any language at scale
Database:Enterprise Postgres
as a service
Add-ons:Marketplace for
logging, data and more
What is Heroku? A Proven Service to Build, Run and Scale Apps
10 Cloud Saturday Atlanta
Supported Languages
• Ruby• Node.js• Java• Python• PHP
Buildpacks• Dart• GO!• Scala• Clojure• Erlang• Perl• and more…
Data stores• Postgres• Redis• Mongo• CouchDB• Hadoop• MySQL• Elasticsearch• Neo4j
Heroku supports modern software development
11 Cloud Saturday Atlanta
Fork
Follow
Continuous Protection
Multi-Ingress
High Availability
Rollback
Dataclips
Automated Health Checks
Heroku Postgres Database Experience
12 Cloud Saturday Atlanta
DbX
DB Operations
Core Postgres
Cloud Infrastructure
Performance analysisData clips
ForkingWeb & command line interfaces
Data rollbackFollowers
Optimized configurationContinuous protectionHigh availabilityEncryption at restCustom SLAsAutomated monitoringOS and database patching
Heroku Postgres DbX – Beyond advanced DB operations
Open sourceObject-relational database
SQL: 2011 standardIntegrate with ORCL / MS-SQLMigrate from ORCL / MS-SQL
13 Cloud Saturday Atlanta
Heroku Elements: Add on Catalog
14 Cloud Saturday Atlanta
Over 150 Add Ons, 900 Buildpacks, and 1700 buttons
Easily plug new functionality into your app
Pick and choose technologies, try new features easily
Data Stores / Search / Caching Logging / Analytics / Monitoring Email and SMS Workers and Queuing Media Payments Utilities
Heroku Elements
15 Cloud Saturday Atlanta
Elastic Load Balancing
Cont
rol S
urfa
ce A
PIsDeveloper
Code• Java• Ruby• Node.js• Clojure …
Deploy• GIT
Manage• Heroku CLI• Scaling• Monitoring
User• Web browser Access• API access
HTTP
(S)
REST
Heroku Architecture
16 Cloud Saturday Atlanta
• A Dyno is a single process of any type running on the Heroku platform.
• This can include web processes, worker processes (such as timed jobs and queuing systems), and any process types declared in the app’s Procfile.
What is a Dyno ?
17 Cloud Saturday Atlanta
• The number of Dynos allocated for your app can be increased or decreased at any time - without any server provisioning.
Elasticity :
• The routing mesh tracks the location of all web Dynos and routes HTTP traffic to them accordingly.
Intelligent routing :
• Each Dyno process is monitored for responsiveness. Misbehaving Dynos are taken down and new Dynos are launched in their place.
Process management :
• Dynos are distributed across a distributed execution environment known as the Dyno manifold. An app configured with two web Dynos is running 2 processes but each process runs in a separate physical location. If a machine goes down, your app stays up.
Distribution and redundancy :
• Every Dyno is completely isolated in its own sub-virtualized container, with many benefits for security, resource guarantees and overall robustness.
Isolation :
Dyno Features
18 Cloud Saturday Atlanta
• Slugs are compressed packages optimized for lightning fast distribution across the Dyno grid• When you ‘git push’ to Heroku, the slug compiler transforms your repository into a slug
• Compilation• Create a fresh checkout from the master branch• Download, build and install dependencies (gemfile, pom.xml, package.json,…)• Remove unused files
• git directory, log, tmp, local build dependencies such as .gem files, .slugignore• Write into the slug• Also when config var or add-on is changed
• Package into the final slug archive• Slug size
• Small < 15MB• Medium ~ 30MB• Weighty 40MB+
• Consider removing unneeded dependencies, use .slugignore to remove unneeded files• Maximum slug size == 100MB
The Slug compiler
19 Cloud Saturday Atlanta
• Web• Only process accessible over http(s)
• Worker• Background processes
• Clock• Run at scheduled intervals
• Processes can scale independently
• Process diversity gives you more granular control over where to add resources
Process Types
20 Cloud Saturday Atlanta
Command Line at your desktop, in the web console …
…or while you’re having lunch
• Realtime up/downscaling, in seconds• Automatic load balancing• Share nothing ! Use memchache, REST principles ..
in your code• Single web Dyno apps idle out eventually
Dyno Scaling
21 Cloud Saturday Atlanta
Heroscale.com• “The hardest question to answer”
• Almost always app specific• Increasing Dyno A could kill Dyno B• Are you bottlenecking on code or in the DB layer ?• A bit like “just throw hardware at the problem”
• Heroku does provide metrics via logging• Queue depth (how many requests waiting)• Wait Time (for how long)
• Requests ‘wait’ in the routing mesh• You could script grep | if/then | heroku scale logic
• Add-ons exist but might not give the granularity you need
How To Auto-scale ?
22 Cloud Saturday Atlanta
• Dyno manifold • offers an isolated execution environment for Dyno’s in the process formation and Dyno’s
run as one-off admin processes
• LXC (Linux Containers)• Open source, lightweight virtual system• Resource and process table isolation• Not a VM like KVM, Xen, …
• chroot• Filesystem isolation
• Ephemeral Filesystem• gets fresh copy of most recently deployed code• can be used as ‘scratchpad’ but files are not visible to other Dyno’s (even in the same app)• discarded when Dyno’s stop / restart
• Advantages over Server based deployment• Isolated Dyno’s don’t compete for resources (CPU, Mem,..) and can not starve other Dyno’s• Overloaded apps can not ‘block’ the administrators out because of completely unresponsive
servers
Dyno Isolation
23 Cloud Saturday Atlanta
• The routing mesh will take care of routing Http request to your Dyno(s)
• The heroku.com HTTP stack• Requests enter through Nginx (SSL and Gzip)• Varnish = reverse proxy cache • Cached for GET requests, uses your caching headers• POST is bypassed
• 30 second timeout• HTTP 1.0 compliant• No long polling or chunked responses
• One connection at a time
• The herokuapp.com HTTP stack• Request enter through load balancer with HTTP and SSL termination• Direct path to your Dyno’s• Allows for chunked responses, long polling• HTTP 1.1 compliant• No implicit caching - Use rack-cache or memcache add-on• 30 second to return first reponse data, then a 55 second rolling window timeout• Async or multithreaded apps can handle multiple connections• Response compression needs to be done in your application
Http Routing
24 Cloud Saturday Atlanta
• Can you beat the forces of entropy that affect any running app :• OS upgrades, kernel patches, infrastructure software upgrades• Disks filling up• Dependent or sub-processes crashing• Hardware failure
• Heroku is Erosion-resistant• Dyno manifold automatically monitors your processes• Crashed processes are automatically restarted• Heroku ops team keep OS and other underlying components up to date
without having to bring down any running app.• PostgreSQL, database.com are fully managed and monitored without
intervention from the app owner• Dyno’s are restarted every 24 hours, so design for this
Erosion Resistance
25 Cloud Saturday Atlanta
• Heroku Shared PostgreSQL• ‘’Traditional’ RDBMS• Configured by default and automatically• Suitable for development and staging
• Heroku Dedicated PostgreSQL• Multiple packages to choose from• Direct database connectivity (psql / libpq)• Instant provisioning and customer driven migrations• PostgreSQL 8.4.4 & 9.x support• Stored Procedures• Improved backup,restore, import through pgbackups
add-on.
Database Storage
26 Cloud Saturday Atlanta
• Database.com• Identity & access management• Built-in Backup & DR• Social API• Data API• Developer libraries for Ruby, Java, iOS, PHP, …• Mobile apps
• Add-ons for pretty much every scenario• Amazon RDS• Redis-to-go (High performance, in memory key-value store)• ClearDB (Cloud based MySQL)• Cloudant (CouchDB, document based storage engine)• MongoLab, MongoHQ (MongoDB document based storage)• Amazon S3 (File Storage)
Database Storage
27 Cloud Saturday Atlanta
• Logs are a stream of time-ordered events aggregated from the output streams of all your app’s running processes, system components, and backing services. Heroku’s Logplex routes all log streams into a single channel for comprehensive logging.• App Logs• System Logs• API Logs
• Your app logs by writing to stdout / stderr• Logs are available from CLI or consumed by add-ons such as NewRelic
$ heroku logs --source heroku --ps router2010-09-16T15:13:46-07:00 heroku[router]: GET myapp.heroku.com/posts queue=0 wait=0ms service=1ms bytes=975$ heroku logs -s app2010-09-16T15:13:46-07:00 app[web.1]: Processing PostController#list (for 208.39.138.12 at 2010-09-16 15:13:46) [GET]2010-09-16T15:13:47-07:00 app[worker.1]: 2 jobs processed at 16.6761 j/s, 0 failed ...$ heroku logs -s app -p worker.12010-09-16T15:13:47-07:00 app[worker.1]: 2 jobs processed at 16.6761 j/s, 0 failed ...
Monitoring and Logging
28 Cloud Saturday Atlanta
3rd party : NewRelic add-on• 24x7 Transaction Analysis and BreakdownComponent-level
views of individual transactions• Real User Analysis and BreakdownIn-depth, page-by-page
analysis• Database Analysis and BreakdownDeep visibility into SQL
statements and EXPLAINS• Error Detection and AnalysisDrill down into server errors• Reporting and OptimizationCapacity, Scalability, Long-Term Perf,
and SLA reports• Proactive AlertingImmediate notification of potential issues
Monitoring and Logging
29 Cloud Saturday Atlanta
• set up a new app heroku create
• first push to the new app git push heroku
• change something, push it again git push heroku
• Scale heroku ps:scale web=??
Deploying to Heroku
30 Cloud Saturday Atlanta
• They cover all of the supported languages.
Getting Started Guides (https://devcenter.heroku.com/start)
• High level metrics to monitor your applications
Dashboard (https://dashboard.heroku.com)
• A great resource for learning about the platform, and how to effectively use it.
Dev Center (https://devcenter.heroku.com)
• a good paradigm for building scaleable, portable apps in the cloud.
12 Factor App (http://12factor.net)
• An expert at Heroku. • Schedule meetings with your assigned TAM, to get detailed advice on best practices and help with scaling, load testing,
and architecture.
Technical Account Manger
Developer Tools
31 Cloud Saturday Atlanta
DEMOLet’s get started
32 Cloud Saturday Atlanta
How would I build an app from scratch?
rails new <app name>cd <app name>start your killer appheroku creategit push heroku masteriterate
So, we just deployed a pre-building application
33 Cloud Saturday Atlanta
Bring your favorite language - https://devcenter.heroku.com/start
Choose the language that is: Most productive for your team Most effective in the problem domain
That’s for a Rails App
34 Cloud Saturday Atlanta
https://www.heroku.com/cx
Deploy a mobile Loyalty app
35 Cloud Saturday Atlanta
Questions?
36 Cloud Saturday Atlanta
Please complete a session surveySession Evaluations
Recommended