z

Young Writers Society


Server Problems (and maintenance tonight)



User avatar
425 Reviews



Gender: Male
Points: 11417
Reviews: 425
Mon Feb 07, 2011 10:10 pm
Nate says...



I know it's been incredibly frustrating for some of you on YWS lately. Last night, the server was down for 25 minutes, and we just went through another 25 minute period where no one could submit posts. I apologize for both.

What's going on is I'm trying to speed up the site so that we have fewer of these crashes in the future. Last night, the 25 minute down-time was due to increasing the capacity of the server by 14%. In order to do that, though, the server had to go down and rebuild itself.

The down-time that happened just now wasn't expected, though it's still my fault. What happen is I've noticed that submitting a post these days takes on average 12 seconds; far more than it should. So I figured out why it's taking so long, and partially fixed it. However, I didn't expect that fixing the problem would mean the server would essentially not allow anyone to post for 25 minutes. Unfortunately, in order to fully fix the problem, I need to do what I did two times more (technical details below). In order to do that, I'll have to take the server down tonight for about an hour beginning at 7am GMT / 2am EST / 11pm PST (usually a very quiet hour).


Technical Details

YWS uses a database called MySQL to store all information, ranging from your user account details to posts. All posts are kept in a single table simply called yws_posts.

The yws_posts table is fairly large; there's one row for every post so there's somewhere around 750,000 rows these days (about 1.3 gigabytes of data). In order to make searching through this easy, MySQL uses indexes. Think of it like using tabs in a notebook. Imagine the amount of time you save by adding a tab for each of you school subjects in a big binder versus flipping through everything just to find your History notes. It's the same with MySQL indexes. Instead of searching the entire 1.3 gigabyte table each time someone pulls something from it (such as when you view a topic), MySQL has an index that works like tabs in a binder.

Well, sometime ago I added three indexes for the purposes of a defunct section of YWS (I honestly don't remember which section). Because MySQL has to re-organize the indexes each time you submit a post, you can imagine it takes some time. That's why it's been taking 12 seconds on average to submit a post.

However, removing an index means MySQL has to completely rebuild that table. So when I removed one of the indexes, MySQL had to go through the yws_posts table and completely rebuild the 1.3 gigabyte behemoth. That's why no one could submit anything for 25 minutes.

So later on tonight, I'm going to get rid of the two remaining indexes. That should in turn reduce the overall submission time from 12 seconds to hopefully 3 seconds.

So once again, my apologies! In the end, though, it should all be worth it.
  





User avatar
373 Reviews



Gender: None specified
Points: 49068
Reviews: 373
Tue Feb 08, 2011 3:25 am
View Likes
Kamas says...



Image

The monkeys have been preoccupied, Naters.
"Nothing is permanent in this wicked world - not even our troubles." ~ Charles Chaplin

#tnt
  








As I grow older, I pay less attention to what men say. I just watch what they do.
— Andrew Carnegie