Open foxnewsnetwork opened 12 years ago
Maybe that was just some sort of ungodly coincidence. I have yet to encounter such ungold activerecord sql time anymore. Strange. I don't think I did anything. However, if YOU have, please step up and take credit.
I was building the UI and views when I looked over at the webrick log and came across this:
Started POST "/stories/3/chapters/5" for 127.0.0.1 at 2012-06-01 16:00:07 -0700 Processing by ChaptersController#update as JS Parameters: {"utf8"=>"✓", "authenticity_token"=>"CkxR3R4ty0uVg5jO4IWtOwYz77bu7iOEuQPXHGT4c/c=", "chapter"=>{"title"=>"active record sucks"}, "commit"=>"Update", "story_id"=>"3", "id"=>"5"} User Load (0.2ms) SELECT
users
.* FROMusers
WHEREusers
.id
= 2 LIMIT 1 Chapter Load (0.4ms) SELECTchapters
.* FROMchapters
WHEREchapters
.id
= 5 LIMIT 1 Story Load (0.1ms) SELECTstories
.* FROMstories
WHEREstories
.id
= 3 LIMIT 1 SQL (0.1ms) BEGIN AREL (0.4ms) UPDATEchapters
SETtitle
= 'active record sucks',updated_at
= '2012-06-01 23:00:07' WHEREchapters
.id
= 5 SQL (41.4ms) COMMIT Rendered chapters/update.js.erb (0.5ms) Completed 200 OK in 149ms (Views: 10.0ms | ActiveRecord: 42.6ms)Specifically, note that the line says "SQL (41.4ms) COMMIT"
Someone needs to fix this. 41.4ms for a minor update request is ridiculously long. MySQL is suppose to be able to handle over 200 updates per second (as according to that one paper by Courtney from Kiip) and, at a break-face pace of 42.6ms, we're not going to handling for than 25 updates per second.
This isn't much of a problem right now (just me testing, I'll deal with it). But later, when we get even like a handful of users, we're going to seriously cap our vertical scaling ability.