# How to choose the switch correctly in the monitoring project?

Recently, a friend was asking, how many network surveillance cameras can a switch drive? How many gigabit switches can be connected to 2 million network cameras? 24 network heads, can I use a 24-port 100M switch? such a problem. Today, let’s take a look at the relationship between the number of switch ports and the number of cameras!

1. Choose according to the code stream and quantity of the camera
1. Camera code stream
Before choosing a switch, first figure out how much bandwidth each image occupies.
2. The number of cameras
3. To figure out the bandwidth capacity of the switch. Commonly used switches are 100M switches and Gigabit switches. Their actual bandwidth is generally only 60~70% of the theoretical value, so the available bandwidth of their ports is roughly 60Mbps or 600Mbps.
Example:
Look at a single stream according to the brand of the IP camera you are using, and then estimate how many cameras can be connected to a switch. for example :
①1.3 million: A single 960p camera stream is usually 4M, with a 100M switch, you can connect 15 units (15×4=60M); with a gigabit switch, you can connect 150 (150×4=600M).
②2 million: 1080P camera with a single stream usually 8M, with a 100M switch, you can connect 7 units (7×8=56M); with a gigabit switch, you can connect 75 units (75×8=600M) These are mainstream Take the H.264 camera as an example to explain to you, H.265 can be halved.
In terms of network topology, a local area network is usually a two- to three-layer structure. The end that connects to the camera is the access layer, and a 100M switch is generally enough, unless you connect a lot of cameras to one switch.
The aggregation layer and core layer should be calculated according to how many images the switch aggregates. The calculation method is as follows: if connected to a 960P network camera, generally within 15 channels of images, use a 100M switch; if more than 15 channels, use a gigabit switch; if connected to a 1080P network camera, generally within 8 channels of images, use a 100M switch, more than 8 channels use Gigabit switches.
Second, the selection requirements of the switch
The monitoring network has a three-layer architecture: core layer, aggregation layer, and access layer.
1. Selection of access layer switches
Condition 1: Camera code stream: 4Mbps, 20 cameras is 20*4=80Mbps.
That is to say, the upload port of the access layer switch must meet the transmission rate requirement of 80Mbps/s. Considering the actual transmission rate of the switch (usually 50% of the nominal value, 100M is about 50M), so the access layer The switch should choose a switch with 1000M upload port.
Condition 2: The backplane bandwidth of the switch, if you choose a 24-port switch with two 1000M ports, a total of 26 ports, then the backplane bandwidth requirements of the switch at the access layer are: (24*100M*2+1000*2*2 )/1000=8.8Gbps backplane bandwidth.
Condition 3: Packet forwarding rate: The packet forwarding rate of a 1000M port is 1.488Mpps/s, then the switching rate of the switch at the access layer is: (24*100M/1000M+2)*1.488=6.55Mpps.
According to the above conditions, when 20 720P cameras are connected to a switch, the switch must have at least one 1000M upload port and more than 20 100M access ports to meet the requirements.

