Victor
Victor

Reputation: 13368

High disk IO rate

My rails application always reaches the threshold of the disk I/O rate set by my VPS at Linode. It's set at 3000 (I up it from 2000), and every hour or so I will get a notification that it reaches 4000-5000+.

What are the methods that I can use to minimize the disk IO rate? I mostly use Sphinx (Thinking Sphinx plugin) and Latitude and Longitude distance search.

What are the methods to avoid?

I'm using Rails 2.3.11 and MySQL.

Thanks.

Upvotes: 2

Views: 1991

Answers (3)

Tilo
Tilo

Reputation: 33722

did you check if your server is swapping itself to death? what does "top" say?

your Linode may have limited RAM, and it could be very likely that it is swapping like crazy to keep things running..

If you see red in the IO graph, that is swapping activity! You need to upgrade your Linode to more RAM, or limit the number / size of processes which are running. You should also add approximately 2x the RAM size as Swap space (swap partition).

http://tinypic.com/view.php?pic=2s0b8t2&s=7

Upvotes: 5

jefflunt
jefflunt

Reputation: 33954

Is it going high and staying high for a long time, or is it just spiking temporarily?

There aren't going to be specific methods to avoid (other than not writing to disk).

You could try using a profiler in production like NewRelic to get more insight into your performance. A profiler will highlight the actions that are taking a long time, however, and when you examine the specific algorithm you're using in that action, you might discover what's inefficient about that particular action.

Upvotes: 0

tadman
tadman

Reputation: 211540

Since your question is too vague to answer concisely, this is generally a sign of one of a few things:

  • Your data set is too large because of historical data that you could prune. Delete what is no longer relevant.
  • Your tables are not indexed properly and you are hitting a lot of table scans. Check with EXAMINE on each of your slow queries.
  • Your data structure is not optimized for the way you are using it, and you are doing too many joins. Some tactical de-normalization would help here. Make sure all your JOIN queries are strictly necessary.
  • You are retrieving more data than is required to service the request. It is, sadly, all too common that people load enormous TEXT or BLOB columns from a user table when displaying only a list of user names. Load only what you need.
  • You're being hit by some kind of automated scraper or spider robot that's systematically downloading your entire site, page by page. You may want to alter your robots.txt if this is an issue, or start blocking troublesome IPs.

Upvotes: 3

Related Questions