3

I run a web server with a couple of web applications in apache on the same device.

The other day I had to run a chown -R and a chmod -R on a folder containing over 100 000 files. This took some time and I realized that the disk IO caused all applications to run extremely slow for a long time. The CPU usage was also high for minutes after the commands where done.

Would the use of several devices reduce disk IO blocking?

If I have had each applications on different devices would the disk IO affect the overall performance of the server the same way?

Are the disk IO blocking divided per disk or on the system as a whole?

1

Mechanical storage devices are slow because they are mechanical. (Other, non-mechanical, storage devices can also be slow, but for different reasons and in a different way.) Each I/O operation on a mechanical disk takes a fixed amount of time (seek time, on the order of milliseconds) to locate a position on the disk, plus a variable amount of time to transfer the data (typically between 40 and a 200 MiB/sec, depending on the characteristics of the disk). When performing many small operations seek time dominates; a single spinning disk is limited to a few hundred I/O operations per second (IOPS) -- an expensive 15 kRPM SAS disk will be good for about 200 IOPS, a regular 7.2 kRPM SATA disk for 100, and a small and cheap 5.4 kRPM disk for about 70.

Using multiple disks may help -- provided that the I/O operations are distributed among the available disks. Distributing the I/O operations among the available disks can be automatically performed by a suitable configation of software or hardware. Using dedicated hardware, such as storage arrays connected through a Storage Area Network is preferred in enterprise applications; for private use the common approach is to use software RAID; a good starting point is the Linux RAID wiki. RAID can increase throuhput, reliability, or both; if the goal is to increase throughput then you should consider RAID levels with striping, such as RAID 0 and RAID 10.

  • a single spinning disk is usually limited to a few hundred I/O operations per second I'd say that's optimistic and that level of performance will only be reached by expensive, high-end 15k RPM SAS/FC drives. Typical consumer-grade SATA drives are only capable of 50-70 I/O ops per second. – Andrew Henle Nov 30 '16 at 11:29
  • Yes, true. Edited the answer to provide guestimated IOPS for orientation. – AlexP Nov 30 '16 at 11:55
  • This is in a hosted vmware solution so i was playing with the idea to mount small disks for each app. But i guess it then could depend on the underlying hardware distribution. It would be interesting to know though if excessive io on one disk would slow down the system on the same level if everything else was on another drive. If i had time i would test it myself. I was just hoping someone had the answer already. – TNordkvist Nov 30 '16 at 14:59
  • When speaking of the influence of I/O on performance, disk means actual physical disk. Actually in such a context we prefer to speak of spindles in order to make it clearer. Virtual disks are not spindles, they are files. – AlexP Nov 30 '16 at 15:57
0

I think the problem is that most filesystems doesn't support well so much files.

So try not to have so many files in a single directory, but split in subdirectories.

When you do a slow operation, you can nice/renice the chmod so that it will not disturb much of the webserver. But as I wrote in first paragraph, this is a problem of many files, so excessive locking and time in kernel mode, which nice doesn't really solve.

Having other devices could help, but IMHO it is not so much real IO then kernel operation because of huge directory.

[Note: moving extra big files doesn't give such slowdown, so it is not only I/O]

  • Not all the files are in one directory, they are divided into subdirectories. And this is hopefully nothing i have to do too often. Next time I'll try ionice in combination with nice and see if there is a difference in behaviour. – TNordkvist Nov 30 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.