Milestone XProtect Corporate Storage Best Practices

Sebbene abbia già trattato in parte questo tema nel post Best practices per l’installazione di un Milestone XProtect Recording Server fisico su server DELL PowerEdge R7425 – DevAdmin Blog di seguito mi focalizzerò maggiormente sugli aspetti legati allo storage.

Lo storage in Milestone XProtect Corporate è ovviamente un aspetto che va pianificato correttamente affinché i recording server Milestone assolvano correttamente al loro scopo. Lo storage dovrà quindi riuscire a fornire sia lo spazio necessario che la velocità di scrittura necessaria per poter memorizzare le immagini inviate via rete dalle telecamere.

Sizing dello storage

Milestone mette a disposizione al seguente link https://xsd.milestonesys.com/ uno strumento per pianificare lo storage necessario in base alla tipologia e al numero di telecamere si intende gestire.

Di seguito ad esempio le caratteristiche dello storage necessarie per poter gestire ad esempio 100 telecamere a singola ottica a 4MP e compressione H.265 che riprendono in registrazione continua una scena di media complessità come ad esempio la videosorveglianza cittadina.

Dal report è possibile estrapolare la stima dello spazio necessario, dell’IOPS e del Throughput del canale verso i dischi. Il report permette anche di selezionare un tipo di RAID per avere un’indicazione del numero di dischi necessario in base al size del singolo disco impostato.

Scelta del tipo di RAID in base allo spazio e al throughput necessari

Tramite le informazioni dello spazio necessario, dell’IOPS e del Throughput del canale verso i dischi è possibile valutare il tipo di RAID che può essere utilizzato.

Nel caso preso ad esempio di 100 telecamere a singola ottica a 4MP e compressione H.265 che riprendono in registrazione continua una scena di media complessità, utilizzando un server HP DL380 Gen 10 Plus con 2 processori Intel Xeon Gold 633Y 2.40Ghz, 256 GB di RAM e un controller HPE SR932i-p Gen 10+ e 22 HDD da 2.4 TB SAS 512e HPE EG002400JWJNN da 10K Rpm, come discusso nel mio precedente post Confronto performance di scrittura tra RAID 10, RAID 50 e RAID 5 si avrebbero i seguenti valori a seconda del tipo di RAID.

Di conseguenza, escludendo il RAID 10 perché non permetterebbe lo spazio necessario di 34 TB, converrebbe scegliere il RAID 50 che garantirebbe il Throughput di 55,31 MBps anche in condizioni di rebuild al contrario del RAID 5 che comunque sarebbe sconsigliabile perché sono richiesti 18 dischi e quindi il rischio rischio che più dischi vadano in fault contemporaneamente o che altri dischi vadano in fault durante la rebuild è elevato (secondo HP è sconsigliabile utilizzare il RAID 5 con più di 14 dischi, a riguardo si veda Confronto performance di scrittura tra RAID 10, RAID 50 e RAID 5).

Ovviamente se possibile è comunque meglio utilizzare il RAID 10 in quanto garantisce IOPS e Throughput decisamente maggiori ed è il tipo di RAID raccomandato da Milestone per il live recording, mentre il RAID 6 è quello raccomandato per l’archiviazione come riportato in How to set up the XProtect Recording Server for best performance (milestonesys.com):

“RAID 10 is recommended for live recording and RAID 6 for archive.”

Per ulteriori informazioni sul tipo di RAID si veda anche la white paper XProtect Storage Architecture and Recommendations:

“RAID 10 provides the best performance and redundancy and is often called ‘the best RAID configuration for mission critical applications and databases’. In an XProtect VMS RAID 10 is especially good for the recording database – whether or not archiving is used.

However, the benefits of RAID 10 though come at the cost of needing a lot of hard disks making this configuration quite costly – especially when needing a lot of disk space as the XProtect VMS often requires.

This means that, for larger XProtect VMS systems with many cameras per recording server storing recordings for a longer period, RAID 10 may become too expensive. In this case a combination of a smaller RAID 10 array for the recording database, and a larger RAID 5 or 6 array for an archive database could be a more cost-efficient solution.”

“Apart from the most used RAID configurations covered here, there are some additional RAID configurations called RAID 50, RAID 60 and RAID 100, which can offer some specific benefits.”

“recording many devices in parallel and in real-time to the recording databases causes a lot of non-sequential writing on the disks and storage system. Designing a storage system that is fast enough to handle this and large enough to store the recordings for the required time can be expensive, which is where archiving can be used to reduce the cost without compromising on performance”

