My Opera Development

Behind the scenes at My Opera

Subscribe to RSS feed

Sticky post

Developer presentation

We're the guys developing the My Opera community site. happy

In this blog we write about new and upcoming features, post changelogs and some behind the scenes stuff. Make sure to post comments if you want to make your voice heard. Who knows, the next release might include some of your suggestions. smile

Read more...

Forum-issues resolved

, ,

We've had some issues with the forums since our recent database issues. The problem was that when someone either posted a new topic or an answer in an existing topic, the topic could simply disappear from the topic list in the forum it was posted in.

This was of course a major bug, so we made it one of our top priorities to get this fixed (the unregistered user's comments bug was another top priority).

We finally found a solution to it this morning (Oslo-time), and after monitoring all forum-posts for a few hours I'm confident this issue shouldn't reappear.

We're sorry for the frustration this caused, and we appreciate your patience while we were working on getting this fixed up

Unregistered user's comments

,

As you might be aware of, we had some major problems with our databases recently. This has caused a few bugs to show up, and we're in the process of fixing them

One of the major bugs has been related to comments by unregistered users on blog posts and images, where the date and time the comment was made was set to the 20th of October 2012. This affected over 2.5 million comments, and caused the order of comments to be incorrect. We understand that this has been frustrating, as old comments in conversations and discussions were ordered incorrectly and thus broken.

Today we've run a script which fetched all comments made by unregistered users from a backup of our database, and corrected the dates on the live databases. The backup we used was made on the 17th of October, which means comments made by unregistered users between the 17th and 20th of October will still have the incorrect dates. We hope this isn't too much of an inconvenience, considering it only affects a few hundred comments in total.

On a sidenote, we're aware that the forums are having major issues, and we're working hard on getting that fixed as soon as possible too.

Database problems causing trouble.

, , , ...

This weekend we experienced a lot of trouble with My Opera due to the servers being unable to connect to the databases. After debugging some, we saw that two particular tables were experiencing a lot of table locking, being ancient MyISAM tables created long before I started working for Opera.

Initial signs

Being called out at 11 PM, I identified the problem and disabled two of the non-vital update queries causing the lockups. I monitored the system for a while and everything seemed to be good. I went to bed.

The next day I checked in on the system when I got up, and noticed that we were having a small replication lag, that is the time it takes for the changes to propagate from the main database to the search databases, across the services even though the queries were disabled. I killed some hanging queries after noting them down, and they didn't come back. Until later that day when it came back and bit us again.

Round two

This time I converted the affected, huge tables to InnoDB to eliminate the possibility of table locks when updating. I've wanted to do that for a couple of years now, so why not do that when My Opera was done to begin with since it would solve the issue. After converting the two tables, a third table was locking up and we did that too. Things were starting to look good, and I drove home while Good Guy Andreas looked after the system, even though he wasn't on the technician on call at the time and was sick at home.

When I came home, Andreas reported that another table locked up. We fixed it. Many queries were still hanging. We killed them off, and watched the system. The replication lag was increasing.

Trying tons of stuff, we dug through the code and logs and eventually found some places that could cause problems, although we didn't know exactly why they started acting up lately. There were no seen problems, but the replication was hanging forever on "freeing items".

A couple of hotfixes were sent live and at 5 AM the system was looking good. It was slow, but good. I went to bed.

Hell breaks loose

Monday morning arrives. I was supposed to be in a meeting at 10:30, but woke up at 10:20. Good start. Seeing that My Opera was burning as bad as before, Good Guy Andreas was commanding the salvage operation from home, still being sick. He had discovered us being crawled by some ominous search engine, which isn't unusual, but it could enhance the problems if we got even more strain on the poor databases.

We blocked off the search engine for the time being, and it eased the load a bit. During the next hours, many different things were attempted, such as changing the innodb_thread_concurrence setting, but still the replication was lagging behind with "freeing items".

Finally a solution

After Googling like a boss, I saw that people were saying that Percona, a drop in replacement for mysql, had seemingly improved this problem. As we have been thinking of using Percona for quite a while, I agreed with myself and a couple of others that this was a perfect time. The change was done, and everything was looking good. Replication lag to 0 again.

Later that night, we experienced a couple of slow queries, but they were fixed and My Opera was once again stable.

I have throughout the Monday and Tuesday upgraded the servers one by one to run the latest kernels and Percona with mysql 5.5, up from stock mysql 5.1. Only the master database remains, but we'll perform a master switch later today to get it up to speed too. The poor master database has got almost 1000 days of uptime, so it's very much needed.

So, what was the problem?

Our current theory is that multiple, random happenstances caused the database trouble. Something caused a lot of table writes, locking the table, while being crawled causing lots of reads throughout the system and slowly but steadily bringing the database servers to their knees.

How can we guard ourselves from this in the future?

We have removed the possibility for easy locks by converting many of the much-written-to tables to InnoDB instead of MyISAM. It was about time; they were created years and years ago and had grown too large for doing this without causing trouble to the system.

Instead of simply doing something like:

ALTER TABLE foo ENGINE=InnoDB;

We used a well known less-locking method:

CREATE TABLE foo_innodb LIKE foo;
ALTER TABLE foo_innodb ENGINE=InnoDB;
INSERT INTO foo_innodb SELECT * FROM foo WHERE id >= X AND id < Y;
RENAME TABLE foo TO foo_myisam;
RENAME TABLE foo_innodb TO foo;
DROP TABLE foo_myisam;

Basically creating a copy of the table, changing its engine and then inserting chunks of data that were manageable for the system without locking it for too long, then repeating the step until all is done and finally renaming the tables and replacing the MyISAM table with the InnoDB one.

When everything's looking good again, foo_myisam can be dropped. You should do the last INSERT INTO chained with the RENAME TABLE command so you don't lose data.

Effectively we reduced the locks from 10 minutes of fully locking the table with an ALTER TABLE, to several smaller chunks of INSERT INTO with SELECTS that blocked the table for smaller periods of time, so the change was much more transparent.

Updates

  • Wednesday: We are aware of the issue with the erroneous timestamps for anonymous comments, and are working on a solution to restore them to their former state.
  • Thursday: The database master has once again been restored to our bigdog, watching over us.
  • Thursday: If you are experiencing any problems with things that haven't been up to date (such as watches, etc) the past days, please try to see if the issues can be reproduced now, as it could have been due to delays in data propagation throughout the system caused by the problems experienced.

Improving spam-detection for comments

, ,

We've listened to the feedback you gave us in the Spam filtering comments post, and we've made some improvements to the way it works.

Unfortunately we can't give out the details about the improvements, since this could give spammers clues about how to get past the system. What we can say is that although there will still be some comments wrongly marked as spam, it's now far less likely that this will happen to normal users of My Opera.

We've also fixed a bug where group moderators weren't able to mark comments as not spam. Now all group moderators will see the "Mark as NOT spam" link under comments marked as spam.

We're still monitoring the system and looking for ways to improve it. As always we appreciate your feedback, both in comments and the My Opera: Feedback, questions and discussions forum.

Spam filtering comments

, ,

On My Opera we unfortunately have to deal with spam, just like any other blogging site. We're continuously trying to find new ways of preventing spam, especially where the spam is most noticeable for our users.

One of these places is in the comments of your blog and albums. You may have experienced getting a comment on a blog post or image that had nothing to do with the post or image content, maybe even with an email address or a link to another website. This is usually what we call "comment spam", and to prevent this we're now running all comments through a spam filter. Comments marked as spam will be hidden, with a message that the comment has been marked as spam and is awaiting moderation.

Example: The blog or album owner is the only one who can see the original comment, and will have to mark the comment as "not spam". If the comment is spam, the owner of the blog or album can choose to delete the comment.

Example:
We'll probably have some "false positives", meaning that a few legitimate comments might be marked as spam. This is unfortunate, but thankfully all you have to do if your comment is marked as spam is to wait until the blog or album owner sees the comment and marks it as not spam.

If you notice any bugs with this, please report them in the My Opera: Feedback, questions and discussions forum.

Webcam support on My Opera

, ,

Greetings!

Hope everyone has seen the news about the shiny new Opera 12! My name is Tri, and I'm a summer intern here at Opera. I'm with the Community team which is working on all the awesome community stuff you're looking at! bigsmile

One of the new features in Opera 12 is support for the getUserMedia API with camera support. In honor of Opera 12 we're releasing a new feature on My Opera: you can now use your favorite browser and your webcam to snap your new profile picture. It's done with a few lines of JavaScript and some magic behind the scenes to save your photo. Head over to your profile page and give it a spin!


You can read more about HTML5 video and getUserMedia over at dev.opera.com.