# Replicas Strategy and Cache Optimization of Video Surveillance Systems Based on Cloud Storage
## 5 Data Cache Strategy Based on Location Correlation  
Distributed cache technology is mainly used to improve the response speed of data reading of storage system, which is a significant way to improve the performance of the distributed system. In the distributed storage system, a suitable data cache mechanism can predict the user's data reading behavior according to the running time of the system, and the data is read into the buffer in advance. It can increase the speed of data reading. When a surveillance client plays back particular time of historical video and tracks related targets, it usually begins in a specific location then tracks the target's path. It needs to visit the video data in multiple regions, and there is a certain location correlation among these areas. Hence, according to the location correlation of the front camera, when a video file of a camera is accessed, location-correlated cameras' video data segments for the same period will be added to the cache. To implement the cache mechanism based on location correlation of front camera, we add a cache pool with eight caches in streaming media server. The eight caches have used the method of circulation allocation. When cache pool is full, the highest cache is the priority to be replaced. Also, the size of each cache is 2 MByte. When the video rate is 2 Mb/s, the frame rate is 25 fps, and I frame interval is 12, at least two Group of Pictures (GOP) data segments can be stored. When a user accesses a video file, the first two GOP data segments are in the cache pool. Then the data can be obtained from the cache directly while data is also read from the storage system according to the index information. Otherwise, search the video file in the storage system according to the indexing. Then the first two GOP data segments and location-correlated cameras' data segments in the same period are added to the cache pool. To describe the data cache strategy based on location correlation (LC-cache), we set a surveillance area as an example. As shown in Figure 2, there are four exits and twelve cameras. The camera parameters are in Table 4.  
The cache strategy must be established based on the location correlation between cameras. Due many cameras are installed in crowded places like bank counters or shops, these cameras may have overlapping coverage areas or the front and back position correlation. Therefore, the correlation among cameras is considered in two ways:  
* There is overlap between the cameras;
* There are front and back position correlation between the cameras. Table 5 records the correlation between cameras in Figure 2. There are overlaps between 1-1 and 1-2, so they are associated. There is no overlap and the correlation between the front and back positions between 1-1 and 1-3, so they are not associated. If someone appears in a camera, he may appear in associated cameras. We simulate a path: pedestrian P enters from exit C, goes through the crossroads and leaves from exit D. Hence, the pedestrian P will appear in the camera 3-1, 3-2, 1-3, 3-3, 4-3, 2-3, 4-1 and 4-2. As shown in Figure 3, the cache pool is empty at first. When the user plays back camera 3-1's video data for the first time, not only the data needs to send to the user, but also the first two GOP data segments need to add to the cache. Besides, camera 3-2's first two GOP data segments for the same period will be added to the cache. The state of the cache pool is shown Figure 3(2). \begin{table}
\begin{tabular}{c c c} \hline \hline
**Number** & **Name** & **Value** \\ \hline
1 & camera model & VC-SDI-B3500 WE \\
2 & effective pixels & 1920 (H) \(\times\) 1080 (V) \\
3 & aspect ratio & HD:16:9 SD:4:3 \\
4 & signal to noise ratio & More than 50 dB \\
5 & electronic shutter & 1/30–1/10,000 s \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Camera parameters.