2. Selection of aggregation layer switches
If a total of 5 switches are connected, each switch has 20 cameras, and the code stream is 4M, then the traffic of the aggregation layer is: 4Mbps*20*5=400Mbps, then the upload port of the aggregation layer must be above 1000M.
If 5 IPCs are connected to a switch, usually an 8-port switch is required, then this
Does the 8-port switch meet the requirements? It can be seen from the following three aspects:
Backplane bandwidth: number of ports*port speed*2=backplane bandwidth, ie 8*100*2=1.6Gbps.
Packet exchange rate: number of ports*port speed/1000*1.488Mpps=packet exchange rate, that is, 8*100/1000*1.488=1.20Mpps.
The packet exchange rate of some switches is sometimes calculated to be unable to meet this requirement, so it is a non-wire-speed switch, which is easy to cause delay when handling large-capacity quantities.
Cascade port bandwidth: IPC stream * quantity = the minimum bandwidth of the upload port, ie 4.*5=20Mbps. Normally, when the IPC bandwidth exceeds 45Mbps, it is recommended to use a 1000M cascade port.
3. How to choose a switch
For example, there is a campus network with more than 500 high-definition cameras and a code stream of 3 to 4 megabytes. The network structure is divided into access layer-aggregation layer-core layer. Stored in the aggregation layer, each aggregation layer corresponds to 170 cameras.
Problems faced: how to choose products, the difference between 100M and 1000M, what are the reasons that affect the transmission of images in the network, and what factors are related to the switch…
1. Backplane bandwidth
2 times the sum of the capacity of all ports x the number of ports should be less than the nominal backplane bandwidth, enabling full-duplex non-blocking wire-speed switching, proving that the switch has the conditions to maximize data switching performance.
For example: a switch that can provide up to 48 Gigabit ports, its full configuration capacity should reach 48 × 1G × 2 = 96Gbps, to ensure that when all ports are in full duplex, it can provide non-blocking wire-speed packet switching .
2. Packet forwarding rate
Full configuration packet forwarding rate (Mbps) = the number of fully configured GE ports × 1.488Mpps + the number of fully configured 100M ports × 0.1488Mpps, and the theoretical throughput of one gigabit port when the packet length is 64 bytes is 1.488Mpps.
For example, if a switch can provide up to 24 gigabit ports and the claimed packet forwarding rate is less than 35.71 Mpps (24 x 1.488Mpps = 35.71), then it is reasonable to assume that the switch is designed with a blocking fabric.
Generally, a switch with sufficient backplane bandwidth and packet forwarding rate is a suitable switch.
A switch with a relatively large backplane and a relatively small throughput, in addition to retaining the ability to upgrade and expand, has problems with software efficiency/dedicated chip circuit design; a switch with a relatively small backplane and relatively large throughput has a relatively high overall performance.
The camera code stream affects the clarity, which is usually the code stream setting of the video transmission (including the encoding and decoding capabilities of the encoding sending and receiving equipment, etc.), which is the performance of the front-end camera and has nothing to do with the network.
Usually users think that the clarity is not high, and the idea that it is caused by the network is actually a misunderstanding.
According to the above case, calculate:
Stream: 4Mbps
Access: 24*4=96Mbps<1000Mbps<4435.2Mbps
Aggregation: 170*4=680Mbps<1000Mbps<4435.2Mbps
3. Access switch
The main consideration is the link bandwidth between access and aggregation, that is, the uplink capacity of the switch needs to be greater than the number of cameras that can be accommodated at the same time * the code rate. In this way, there is no problem with real-time video recording, but if a user is watching the video in real time, this bandwidth needs to be taken into consideration. The bandwidth occupied by each user to view a video is 4M. When one person is watching, the bandwidth of the number of cameras * bit rate * (1+N) is required, that is, 24*4*(1+1)=128M.
4. Aggregation switch
The aggregation layer needs to process the 3-4M stream (170*4M=680M) of 170 cameras at the same time, which means that the aggregation layer switch needs to support the simultaneous forwarding of more than 680M of switching capacity. Generally, the storage is connected to the aggregation, so the video recording is forwarded at wire speed. However, considering the bandwidth of real-time viewing and monitoring, each connection occupies 4M, and a 1000M link can support 250 cameras to be debugged and called. Each access switch is connected to 24 cameras, 250/24, which means that the network can withstand the pressure of 10 users viewing each camera in real time at the same time.

5. Core switch
The core switch needs to consider the switching capacity and the link bandwidth to the aggregation. Because the storage is placed at the aggregation layer, the core switch does not have the pressure of video recording, that is, it only needs to consider how many people watch how many channels of video at the same time.
Assuming that in this case, there are 10 people monitoring at the same time, each person watching 16 channels of video, that is, the exchange capacity needs to be greater than
10*16*4=640M.
6. Switch selection focus
When selecting switches for video surveillance in a local area network, the selection of access layer and aggregation layer switches usually only needs to consider the factor of switching capacity, because users usually connect and obtain video through core switches. In addition, since the main pressure is on the switches at the aggregation layer, it is not only responsible for monitoring the stored traffic, but also the pressure of viewing and calling monitoring in real time, so it is very important to select the appropriate aggregation switches.

Post time: Mar-17-2022