La migliore efficienza del RAID 10 rispetto al RAID 5 veniva anche sottolineata in una presentazione Milestone intitolata Surveillance Server And Storage Best Practices (ancora disponibile al seguente Milestone Server And Storage Best Practice | PPT (slideshare.net)) in cui venivano confrontate le performance dei due tipi di RAID nella gestione di accessi al storage di tipo Random a 64K ovvero il traffico video tipico di Milestone:

Nell’esempio in cui si utilizzi un server fisico come server di registrazione dotato del numero di dischi sufficienti come ad esempio l’HP DL380 Gen 10 Plus con controller HPE SR932i-p Gen 10+ si può evitare si tenere in conto la velocità di trasmissione verso il SAS in quanto controller come l’HPE SR932i-p Gen 10+ supportano 12 Gb/s SAS e PCIe 4.0 come indicato il HPE SR932i-p Gen10 Plus x32 Lanes 8GB Wide Cache NVMe/SAS 24G PCIe4 x16 Controller Data sheet, nel caso invece si utilizzi una SAN o un NAS (iSCSI, Fibre Channel) occorre tenere conto anche del Throughput del canale di trasmissione verso quest’ultima.

Disk partition alignement

Come indicato in How to set up the XProtect Recording Server for best performance (milestonesys.com) lo stripe size dell’array in RAID dove essere impostato a 512K o superiore e il volume su cui risiedono live recording e l’archiviazione deve avere un cluster size (block size) di 64K o superiore, ovvero il volume deve essere formattato con una dimensione unità di allocazione pari a 64k:

  • Configure the recording and archive hard drives to have a cluster size (block size) of 64K or higher.
  • Ensure RAID stripe size is set to 512K or higher.

Le stesse indicazioni sono ribadite in anche nella white paper XProtect Storage Architecture and Recommendations: dove viene anche indicato di formattare il volume con il file system NTFS:

“To get the best disk performance it is strongly recommended that the disks are formatted with NTFS
with the allocation unit size set to 64K or higher.”

Nel documento Deployment Best Practice Milestone Certified Integration Technician (MCIT) Software release version: 2020 R1 (che fa parte della documentazione per la preparazione all’esame di certificazione Milestone Certified Integration Technician (MCIT)) viene riassunto quanto abbiamo analizzato fino ad ora circa il tipo di RAID, il Disk partition alignement e il file system con la precisazione di evitare il Microsoft Resilient FileSystem (ReFS):

Assicurarsi che il volume utilizzato per il live recording e l’archiviazione non sia completamente occupato

Come riportato in How to set up the XProtect Recording Server for best performance (milestonesys.com) per garantire le performance ottimali dello storage assicurarsi che 15% del volume rimanga libero in modo che l’eliminazione delle registrazione obsolete avvenga sulla base di una schedulazione non in modo imprevedibile quanto viene saturato lo spazio disponibile:

“Configure your maximum recording and archive retention limits so that video is deleted upon a set schedule, and not when the hard disk drive reaches its maximum capacity. For best performance, we recommend to maintain at least 15% of the drive free.”

Configurare correttamente l’antivirus per evitare corruzioni del database di registrazione o riduzioni di performance

Come riportato in How to set up the XProtect Recording Server for best performance (milestonesys.com) disabilitare la scansione antivirus realtime delle directory che contengono il database di registrazione del XProtect Recording Server director, ma pianificare delle scansioni schedulate:

“Disable real-time antivirus scanning; instead choose to scan on a schedule.”

Per maggiori informazioni circa la corretta configurazione dell’Antivirus si veda Configure anti-virus software on XProtect systems (best practices) (milestonesys.com):

It’s regular practice that active high-performance databases should never be scanned. Video Management Software (VMS) servers, as the ones running the XProtect video recording and archiving databases, are no exceptions to this rule. When XProtect video recording and archiving databases are recording, they store large amounts of data on the drives at a very high speed. Should anti-virus software attempt to scan these recordings (especially during the recording process), the performance of the server becomes seriously degraded and in many cases, virus scanning can result in corrupt video databases.

When you need to perform virus scanning, do not scan XProtect Recording Server directories containing recording databases (by default these are located here: C:\mediadatabase\), as well as all subfolders under that location. Also, avoid virus scanning on archive storage directories. In older versions of the software, the databases are by default located in the installation folder, each being a subfolder with the MAC address of the device recorded.

Create the following additional exclusions:

  1. File types: .blk, .idx, .pic, .pqz, .sts, .ts

    An aside on file types (08-Apr-2021):

    • File types present in XProtect Enterprise (all old E-code products; now this line of products is called XProtect Professional VMS): .pic, .pqz, .sts, .ts
    • File types present in XProtect Corporate (all C-code products; this line of products is now called XProtect VMS): .blk, .idx
    • File types present in both XProtect Enterprise and Corporate: .blk, .idx, .pic, .pqz, .sts, .ts
  2. Locations:
    C:\Program Files\Milestone\ (and all subdirectories) or:
    C:\Program Files (x86)\Milestone\ (and all subdirectories), and
    C:\ProgramData\Milestone\ (and all subdirectories)

    Also make sure to exclude from scanning all Archive or Live storage folders or drives.
    (Note: Check for details “Configure and validate exclusions based on file extension and folder location” — Microsoft Help.)

