News for hackers. Stuff that matters.
Re:Heroku Blog: Routing Performance Update by tomlemon on Saturday February 16, 2013 @03:37AM (#5230895)
Rap Genius cofounder here. Below is the full unedited text of https://help.heroku.com/tickets/37665, a Heroku support ticket I logged about 1 year ago. Sorry it is so long, but I think you'll find it interesting:

Tom@Rapgenius| about 1 year ago I know this is a bit of a vague problem, but I've been getting a bunch of Error H12 (Request Timeout)s recently, and I'm not sure what to do about it. It's not like I have some particularly slow actions; I'm getting this error for actions that under most circumstances work totally fine (i.e., return in less than 300ms). Also I don't have a deep request queue (I'm running 40 dynos which is more than enough). Maybe I'm doing some slow queries? Should I upgrade my DB? Also, I do notice that most of my app's time (according to New Relic) is being spent in Ruby (http://cl.ly/29132F272W2D0K1l2I3P). Would upgrading Ruby to 1.9 noticeably help this performance? (I'm a bit nervous it'll create a ton of problems).

Phil@Heroku Hello - I can look into this, but I'll need access to your New Relic account. Will you make sure '[email protected]' has access? Also, from your screenshot I notice your DB times are ~ 100 ms. We recommend keeping those times closer to 50 ms. You might be able to speed things up with a database upgrade. I'll look into New Relic once I have access and let you know what I find.

Tom@Rapgenius Thanks, Phil! How do I give you access to my New Relic account? I tried clicking "account settings" and got this: http://cl.ly/0V2J3i0826400I2s3b2c

Phil@Heroku Tom, I have access now. I'm not sure what was blocking me earlier. After looking at New Relic and the database server, I think a larger database will help. At the very least, it will be helpful to try the next level for a week and compare performance statistics in New Relic with the prior week. Your app is using an Ika right now, and the next step up is the Zilla database. We've made the upgrade process very simple, and it's outlined here - http://devcenter.heroku.com/articles/fast-database-changeove... Your database is ~ 5.4 GB in size (via the 'heroku pg:info' command) so an upgrade shouldn't take too long. You will be able to test the process by adding a Follower and timing it via the 'heroku pg:wait' command. This should give you a good idea of how long it will take to spin up the new database. Also, should the Zilla not help much, the downgrade process to an Ika will be the same. You only pay for the resources used.

The current database server appears to be a bit under-powered when it comes to Compute Units. The Zilla has more power and should provide some room to grow. As for an upgrade to Ruby 1.9.2, I'm not sure how much that would help. It would be an involved upgrade that would take time to plan and deploy. The database upgrade should be a quicker solution. Long-term you may want to consider moving to the Cedar stack and Ruby 1.9.2.

Tom@Rapgenius Thanks! I'm upgrading now

Tom@Rapgenius I'm still getting a ton of "Request Timeout" errors. E.g.: 2011-12-08 14:46:53.222 219 1 2011-12-08T14:46:53+00:00 d. heroku router - - Error H12 (Request timeout) -> GET rapgenius.com/Wale-ambition-lyrics dyno=web.17 queue= wait= service=30000ms status=503 bytes=0 one weird thing: there aren't any values listed for the "queue" and "wait" parameters. Could that indicate a problem? Could an exception have been thrown earlier in the request before the timeout? Or does the timeout error just indicate that the request took too long? If it's the latter I'm not sure how to troubleshoot all these errors since the associated actions are fast the vast majority of the time

Tom@Rapgenius Here's another interesting example:

2011-12-08 15:59:32.293 222 1 2011-12-08T15:59:32+00:00 d. heroku router - - Error H12 (Request timeout) -> GET rapgenius.com/static/templates_for_js dyno=web.17 queue= wait= service=30000ms status=503 bytes=0 This action is extremely simple – it doesn't access the DB or any external services. Here's the template: Ballin! <% unless current_user %> <% form_for User.new, :html => { :id => '' } do |f| %> Tired of entering your email address? Create a Rap Genius account and you'll never have to worry about it (or anything else) ever again: <%= render :partial => "/users/form", :object => f %> <%= f.submit "Create Account" %> <small>(Already have an account? <%= link_to 'Sign in', login_path, :class => :facebox %>)</small> <% end %> <% end %>

Besides a big request queue (which there isn't), how could this action possibly time out?

Phil@Heroku Tom - sorry for not getting back to you sooner.

It's possible for H12s to occur even for simple actions if there is already queueing for the app. With a busy site like your's, even a few H12s can cause a cascade of H12s for successive requests.

It looks like New Relic has not reported any downtime over the past 24 hours. Can we let the site run through the weekend and see how things look Monday after 3 days of New Relic data with the new Zilla?

Tom@Rapgenius > It's possible for H12s to occur even for simple actions if there is already queueing for the app.

I feel what you're saying, but I don't think my app's queuing. For one thing, New Relic shows 0 time spent in the queue during the period in which I'm getting all these timeouts. For another, I'm running 40 dynos and my average request time is <400ms. So:

400 ms * 3000 requests / minute * 1 min / 60000 ms = 20 simultaneous requests (i.e., 20 dynos) so 40 dynos should definitely be more than enough.

Also, shouldn't Heroku be showing me the queue / wait stats at the time of the timeout? That would help prove whether my app was queuing at the time in question

It looks like New Relic has not reported any downtime over the past 24 hours.

New Relic isn't great at catching intermittent problems like this; you really feel it when you're using the site continuously for an hour or whatever. Also, users make many more HTTP requests than New Relic (since every page load kicks off several AJAX requests).

That said, there has been downtime in the past 24 hours (though less than in the previous 24): http://cl.ly/3D2b1Z170B0w1f1m113m

Tom@Rapgenius Here's some additional data: At 5am this morning (EST), Rap Genius went down. I woke up at 11am (it's a Saturday!), did a logs --tail and observed that basically every request was timing out. I did heroku restart, and now every request started returning a backlog too deep error

Finally, I added another 10 dynos (bumping the total to 50, which is a log of dynos!), and this seems to have fixed the problem – perhaps because my app needs the additional capacity, or perhaps because merely changing the number of dynos reset something else. Either way, I'm sticking with 50 dynos for now out of fear even though I doubt my app needs that many (right?)

Either way, the 5 hours of unexplained downtime (there weren't any application-level exceptions or anything) that was fixable by tweaking my dyno count further supports my theory that something's going on with my app on Heroku's end.

Phil@Rapgenius Tom - I've been looking over your New Relic stats.

First - the good news - the upgrade to a Zilla seems to have helped. Database times are down a bit, which can only help. I checked the actual database server and it's not showing signs of over-work like the previous Ika was. Second, I notice that downtimes reported by New Relic over the past two weeks are in the early morning hours - 3 to 6 AM PST. Do you have any scheduled tasks that run during these times?

Also, request queueing is nearly zero, so 50 dynos does seem like a lot. What are your usage patterns like? The RPM graph in New Relic indicates the normal cyclical usage pattern, lower during the night, but what does Google Analytics tell you?

Finally, the Heroku platform has been having issues over the past week, but none of them correspond to the downtime you had Saturday morning.

Re:Heroku Blog: Routing Performance Update by latchkey on Saturday February 16, 2013 @03:45AM (#5230913)
That all sounds so familiar. Just like what Phil was telling us too. Get a New Relic account. "Why do we need a $7k/mo NR account?" Oh, because you have some slow requests...

We go fix all of our slow requests, but we still have H12 errors.

Can you tell us how many dyno's we actually need to serve our requests and not get H12 errors? No.

Hey Rappgenius... thanks for having the balls to call Heroku out in public on this stuff. We are in the same boat.

Re:Heroku Blog: Routing Performance Update by MediaSquirrel on Saturday February 16, 2013 @03:49AM (#5230919)
Have you guys considered suing Heroku to get some of your money back? Given the nature of Heroku's deception and the resulting ill-gotten gains across its entire customer bases, it would seem like you could work with an enterprising attorney to form a class-action suit against the company and get money back not just for yourselves but for the entire effected customer bases.

Just a thought. ;)

Re:Heroku Blog: Routing Performance Update by minimaxir on Saturday February 16, 2013 @03:52AM (#5230926)
A Y-Combinator company suing another Y-Combinator company. Now that would be interesting.
Re:Heroku Blog: Routing Performance Update by clicks on Saturday February 16, 2013 @04:04AM (#5230959)
Heroku was acquired by Salesforce, so I guess it's not really a YC company anymore.
Re:Heroku Blog: Routing Performance Update by tomjen3 on Saturday February 16, 2013 @04:40AM (#5231024)
Ah that explains why they have turned evil. Usually once a company has been acquired they are no longer worth using.
Re:Heroku Blog: Routing Performance Update by malandrew on Saturday February 16, 2013 @02:15PM (#5232603)
Normally I'd say yes, but one of the core Cedar stack engineers is a close friend of mine and I've been over at Heroku a few times to nerd out over beers. Given my conversations with him and other engineers about the designs I can guarantee to you that (1) Heroku is extremely autonomous relative to Salesforce (I bet you most of SF's influence is on the BD side of things and not on the engineering side. In fact I doubt they have much influence on engineering) and (2) there was no malice involved. Like any engineering first organization, they probably spotted an opportunity to innovate on efficiency and optimize a key process. Problem is that in this case v1.0 of their solution turned out to be a dud and they probably didn't have the instrumentation needed for this new approach in place to detect and prevent these issues. They may not have been measuring the all the right things so a modification detrimental to performance slipped through the cracks;
Re:Heroku Blog: Routing Performance Update by mctx on Saturday February 16, 2013 @09:05PM (#5233920)
I think all this drama is a great opportunity for Heroku to bring out a new stack for non-concurrent apps with an intelligent routing mesh (v2.0a, perhaps). If I were you I'd go for another beer with the Heroku engineers and design/prototype it.
Re:Heroku Blog: Routing Performance Update by chris_wot on Saturday February 16, 2013 @04:53AM (#5231049)
I upvoted this comment, it has been my experience this is the case.
Re:Heroku Blog: Routing Performance Update by edouard1234567 on Saturday February 16, 2013 @04:02AM (#5230952)
It'd be like suing an airline for a delayed flight.
Re:Heroku Blog: Routing Performance Update by MediaSquirrel on Saturday February 16, 2013 @04:17AM (#5230985)
In a way, yes––if the airline's product for sale wasn't a particular "flight," but instead a speedy "travel system" that guaranteed customers to fly on the first available (ergot fastest) flight.

To further extend the airline analogy, it's as if you had bought one of these "fast travel" products and were told to buy more plane tickets to avoid delays!

The tort (aka crime) committed is the deceitful way in which nature of the product was marketed to the clear financial benefit of Heroku and to the clear financial detriment of the customer. The fix offered to customers is always an up-sell effort to "buy more Heroku products."

The thing about Heroku's intelligent queing system is that it lowers customers' costs and thus Heroku's profits. Switching away from intelligent queuing to random queuing was a business decision with clear moneymaking advantages for Heroku.

In one fell swoop, the move made the value of a customer to Heroku skyrocket, potentially increasing its valuation upon acquisition and/or helping the founders more easily hit any earn-out revenue targets required by Salesforce as part of their acquisition.

Re:Heroku Blog: Routing Performance Update by edouard1234567 on Saturday February 16, 2013 @04:38AM (#5231021)
They don't really claim to be the most reliable or performant, just the easiest to deploy and maintain (arguably scale). Keep in mind they don't even have any meaningful SLA.
Re:Heroku Blog: Routing Performance Update by unclebucknasty on Saturday February 16, 2013 @09:03PM (#5233917)
Yes, but false advertising may still be a claim, even if there is no concrete agreement. And the legal standard there doesn't even require overt lies. That is, even statements that are technically true but misleading such that a reasonable person would conclude something untrue can meet the test.

And, in this case, documentation regarding the way their system works, as well other of their materials was overtly untrue. Beyond that, customers would merely need to show damages and also that Heroku profited from its untrue statements.

Whether it intended to mislead or not, Heroku could have a real problem on its hands.

Re:Heroku Blog: Routing Performance Update by jbverschoor on Sunday February 17, 2013 @05:01AM (#5234777)
Yes, perfectly possible and regulated in the eu
Re:Heroku Blog: Routing Performance Update by WillieBKevin on Saturday February 16, 2013 @10:13AM (#5231670)
I had a string of similar requests with Heroku between Feb 2011 and June 2012, before we migrated off their platform.

I would complain about h12 errors, they would tell me to upgrade my resources and/or that it was my problem and there was nothing they can do. We ended up with a solution that was easily 10x as expensive (over-powered DB, too many dynos) as our initial configuration, and it still didn't fix the issue.

I'm happy to provide the full text support requests, but they don't tend to be quite as juicy as the one you posted.

Re:Heroku Blog: Routing Performance Update by rdl on Sunday February 17, 2013 @12:03AM (#5234261)
What did you migrate to?
Re:Heroku Blog: Routing Performance Update by WillieBKevin on Monday February 18, 2013 @09:18AM (#5238371)
We're with bluebox.net and have been very happy.
Re:Heroku Blog: Routing Performance Update by edouard1234567 on Saturday February 16, 2013 @04:00AM (#5230944)
I love how their first suggestion is upgrade your db $$$ .
Re:Heroku Blog: Routing Performance Update by ctide on Saturday February 16, 2013 @04:09AM (#5230974)
Whatever you do, get your database off Heroku. Heroku's postgres offering has sweet options, but performance is fucking awful. We went from a 20k+ month heroku bill to a fraction of that price on EC2 so we could get a slave that could keep up with the writes to our master.

Performance being shit would be fine if it wasn't a miserable experience trying to migrate off. Not being able to setup replication to slaves off of Heroku means you have to deal with things like Bucardo and all the problems that brings along.

Heroku is really awesome for little web apps that performance doesn't matter on. If you think you're building something that people will want to use, you don't want to be on Heroku.

Re:Heroku Blog: Routing Performance Update by fdr on Saturday February 16, 2013 @04:34AM (#5231012)
That's quite interesting; I don't see how one can really so soundly beat the disk configuration, but it certainly can be matched by something similar.

It was posted about quite some time ago: http://orion.herokuapp.com/past/2009/7/29/io_performance_on_.... If this has become bad advice, inquiring minds wish to know. EBS Priops seem promising and different.

Replication out of Heroku would be neat, but the WAL as-is is architecture and operating system dependent. Luck and tenaciousness willing, logical replication in Postgres may yet serve that use case, some day -- we'll have to see as to the details. A lot of effort has been expended attempting to get it in some form into 9.3, but it's far from sure thing.

Also, don't forget to set up archiving, if you continue to retain fast interconnect with S3: https://github.com/wal-e/wal-e, which I principally wrote on Heroku's behalf, but now is a project of multiple users and contributors. It has a focus on ease of use and reliability, although it could suffer improvement.

Re:Heroku Blog: Routing Performance Update by ctide on Saturday February 16, 2013 @04:52AM (#5231042)
Yeah, we're using wal-e in conjunction with streaming replication.

Either of those options would have been awesome (anything but Bucardo, really. Bucardo's triggers overwhelmed an already overwhelmed database)

Re:Heroku Blog: Routing Performance Update by zwily on Saturday February 16, 2013 @09:27AM (#5231553)
"EBS Priops seem promising and different."

We run many busy PG databases on PIOPS. The difference from normal EBS is huge. Very happy with PIOPS.

Re:Heroku Blog: Routing Performance Update by gfodor on Saturday February 16, 2013 @04:20AM (#5230990)
Interesting -- can you go into more detail or provide references that you found helpful when trying to run Postgres on ec2?
Re:Heroku Blog: Routing Performance Update by ctide on Saturday February 16, 2013 @04:30AM (#5231006)
Yeah, if you run Ubuntu, don't try running any versions other than 11.04 if you're going to be under heavy i/o. We had all kinds of CPU soft lock issues with software raid on other versions. Otherwise? 2 m2.4xlarge running mostly standard postgresql installs absolutely dominate Mecha instances.

Obviously, you need to deal with backups and that sort of thing, but, you can hire a full time person for the price difference between Heroku and EC2 as soon as you get to the top end of Heroku pricing.

Re:Heroku Blog: Routing Performance Update by gojomo on Saturday February 16, 2013 @05:01AM (#5231071)
Definitely interesting, but from this 'full unedited text' it looks like both you and Heroku had better things to do at the time than investigate more deeply. (At the time you seemed satisfied but suspicious that 50 dynos fixed things; Phil@Heroku shares your suspicions but his followup questions get no response. Case closed, everyone moves on to other things until another complaint or fresh info comes in.)
Re:Heroku Blog: Routing Performance Update by rickyc091 on Saturday February 16, 2013 @08:26PM (#5233835)
Tom, like many others here, I'd like to personally thank you for publicly surfacing this issue. Two months ago we ran into the same exact problem while doing some performance stress testing. After going back and forth with five different Heroku support staff members for a week, we ended up no where. Their response was simply to increase the # of dynos, but seeing as our average response time was 80ms with 0 request queueing that didn't any make sense. In the end we dropped it, since we were just doing some stress test, but I'm glad they are finally "doing" something about it.