LSI MegaRaid настройка кеширования и системной производительности

Установка и базовое использование утилиты megacli ддля работы с LSI MegaRaid описана в статье
https://kamaok.org.ua/?p=1896

В этой статье рассматриваются параметры кеширования чтения/записи, их настройка и влияния на производительность дисковой подсистемы ввода/вывода

Состояние RAID в том числе и значения политики кеширования можно получить следующей командой (отобразить все логические устройства всех контроллеров)

 

What do the «Cache Policy» values mean ?

are how the raid card uses on board RAM to collect data before writing out to disk or to read data before the system asks for it. Write cache is used when we have a lot of data to write and it is faster to write data sequentially to disk instead of writing small chunks. Read cache is used when the system has asked for some data and the raid card keeps the data in cache in case the system asks for the same data again. It is always faster to read and write to cache then to access spinning disks. Understand that you should only use caching if you have good UPS power to the system. If the system looses power and does not flush the cache it is possible to loose data. No one wants that. Lets look at each cache policy LSI raid card use.

uses the card’s cache to collect enough data to make a series of long sequential writes out to disk. This is the fastest write method.

tells the card to write all data directly to disk without cache. This method is quite slow by about 1/10 the speed of WriteBack, but is safer as no data can be lost that was in cache when the machine’s power fails.

uses an algorithm to see if when the OS asks for a bunch of data blocks sequentially, if we should read a few more sequential blocks because the OS _might_ ask for those too. This method can lead to good speed increases.

tells the raid card to only read the data off the raid disk if it was actually asked for. No more, no less.

allows the general use of the cards cache for any data which is read or written. Very efficient if the same data is accessed over and over again.

is straight access to the disk without ever storing data in the cache. This can be slow as any I/O has to touch the disk platters.

tells the card to use write caching even if the Battery Backup Unit (BBU) is bad, disabled or missing. This is a good setting if your raid card’s BBU charger is bad, if you do not want or can’t to replace the BBU or if you do not want WriteThrough enabled during a BBU relearn test.

if the BBU is not available for any reason then disable WriteBack and turn on WriteThrough. This option is safer for your data, but the raid card will switch to WriteThrough during a battery relearn cycle.

Use the hard drive’s own cache. For example if data is written out the drives this option lets the drives themselves cache data internally before writing data to its platters.

does not allow the drive to use any of its own internal cache.

 

What happens when the Battery Backup Unit (BBU) is bad, disabled or missing ?
The LSI raid BBU allows the raid controller to cache data before being written to the raid disks. Without the battery backup unit the raid card can not guarantee data in the card’s cache will be written to the physical disks if the power goes out. So, if the the BBU is bad, if the raid card is running a «battery relearn» test or if the BBU is disabled then the cached Write-Back policy is automatically disabled and Write-Through is enabled. The result of the direct to disk Write-Through policy is writes become an order of magnitude slower.
As a test we disabled cached Write-Back on our test raid. The bonnie++ benchmark test resulted in writes of 121MB/sec compared to enabling Write-Back and writing at 505MB/sec.
You can check the status of your BBU using the following command.

 

What if you do not want to or can not replace the BBU ?
Truthfully, the raid will work perfectly fine other then higher latency, more CPU usage and lower transfer speeds. If you want to you can simply force the raid card to use write-back cache even if the BBU is dead or missing with the following command. We use the CachedBadBBU option on raid cards which work perfectly fine, but the BBU recharge circuit does not work. Please make sure your system in on a reliable UPS as you do not want to loose any data still in cache and not yet written out to disk. After you execute this command you should see your volume’s «Current Cache Policy» will include «Write Cache OK if Bad BBU» instead of just «No Write Cache if Bad BBU».

 

LSI Write Caching Configuration