Evitare l’utilizzo di funzionalità Windows che possano degradare le operazioni sul file system

Come riportato in How to set up the XProtect Recording Server for best performance (milestonesys.com) disabilitare ogni funzionalità di Windows non essenziale che può avere impatti sul file system del volume utilizzato per il live recording e l’archiviazione come il servizio di indicizzazione, la compressione dell’unità disco, il volume shadow copy service e la deframmentazione:

“Disable any non-essential Windows tasks and processes that affect the file system. These could include the indexing service and the volume shadow copy service. Also make sure to never use Windows drive compression as it will slow down all write-to-disk operations.”

A riguardo si veda anche quanto riportato in XProtect Storage Architecture and Recommendations:

Windows search indexing
“Windows Search Indexing” can impact recording performance when it indexes the media database files. Therefore, it is recommended to either disable “Windows Search Indexing” or change its configuration, so it does not index the drives storing the XProtect VMS media database files.

Windows disk defragmenter
“Windows Disk Defragmenter” can impact recording performance when it defragments the disks. Therefore, it is recommended to configure “Windows Disk Defragmenter” so it doesn’t defragment the
disks storing the XProtect VMS media database files. The XProtect VMS itself will ensure that all database files are written so they are not fragmented.

Nel caso il server, come nel nostro esempio, abbia il sistema operativo installato su dischi SSD in RAID 1 è possibile disabilitare tramite le proprietà del volume l’ottimizzazione pianifica su tutti i volumi e ciò andrà a disabilitare l’operazione pianificata di sistema Microsoft\Defrag\ScheduleDefrag (in ogni caso va detto che sembra che tale operazione pianifica di fatto non venga mai eseguita ed inoltre in Windows Server l’opzione per selezionare le unità su cui attivare l’ottimizzazione non visualizza l’elenco dei drive).

Per quanto riguarda l’indicizzazione del volume è possibile disabilitarla sempre tramite le le proprietà del volume:

Verificare che i drive dedicati al live recording e l’archiviazione funzionino correttamente

Come in dicato in How to set up the XProtect Recording Server for best performance (milestonesys.com), verificare periodicamente che i drive dedicati al live recording e l’archiviazione stiano funzionando correttamente sia dal punto di vista hardware che del file system:

Ensure recording and archiving drives (and their file systems) are healthy and error-free. You can check the Windows System Event logs for NTFS errors or disk corruption errors, and you can periodically perform a full Windows check disk and S.M.A.R.T. scans (there are many free apps for S.M.A.R.T.).

Configurare le telecamere in modo ottimale per ridurre i dati inviati garantendo la qualità necessaria

Come indicato in How to set up the XProtect Recording Server for best performance (milestonesys.com) abilitare sulle telecamere i codec H.264 o H.265 se disponibili per incrementare la compressione e ridurre il frame rate in modo da ridurre il throughput dei dati con benefici sulla rete, sullo spazio necessario e sulla banda necessaria sul canale verso i dischi delle storage.

Steps you can take to reduce the amount of data sent to the Recording Server:

  • Enable the H.264 or H.265 codec on the cameras, or, if H.264 or H.265 is not available, enable MPEG4 codec (if possible).
  • Increase the compression on the cameras or reduce camera frame rate for a more dramatic effect on reducing inbound media throughput.

In XProtect Storage Architecture and Recommendations viene riportata un’interessante analisi sulle tipologie di compressione (MPJEG-4/H.264/H.265),  la GOP (group-of-pictures) lenght e gli impatti sullo storage:

Nel calo le telecamere lo prevedano valutare la corretta configurazione su funzionalità che possono ridurre la quantità di dati inviati senza particolari impatti sulla qualità delle immagini, come ad esempio la funzionalità Zipstream delle telecamere Axis.  Come riportato in Quick guide on Axis Zipstream (milestonesys.com) tale funzionalità è supportata a partire dalla versione 7.9 del Device Pack e il supporto è stato migliorato successivamente quindi occorre assicurarsi di avere installato sempre l’ultima versione del Device Pack:

Milestone supports Axis Zipstream from Device Pack 7.9 onwards and support for it was further improved in Device Pack v. 8.7. (As always, the latest Device Pack release is recommended.)

Customers need to verify that their camera supports Zipstream and that it is enabled in the camera’s web interface under Setup → Video → Video Stream Settings.

