Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Join the conversation via #herokuJoin the conversation via #heroku
Optimizing Production AppsOptimizing Production Apps
on...
Join the conversation via #herokuJoin the conversation via #heroku
IntroductionsIntroductions
Ryan Huber
Customer Advocate...
Join the conversation via #herokuJoin the conversation via #heroku
AgendaAgenda
 Using CDN to increase app performance
 ...
Join the conversation via #herokuJoin the conversation via #heroku
AssumptionsAssumptions
 Existing Heroku User
 General...
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
Processes assets for use b...
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
Two hard problems in Compu...
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
Helps with Cache Invalidat...
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
What about uploading to S3?
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
NO
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
Then you have 2 sets of fi...
Join the conversation via #herokuJoin the conversation via #heroku
Asset PipelineAsset Pipeline
Leave them on the Dyno
Use...
Join the conversation via #herokuJoin the conversation via #heroku
Why Use a CDN?Why Use a CDN?
Join the conversation via #herokuJoin the conversation via #heroku
CDN vs S3CDN vs S3
Application Assets User Generated As...
Join the conversation via #herokuJoin the conversation via #heroku
S3 Best PracticesS3 Best Practices
Direct Upload
Pass-t...
Join the conversation via #herokuJoin the conversation via #heroku
CDN Best PracticesCDN Best Practices
Cache/Pull CDN
Syn...
Join the conversation via #herokuJoin the conversation via #heroku
PG ExtrasPG Extras
http://www.craigkerstiens.com/2012/1...
Join the conversation via #herokuJoin the conversation via #heroku
PG ExtrasPG Extras
A Heroku plugin for awesome pg:* com...
Join the conversation via #herokuJoin the conversation via #heroku
PG ExtrasPG Extras
There is a lot in there
Join the conversation via #herokuJoin the conversation via #heroku
PG ExtrasPG Extras
We will talk about two
1. heroku pg:...
Join the conversation via #herokuJoin the conversation via #heroku
heroku pg:cache_hitheroku pg:cache_hit
Shows the cache ...
Join the conversation via #herokuJoin the conversation via #heroku
heroku pg:index_usageheroku pg:index_usage
Shows the in...
Join the conversation via #herokuJoin the conversation via #heroku
Postgres Database MigrationPostgres Database Migration
Join the conversation via #herokuJoin the conversation via #heroku
Dev / Basic vs Production DBsDev / Basic vs Production ...
Join the conversation via #herokuJoin the conversation via #heroku
Migrating Dev / Basic DBsMigrating Dev / Basic DBs
http...
Join the conversation via #herokuJoin the conversation via #heroku
Migrating Production DBsMigrating Production DBs
https:...
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabasesFollower Databases
Starter:
Developme...
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabasesFollower Databases
Production:
Can Fo...
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabasesFollower Databases
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabasesFollower Databases
Why?
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabaseFollower Database
HA
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabaseFollower Database
Analytics / Reporting
Join the conversation via #herokuJoin the conversation via #heroku
Follower DatabasesFollower Databases
Octopus gem (https...
Join the conversation via #herokuJoin the conversation via #heroku
Overcoming Postgres Connection LimitsOvercoming Postgre...
Join the conversation via #herokuJoin the conversation via #heroku
Overcoming Postgres Connection LimitsOvercoming Postgre...
Join the conversation via #herokuJoin the conversation via #heroku
Overcoming Postgres Connection LimitsOvercoming Postgre...
Join the conversation via #herokuJoin the conversation via #heroku
Overcoming Postgres Connection LimitsOvercoming Postgre...
Join the conversation via #herokuJoin the conversation via #heroku
Caching for Profit & PerformanceCaching for Profit & Pe...
Join the conversation via #herokuJoin the conversation via #heroku
Caching for Profit & PerformanceCaching for Profit & Pe...
Join the conversation via #herokuJoin the conversation via #heroku
Performance MonitoringPerformance Monitoring
 New Reli...
Join the conversation via #herokuJoin the conversation via #heroku
New RelicNew Relic
https://devcenter.heroku.com/article...
Join the conversation via #herokuJoin the conversation via #heroku
New Relic: BenefitsNew Relic: Benefits
https://devcente...
Join the conversation via #herokuJoin the conversation via #heroku
New Relic: Pro vs StandardNew Relic: Pro vs Standard
ht...
Join the conversation via #herokuJoin the conversation via #heroku
New Relic: CaveatsNew Relic: Caveats
https://devcenter....
Join the conversation via #herokuJoin the conversation via #heroku
Dyno QueuingDyno Queuing
 Processing in the router
 T...
Join the conversation via #herokuJoin the conversation via #heroku
Runtime MetricsRuntime Metrics
 Resident Memory (memor...
Join the conversation via #herokuJoin the conversation via #heroku
Log2vizLog2viz
http://log2viz.herokuapp.com/
Join the conversation via #herokuJoin the conversation via #heroku
LoggingLogging
https://devcenter.heroku.com/articles/lo...
Join the conversation via #herokuJoin the conversation via #heroku
RecapRecap
 Cache Assets
 PG-Extras to Understand DB ...
Join the conversation via #herokuJoin the conversation via #heroku
Join the conversation via #herokuJoin the conversation via #heroku
Q&AQ&A
Ryan Huber
Customer Advocate
@ryan_huber
Greg No...
Upcoming SlideShare
Loading in …5
×

Optimizing production apps on heroku 7.31.13

11,704 views

Published on

This deck is from a live presentation on 7/31/13 which featured an in-depth look at optimizing production apps on Heroku. This is the second session in a two part series for production apps on Heroku. Video recording can be found here https://vimeo.com/71442888. Check out vimeo.com/69263217 for the first session on setting up and running production apps.

Topics for this presentation include:
* Using a CDN to increase app performance
* How to manage the asset pipeline
* Using heroku-pg-extras to gain visibility into database performance
* How to manage database migrations
* How to use a database follower for transactional and analytics database reads
* How to set up caching with Heroku add-ons
* Useful labs features

Looking for 1:1 assistance with your production apps, please contact our Customer Success team here - lp.heroku.com/ProductionApps.html?mkt_tok=3RkMMJWWfF9wsRow5%2FmYJoDpwmWGd5mht7VzDtPj1OY6hBkvKrWJK1TtuMFUGpsqOOGbEw0bBg%3D%3D

Published in: Technology
  • Be the first to comment

Optimizing production apps on heroku 7.31.13

  1. 1. Join the conversation via #herokuJoin the conversation via #heroku Optimizing Production AppsOptimizing Production Apps on Herokuon Heroku Ryan Huber, Customer AdvocateRyan Huber, Customer Advocate @ryan_huber@ryan_huber Greg Nokes, Technical Account ManagerGreg Nokes, Technical Account Manager @tsykoduk@tsykoduk
  2. 2. Join the conversation via #herokuJoin the conversation via #heroku IntroductionsIntroductions Ryan Huber Customer Advocate @ryan_huber Greg Nokes Technical Account Manager @tsykoduk
  3. 3. Join the conversation via #herokuJoin the conversation via #heroku AgendaAgenda  Using CDN to increase app performance  Managing Asset Pipeline (RoR specific)  PG Extras - Postgres  Postgres Database Migrations  Postgres Database Followers  Database Caching  Recommended Monitoring Tools
  4. 4. Join the conversation via #herokuJoin the conversation via #heroku AssumptionsAssumptions  Existing Heroku User  General understanding of Heroku / CLI  Have installed Toolbelt & created / pushed apps  General understanding of Postgres / SQL  Have provisioned Postgres databases on Heroku *** This webinar is being recorded and distributed online ***
  5. 5. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline
  6. 6. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline Processes assets for use by Caching
  7. 7. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline Two hard problems in Computer Science: 1. Cache Invalidation 2. Naming Things 3. Off by One errors
  8. 8. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline Helps with Cache Invalidation and Naming Things
  9. 9. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline What about uploading to S3?
  10. 10. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline NO
  11. 11. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline Then you have 2 sets of files to manage
  12. 12. Join the conversation via #herokuJoin the conversation via #heroku Asset PipelineAsset Pipeline Leave them on the Dyno Use a Edgecache CDN such as: CDN Sumo Cloudfront CDNetworks Akamai
  13. 13. Join the conversation via #herokuJoin the conversation via #heroku Why Use a CDN?Why Use a CDN?
  14. 14. Join the conversation via #herokuJoin the conversation via #heroku CDN vs S3CDN vs S3 Application Assets User Generated Assets
  15. 15. Join the conversation via #herokuJoin the conversation via #heroku S3 Best PracticesS3 Best Practices Direct Upload Pass-through Upload * If processing is required * https://devcenter.heroku.com/articles/s3
  16. 16. Join the conversation via #herokuJoin the conversation via #heroku CDN Best PracticesCDN Best Practices Cache/Pull CDN Sync/Push CDN * Automatic Update* * Manual Update* Cache/Pull CDN Recommended CDN Sumo (Heroku Addon)https://addons.heroku.com/cdn_sumo
  17. 17. Join the conversation via #herokuJoin the conversation via #heroku PG ExtrasPG Extras http://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/ http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/
  18. 18. Join the conversation via #herokuJoin the conversation via #heroku PG ExtrasPG Extras A Heroku plugin for awesome pg:* commands that are also great and fun and super.
  19. 19. Join the conversation via #herokuJoin the conversation via #heroku PG ExtrasPG Extras There is a lot in there
  20. 20. Join the conversation via #herokuJoin the conversation via #heroku PG ExtrasPG Extras We will talk about two 1. heroku pg:cache_hit 2. heroku pg:index_usage
  21. 21. Join the conversation via #herokuJoin the conversation via #heroku heroku pg:cache_hitheroku pg:cache_hit Shows the cache hit ratio. A good measure of database sizing We like to see it at 99%
  22. 22. Join the conversation via #herokuJoin the conversation via #heroku heroku pg:index_usageheroku pg:index_usage Shows the index hit ratio on each table Big, heavily used tables need to have 99 – 100%
  23. 23. Join the conversation via #herokuJoin the conversation via #heroku Postgres Database MigrationPostgres Database Migration
  24. 24. Join the conversation via #herokuJoin the conversation via #heroku Dev / Basic vs Production DBsDev / Basic vs Production DBs Dev / Basic * Not suitable for production applications * Expected uptime of 99.5% * Many level features not supported: Fork, follow * Row number limitation: 10K for Dev, 10M for Basic. * The database instance is shared among many other customers Production * Designed for higher uptime, 99.95% * No row level limitation * You get your own database instance * Fork, follow supported * Suitable for production applications
  25. 25. Join the conversation via #herokuJoin the conversation via #heroku Migrating Dev / Basic DBsMigrating Dev / Basic DBs https://devcenter.heroku.com/articles/upgrade-heroku-postgres-with-pgbackups
  26. 26. Join the conversation via #herokuJoin the conversation via #heroku Migrating Production DBsMigrating Production DBs https://devcenter.heroku.com/articles/heroku-postgres-follower-databases
  27. 27. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabasesFollower Databases Starter: Development No Fork/Follow 99.5% uptime
  28. 28. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabasesFollower Databases Production: Can Fork/Follow 99.95% uptime
  29. 29. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabasesFollower Databases
  30. 30. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabasesFollower Databases Why?
  31. 31. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabaseFollower Database HA
  32. 32. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabaseFollower Database Analytics / Reporting
  33. 33. Join the conversation via #herokuJoin the conversation via #heroku Follower DatabasesFollower Databases Octopus gem (https://github.com/tchandy/octopus)
  34. 34. Join the conversation via #herokuJoin the conversation via #heroku Overcoming Postgres Connection LimitsOvercoming Postgres Connection Limits
  35. 35. Join the conversation via #herokuJoin the conversation via #heroku Overcoming Postgres Connection LimitsOvercoming Postgres Connection Limits Limit the number of connections https://devcenter.heroku.com/articles/forked-pg-connections
  36. 36. Join the conversation via #herokuJoin the conversation via #heroku Overcoming Postgres Connection LimitsOvercoming Postgres Connection Limits Sometimes that’s not enough
  37. 37. Join the conversation via #herokuJoin the conversation via #heroku Overcoming Postgres Connection LimitsOvercoming Postgres Connection Limits https://github.com/gregburek/heroku-buildpack-pgbouncer
  38. 38. Join the conversation via #herokuJoin the conversation via #heroku Caching for Profit & PerformanceCaching for Profit & Performance
  39. 39. Join the conversation via #herokuJoin the conversation via #heroku Caching for Profit & PerformanceCaching for Profit & Performance https://devcenter.heroku.com/articles/memcachier http://guides.rubyonrails.org/caching_with_rails.html
  40. 40. Join the conversation via #herokuJoin the conversation via #heroku Performance MonitoringPerformance Monitoring  New Relic  Dyno Queuing  Runtime Metrics (https://devcenter.heroku.com/articles/log-runtime-metrics)  Log2viz (http://log2viz.herokuapp.com/)  Logging
  41. 41. Join the conversation via #herokuJoin the conversation via #heroku New RelicNew Relic https://devcenter.heroku.com/articles/newrelic  Ruby  Java  Python  Node
  42. 42. Join the conversation via #herokuJoin the conversation via #heroku New Relic: BenefitsNew Relic: Benefits https://devcenter.heroku.com/articles/newrelic
  43. 43. Join the conversation via #herokuJoin the conversation via #heroku New Relic: Pro vs StandardNew Relic: Pro vs Standard https://devcenter.heroku.com/articles/newrelic
  44. 44. Join the conversation via #herokuJoin the conversation via #heroku New Relic: CaveatsNew Relic: Caveats https://devcenter.heroku.com/articles/newrelic
  45. 45. Join the conversation via #herokuJoin the conversation via #heroku Dyno QueuingDyno Queuing  Processing in the router  Traveling over the network to a dyno  Queuing in the TCP socket backlog  Processing by the web server  Processing by Rack middleware https://devcenter.heroku.com/articles/newrelic#interpreting-new-relic-request-queueing
  46. 46. Join the conversation via #herokuJoin the conversation via #heroku Runtime MetricsRuntime Metrics  Resident Memory (memory_rss)  Disk Cache Memory (memory_cache)  Swap Memory (memory_swap)  Total Memory (memory_total)  Pages Written to Disk (memory_pgpgout)  Pages Read from Disk (memory_pgpgin)  CPU Load Avg (1 min, 5 min, 15 min avgs) https://devcenter.heroku.com/articles/log-runtime-metrics
  47. 47. Join the conversation via #herokuJoin the conversation via #heroku Log2vizLog2viz http://log2viz.herokuapp.com/
  48. 48. Join the conversation via #herokuJoin the conversation via #heroku LoggingLogging https://devcenter.heroku.com/articles/logging
  49. 49. Join the conversation via #herokuJoin the conversation via #heroku RecapRecap  Cache Assets  PG-Extras to Understand DB Performance  Select the Right DB Plan / Configuration  Leverage App Monitoring Tools
  50. 50. Join the conversation via #herokuJoin the conversation via #heroku
  51. 51. Join the conversation via #herokuJoin the conversation via #heroku Q&AQ&A Ryan Huber Customer Advocate @ryan_huber Greg Nokes Technical Account Manager @tsykoduk

×