Configure Forced Write Back Cache
If you want to enable Forced Write-Back mode on an LSI card you can run the command below which will immediately apply the new settings. Changing settings on the fly usually doesn’t cause issues, but if the server is already under a lot of I/O you might not want to add the -Immediate option and reboot the server later. I do not suggest using Forced Write Back mode unless you have to. Using Write Back caching with SSDs is almost always going to result in slower performance, and if you don’t have a BBU and you force write back caching you can lose data if the server hangs up or power is lost, so be careful with this setting.

Configure Normal Write Back Cache mode
If you must use Write Back Mode, use this method instead of the one above since this command does not FORCE write back. This means that if the BBU is missing / failing the LSI card will revert the cache mode to write through to make sure data is safely written to disk. If you want to use Write Back caching but do not have a BBU then you have to use the command above to force write back caching.

Configure LSI to use cache even with bad BBU
If you want to force write cache even if the LSI card knows it has a bad or missing BBU, then use this command. I have no idea why you would but I’m including this option anyway.

Configure LSI to disable cache with a bad BBU
Disable write cache if no or bad BBU

Configure LSI to use Write Through Caching
If you are using SSDs and want the best IO performance and want to make sure your data gets sent to disk asap, then you should be using Write Through caching, which is basically no cache at all.

 

LSI Read Caching Configuration

How to Enable or Disable LSI RAID Read Caching
To disable Read Ahead caching with an LSI card you can use the -NORA (no read ahead) option. If you use SSDs, I suggest disabling read ahead caching on all LSI cards.

If you still live in the early 2000’s and use spinning HDDs and want better performance then you should enable Read Ahead caching.

 

LSI Direct and Cached I/O Modes

How to Enable Cached I/O mode
If you are using Write Back mode, or have slow HDDs in a RAID you may get better performance by using the RAID card cache on the controller. To utilize this cache whenever possible, select the cached mode.

How to Enable Direct I/O mode
If you have an all SSD RAID and you want the best I/O performance with your LSI card, you should enable Direct I/O mode which reads and writes directly to the SSDs and avoids the RAID cache. The SSDs usually have caches of their own so having to check the RAID card cache every time a request is made can actually reduce performance, to set Direct mode:

 

How to Enable Drive Caches
Just like I mentioned above, you can utilize the individual drive caches in addition to the RAID card cache. If you are using SSDs and decide to not use the RAID cache I would at least make sure the SSD drive caches are enabled.

How to Disable Drive Caches
If you must ensure that no data is ever cached and that data is written to disk immediately, then you will want to disable the RAID card cache, and the drive caches (unless they have an on board capacitor to flush writes to disk in the event of power loss).

 

How check for NCQ and disable or enable NCQ
Check if NCQ is enabled with MegaCLI, you can use the commands below to enable or disable NCQ with LSI cards

Enable NCQ

Disable NCQ

 

View MegaCLI BBU Information
Displays BBU Details

 

Configure LSI Card for SSD RAID
According to LSI, to get the best performance with SSDs, you should be using the following settings:

I’ve found that these settings provide the best random read and write performance. Typically enabling any type of cache reduces performance.

 

System performance and RAID BIOS settings.

The most probable reason for very bad system performance is the RAID controller’s cache being disabled!
In most cases there is no need for any investigation. The first thing to check is if the RAID Cache is ON, and enable it if it is not.
Some RAID controllers without a BATTERY BACKUP UNIT on board switch the cache OFF by default!
Some RAID controllers need to set more than just one single parameter in order to enable the cache.
For example, RAID controllers with LSI chipset have following options:

In order to get the cache enabled, please go to RAID Controller BIOS and make sure following options are selected:

 

Источник:

https://wiki.mikejung.biz/LSI
https://calomel.org/megacli_lsi_commands.html
http://kb.open-e.com/System-performance-and-RAID-BIOS-settings_1283.html
http://kb.open-e.com/Information-on-Configuring-for-Optimal-RAID-Performance_1323.html

Комментирование и размещение ссылок запрещено.

Комментарии закрыты.

Яндекс.Метрика