It is recommended to select High bitrate reduction option in order to limit the bitrate and increase storage time for cloud-connected cameras or cameras using edge storage. This setting can, for example, be used together with motion detection trigger and/or variable bitrate (VBR) where the bitrate is allowed to adapt to changes in the scene.

It is recommended to use Variable Bitrate (VBR) or Maximum Bitrate (MBR) with rather high bitrate limit to realize the full potential of Axis’ Zipstream technology.

Note that you can also set Dynamic FPS and a Dynamic GOP range.

A riguardo si veda la white paper Axis Zipstream Technology Cut the storage, not the quality (disponibile anche in lingua italiana).

Verifica della corretta funzionalità dello storage e troubleshooting

Nel caso in cui il IOPS e il Throughput dello storage non siano sufficienti come indicato in ‘Media overflow’ error messages in the XProtect System log (troubleshooting) (milestonesys.com) si avrà l’errore ‘Media overflow’ nell’XProtect System log:

SYMPTOMS
The message “Media Overflow” appears in the Management Client’s System log. A yellow exclamation mark icon may appear next to cameras in the Management Client with the error message “Device in overflow mode, not all media recorded“.

Clips of video/audio that should have been recorded (according to current system configuration) may not have been recorded, or may have been deleted.

Viewing live video or playing back recorded video in the Smart Client may appear choppy, jittery, or may appear to stutter.

CAUSE
XProtect VMS (Corporate, Expert, Professional+, Express+, and Essential+) will log the message “Media Overflow” in the system log if it experiences a state where it is receiving media (video or audio) at a faster rate than the rate it can process the media and write it to the disk. To maintain server stability and uptime, the Recording Server will discard media (decline to record it) and so you may experience a loss of recorded video footage.

Inoltre come riportato in XProtect Storage Architecture and Recommendations è possibile analizzare le perfomance dello storage tramite il Performance Monitor di Windows:

Come riportato in XProtect Storage Architecture and Recommendations le cause principali di performance non sufficienti dello storage possono essere la registrazione di un numero eccessivo di telecamere per singolo server, un bitrate troppo elevato, una codifica video troppo onerosa, playback o esportazioni video simultanee:

If the values indicate that the storage system is overloaded, one of the below cases might be the cause
for it:

  • Too many devices are recorded to the storage system
  • The devices are recording with a too high bitrate
  • Dual stream recording have been enabled, increasing the number of media databases being
    recorded to, and increasing the bitrate being recorded
  • If recording based on motion detection, more cameras detect motion at the same time than
    anticipated
  • Too many cameras are configured to record MJPEG streams
  • Archiving is enabled, causing increased load during periods when recordings are archived
  • Many users play back, or export recorded media simultaneously• Third-party integrations read recorded XProtect VMS media excessively
  • Broken or replaced disks in a RAID system cause performance degradation

Per ovviare ai problemi di performance delle storage, sempre come riportato in XProtect Storage Architecture and Recommendations, è possibile suddividere le telecamere su più server di registrazione, utilizzare RAID più performanti come il RAID 10, aggiungere dischi, abilitare lo short-stroking (se i dischi e il controller RAID lo supportano, tale funzionalità aumenta le performance dello storage perché posiziona i dati più frequentemente utilizzati su tracce più vicine al centro del piatto del disco, ma riduce la capacità di archiviazione e aumenta l’usura del disco in alcune aree), ridurre il bitrate tramite l’utilizzo di MPEG-4, H.264 or H.265:

To address the experienced issues, it is recommended to implement one or more of the below
recommendations even though they may require changing the settings from the preferred settings, and might be costly to implement:

  • Add one or more additional recording servers and move devices from an overloaded recording
    server to a new recording server until the load has normalized
  • If possible, increase the performance of the storage system – for instance by using a faster RAID
    configuration, adding more disks, or by using short-stroking
  •  Add a second storage system to the recording server and distribute the devices across the two
    storage systems
  • If archiving is not used, add a smaller and faster storage system to record the live media data, and use the existing one for storing archives
  • Reduce the bitrate of cameras using MPEG-4, H.264 or H.265
  • If dual stream recording is enabled, disable it
  • Reduce the framerate of cameras using MJPEG or change them to use MPEG-4, H.264 or H.265

Bibliografia

Il tema trattato in questo post è complesso e le informazioni che ho cercato di strutturare in modo organico e schematico sono prese da vari documenti pubblicati da Milestone. Per questo motivo riporto di seguito i rifermenti che ho utilizzato in questo post e tramite cui fare eventualmente ulteriori  approfondimenti o analizzare altri aspetti della progettazione di un’infrastruttura di video sorveglianza basata su software Milestone mediante un approccio ingegneristico.