Slide 1

Slide 1 text

What’s wrong with your app? Keiko Oda (@keiko713) Heroku Technical Support Engineer

Slide 2

Slide 2 text

About me Keiko Oda (@keiko713) Joined Heroku April 2013 Technical support engineer San Francisco / Kanazawa

Slide 3

Slide 3 text

We’re the Bento sponsor! Heroku book in 日本語 Advertisem ent RubyKaigi中はジュンク堂RubyKaigi支店にて お求めいただけます! サイン会もやるらしい Japanese

Slide 4

Slide 4 text

Say “Hi” to Herokai! (Herokai = Heroku employee)

Slide 5

Slide 5 text

Matz Rubyのパパ兼 キーノートのプロ papa of Ruby pro keynote speaker Nobu パッチモンスター patch monster Koichi 燃えるバイトコード VMマスター burning bytecode VM master

Slide 6

Slide 6 text

Richard Heroku x Rubyといえば この人 Andy とっても陽気なTAM very social TAM Ayumu Heroku Japan teamの 保護者 (guardian, chaperon)

Slide 7

Slide 7 text

Caio Herokuで4年働いています Ryan 三姉妹のパパ Brett 日本語上手なぶーちゃん

Slide 8

Slide 8 text

MY APP IS DOWN!

Slide 9

Slide 9 text

Heroku H12 request timeout error

Slide 10

Slide 10 text

Cause 1: slow requests Most common cause of H12 Go to your New Relic + logging add-on to find the cause, do whatever you need to do * Just you have bad code? * Maybe external service problem? * Could be database problem?

Slide 11

Slide 11 text

Cause 2: traffic spike Sudden traffic spike can cause the downtime Is your app ready for the sudden traffic spike?

Slide 12

Slide 12 text

Cause 3: memory quota exceed If you use more memory than what you can use, it will make your app super slow Temporary solution: Restarting the app Memory usage increased from Ruby 2.1 Your Unicorn worker # is appropriate? Could be memory leak - monitor your memory usage using tools

Slide 13

Slide 13 text

Start doing right meow!

Slide 14

Slide 14 text

Do You Have Logging? Logging is very important Log tells you a lot Logging add-ons available at https:// addons.heroku.com/#logging Heroku only stores 1500 lines of log

Slide 15

Slide 15 text

Monitor your app! New Relic is a good tool to start with https://addons.heroku.com/newrelic

Slide 16

Slide 16 text

Monitor your app! Availability monitoring (e.g. New Relic, Pingdom) Error monitoring (e.g. Rollbar, Honeybadger)

Slide 17

Slide 17 text

Monitor your app! Troubleshoot your database slowness with Expensive Queries https://devcenter.heroku.com/articles/expensive- queries

Slide 18

Slide 18 text

Monitor your app! dashboard.heroku.com

Slide 19

Slide 19 text

Choose the right server The app can be bad really easiliy depends on the server Use the server that can handle requests concurrently (e.g. Unicorn, Puma)

Slide 20

Slide 20 text

Choose the right server example: bugs.ruby-lang.org http://www.hsbt.org/diary/20140125.html thin passenger

Slide 21

Slide 21 text

Proper timeout setting Unicorn timeout: 15s or less => prevent long-running requests from causing a cascading request queueing buildup rack-timeout: 10s or less => rack-timeout to be triggered before the Unicorn timeout, raise the error Address the long-running actions and optimize the response time under 500ms

Slide 22

Slide 22 text

More tips? Ask Herokai!  Rubyならまかせて! 日本語でOK 経験豊富なサポート エンジニア/TAM

Slide 23

Slide 23 text

Thank you! ご清聴ありがとうございました  :)