I’ve already written about changing the I/O scheduler for hard disk under Linux and avoiding sudden outburst of disk I/O using ionice utility. I/O schedulers can have many purposes such as:
Minimize time wasted by hard disk seeks.
Prioritize a certain processes’ I/O requests.
Give a share of the disk bandwidth to each running process etc
Google has sponsored Gelato@UNSW to take a close look at the disk schedulers in Linux, particularly when combined with RAID. They have now published their findings:
We benchmarked the four standard Linux disk schedulers using several different tools (see our wiki for full details) and lots of different workloads, on single SCSI and SATA disks, and on hardware and software RAID arrays from two to eight spindles (hardware raid) and up to twenty spindles (software raid), trying RAID levels 0 through 6.
We had to fix some of the benchmarking tools (the fixes are now upstream), and we developed a new one: a Markov Chain based replay tool, which allows a workload to be characterised and then a similar workload generated.
=> Selected comparisons of throughput and latency with the different Linux schedulers (via Google open source blog) Sysadmin because even developers need heroes!!!
This is a user contributed article.
MySQL server has no support for preventing disk from getting filled up. You need to depend upon external configurations. Let us see how to use standard Linux disk quota to limit user database size.
Suppose you have a user foo on the system as well as on MySQL. Now how do you limit space for foo?
Step #1: Create a separate directory for databases in foo’s home say /home/foo/dbs with ownership mysql:foo and permissions 3755:
# mkdir /home/foo/dbs && chown mysql:foo /home/foo/dbs && chmod 3755 /home/foo/dbs
Step #2: Now move all foo’s databases from /var/lib/mysql to /home/foo/dbs
# mkdir /root/backup
# cp -avr /var/lib/mysql/* root/backup
# mv /var/lib/mysql/database-name /home/foo/dbs/
# chown -Rf mysql:foo /home/foo
# chmod -Rf 3755 /home/foo
# ln -s /var/lib/mysql/database-name /home/foo/dbs/database-name -v
Finally, restart mysqld. If mysqld starts with OK status, then its working else it isn’t:
# /etc/init.d/mysqld restart
NOTE- I AM NOT RESPONSIBLE FOR ANY DAMAGES OCCURRED & TO TEST THIS TRY RESTARTING mysqld. Always backup database before trying something new.
- MySQL Quota-Tool : The MySQL Quota-Tool helps you to set a size limit on MySQL databases. It works by checking the size of each database and revoking the INSERT- and CREATE-priveleges for the databases, which exceed the given size limit. When the size of the database falls below the given limit, the INSERT- and CREATE-priveleges are granted again.
- MySQL Quota Daemon : MySQL Quota Daemon is a lightweight tool for limiting database sizes.
- Developing a MySQL Quota Daemon : One of the drawbacks of MySQL is the lack of a real quota system. This article will cover how our ISP was able to solve this problem and keep track of our customers’ databases. With this completely automated solution, many hours of administration work was avoided.
- Feel free to add your tools and tricks in the comments.
About the author: This article is contributed by Nilesh.