Urban single lamp control method and system for million-level concurrent communication

Through the four-tuple consistent hashing algorithm and distributed microservice architecture, the scalability and communication reliability issues of traditional urban single-lamp control systems when millions of devices are connected are solved, high-concurrency stable communication and real-time control are achieved, and maintenance costs are reduced.

CN120812818APending Publication Date: 2025-10-17NANJING LICON LOT TECH CO LTD

Patent Information

Application Number
CN202511271348.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-08
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Traditional urban single-lamp control systems suffer from low scalability and insufficient communication mechanisms when dealing with the access of millions of devices and high-concurrency message processing. This leads to processing bottlenecks, message accumulation and delays, and makes it impossible to guarantee real-time and reliability.

Method used

The four-tuple consistent hashing algorithm is used to distribute traffic, combined with the long connection between the device communication module and the single lamp controller, the monitoring logic module is used to process device control requests, and multi-indicator cross-validation is performed through the load monitoring module, and expansion or reduction operations are automatically selected. Distributed microservice architecture and containerization technology are used.

Benefits of technology

It achieves high-concurrency access and stable communication for millions of single-lamp controllers, improves system scalability and reliability, reduces maintenance costs, simplifies operating procedures, and improves the convenience and controllability of urban lighting management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120812818A_ABST
    Figure CN120812818A_ABST
Patent Text Reader

Abstract

The invention relates to the field of urban lighting intellectualization, and particularly discloses a million-level concurrent communication urban single lamp control method and system, and the method comprises the steps: collecting lamp operation state data, packaging the data into an operation data packet, and transmitting the operation data packet to a load balancing module; fixedly distributing the same four-tuple flow in the operation data packet to an equipment communication module instance by adopting a four-tuple consistency Hash algorithm; issuing a device control request to the monitoring logic module by using the application platform, receiving and storing the transcoding data packet through the monitoring logic module, and processing the device control request and a device control message; after protocol coding is carried out on the equipment control message, the equipment control message is sent to the single lamp controller through the established communication connection; the load monitoring module monitors the load indexes of all the modules to perform multi-index cross validation, capacity expansion and capacity reduction operation is automatically selected, and the distributed micro-service architecture is combined with the containerization technology to improve the resource utilization rate and reduce the time required for capacity expansion.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of urban lighting intelligence, more particularly, the present application relates to a kind of urban single lamp control method and system of million concurrent communication. BACKGROUND

[0002] In the intelligent management of urban lighting system, the traditional single lamp control system gradually shows its inherent limitations in dealing with large-scale device access and high concurrent message processing. Such systems mostly use centralized control architecture, relying on a single or limited number of servers for device state monitoring and control instruction issuing. Their scalability is heavily dependent on the vertical upgrade of hardware resources, such as increasing server processing power, memory, and network bandwidth. However, due to the physical performance limit of a single server, simply increasing hardware configuration cannot achieve linear expansion, especially when dealing with millions of single lamp controllers. The system often faces processing capacity bottlenecks.

[0003] In addition, traditional systems perform poorly in high-frequency concurrent scenarios such as mass device online and offline, state reporting, and control instruction issuing. Their communication mechanisms are mostly based on synchronous processing mode, which cannot effectively handle instantaneous large-scale message requests, leading to message accumulation, delay, or loss, and affecting system real-time performance and reliability. In particular, in scenarios requiring real-time acquisition of state feedback from millions of lighting devices or rapid issuance of control instructions, existing system architecture and processing mechanisms cannot guarantee the timeliness and consistency of business responses.

[0004] Therefore, it is necessary to provide a million concurrent communication urban single lamp control system to solve the above technical problems. To solve the above problems, a technical solution is provided. SUMMARY

[0005] To overcome the above-mentioned defects of the prior art, the present application provides a million concurrent communication urban single lamp control method and system to solve the problems of low scalability and million message processing in traditional urban single lamp control systems.

[0006] To achieve the above-mentioned purposes, the present application provides the following technical solutions: A million concurrent communication urban single lamp control method, comprising the following steps: Collecting lamp operating state data through a single lamp controller and packaging it into an operating data packet to send to a load balancing module; Using a four-tuple consistent hashing algorithm to fixedly allocate the same four-tuple traffic in the operating data packet to a device communication module instance; Establishing a communication connection between the device communication module and the single lamp controller, receiving protocol frames from the single lamp controller, and distributing the transcoded data packet to a monitoring logic module; The application platform receives user instructions, sends device control requests to the monitoring logic module, and displays the light fixture state visualization results. The monitoring logic module receives and stores the transcoded data packets, processes the device control requests and device control messages. The device control messages are encoded through the protocol and sent to the single lamp controller through the established communication connection. The load monitoring module monitors the load indicators of each module for multi-index cross verification and automatically selects expansion and contraction operations.

[0007] As a further scheme of the present application, the four-tuple is composed of source IP, target IP, source port and target port.

[0008] As a further scheme of the present application, the communication module receives protocol frames from the single lamp controller, transcodes the data packets and distributes them to the monitoring logic module. The specific steps are as follows: the protocol frames from the single lamp controller are protocol-decoded and converted into standardized message structures in the city single lamp control system, and then distributed to the monitoring logic module through the broadcast message queue.

[0009] As a further scheme of the present application, the monitoring logic module is composed of a request listening task and a device message processing task. The request listening task is responsible for listening to and processing the device control requests issued by the application platform and pushing the device control messages to the application platform. The device message processing task is responsible for issuing and processing the device control messages to the device communication module.

[0010] As a further scheme of the present application, the monitoring logic module issues device control messages to the device communication module. The specific steps are as follows: when the monitoring logic module issues a queue sending control request to the device communication module, the device communication module instance ID is used as the routing Key to ensure that the request to the single lamp controller is issued by the device communication module instance with an established connection.

[0011] As a further scheme of the present application, the load monitoring module monitors the load indicators of each module for multi-index cross verification and automatically selects expansion and contraction operations. The specific steps are as follows: The load indicators of the monitored module in the monitoring period are obtained as multi-index data sets , is the i-th load indicator data set, is the n-th load indicator data set, is the number of load indicator data sets; wherein, , wherein, is the i-th load indicator at time t, is the i-th load indicator at time T, is the monitoring duration; Preprocess all load index data sets, divide the sampling period, calculate the local mutation detection value in the sampling period respectively, perform multi-index cross-validation based on the local mutation detection value, screen out false anomalies in the load index, and retain true anomalies in the load index; When the load monitoring module monitors that the comprehensive load value of the monitored module exceeds the expansion threshold or the single index increases, the expansion instruction of the monitored module is triggered at this time, and the expansion cooling period is entered. Conversely, when the comprehensive load value of the monitored module is lower than the shrinkage threshold and the resource utilization of the single index is lower than the safety water level, the shrinkage instruction of the monitored module is triggered at this time, and the shrinkage cooling period is entered.

[0012] As a further scheme of the present application, the local mutation detection value in the sampling period is calculated respectively, the multi-index cross-validation is performed based on the local mutation detection value, the false anomalies in the load index are screened out, and the true anomalies in the load index are retained. The specific steps are as follows: The local mutation detection value is compared with the preset mutation detection threshold range. If the local mutation detection value is not in the preset mutation detection threshold range, the local mutation detection value is marked as a to-be-verified detection value. Otherwise, it is marked as normal. The local mutation detection values of all load indexes in the same sampling period are obtained. If only one load index in the same sampling period has a to-be-verified detection value, and the local mutation detection values of the remaining load indexes are all normal, the to-be-verified detection value in the load index is marked as a false anomaly. If more than one load index in the same sampling period has a to-be-verified detection value, the to-be-verified detection value in the load index is marked as a true anomaly.

[0013] As a further scheme of the present application, the trigger instruction formula for triggering the expansion instruction of the monitored module based on the single index increase is: In the formula, is the load index value in the sampling period, is the i-th load index at t, is the sampling period, is the i-th load index at t, is the set surge threshold.

[0014] As a further scheme of the present application, when the expansion instruction of the monitored module is triggered, the load monitoring module calculates the target expansion instance number according to the expansion formula, and the expansion formula is: In the formula, is the target expansion instance number, is the upper limit of the instance number, is the current instance number, is the monitored comprehensive load value at t, is the target expansion load threshold. The expansion buffer factor is expanded.

[0015] As a further scheme of the present application, when the shrinkage instruction of the monitored module is triggered, the load monitoring module calculates the target shrinkage instance number according to a shrinkage formula, and the shrinkage formula is: In the formula: The target shrinkage instance number is N, The instance quantity lower limit is Nmin, The current instance quantity is Ncur, The monitored comprehensive load value at t time is L(t), The target shrinkage load threshold is Lth, The shrinkage conservative factor is f.

[0016] A city single lamp control system of million-level concurrent communication, the system comprises a single lamp controller, a load balancing module, a device communication module, a monitoring logic module, an application platform and a load monitoring module; The single lamp controller is used for collecting lamp operating state parameters, and packaging into operating data packets and sending to the load balancing module; The load balancing module is used for receiving operating data packets, and distributing operating data flow to the device communication module instance by using a four-tuple consistent hash algorithm; The application platform is used for issuing device control requests to the monitoring logic module, and displaying lamp state visualization results; The monitoring logic module is used for receiving single lamp controller data and storing lamp operating state parameters, and processing device control requests and device control messages; The device communication module is used for establishing a connection communication connection with the single lamp controller, transcoding data packets and distributing to the monitoring logic module, and receiving device control messages, and sending the device control messages to the single lamp controller through the established connection after protocol encoding; The load monitoring module is used for monitoring load indicators of each module for multi-index cross verification, and performing expansion and shrinkage operations.

[0017] The technical effects and advantages of the city single lamp control method and system of the million-level concurrent communication of the application are as follows: the application adopts the four-tuple consistency hash algorithm, and fixedly distributes the same four-tuple flow to the corresponding device communication module instance, avoids connection interruption and state loss caused by session remapping, realizes high-concurrent access and stable communication of the million-level single lamp controller, and significantly improves the expansibility of the system; the device communication module and the single lamp controller maintain a long connection, and the protocol frame is converted into a standardized message structure, which improves the reliability and data processing efficiency of the communication; the modules are decoupled through the message queue, which reduces the coupling degree of the system, enhances the throughput capacity, and can play a buffering role at the peak of traffic, avoiding the collapse of the backend due to instantaneous pressure; the application platform provides a visual interactive interface, which can intuitively display the lamp running state and control result, simplifies the operation process, and improves the convenience and controllability of city lighting management; the load monitoring module monitors the module running state in real time based on the comprehensive load formula, automatically triggers expansion when the load is too high or a single indicator increases sharply, and automatically triggers contraction when the load is too low and the utilization rate of each resource is lower than the safety water level, so as to ensure the stable operation of the system while improving the resource utilization rate; in addition, the application adopts the distributed micro-service architecture combined with the containerization deployment, so that each module can be independently scaled, supports rapid elastic expansion, and reduces the maintenance and operation cost.

[0018] The application adopts the four-tuple consistency hash to reduce the overhead of frequent connection establishment and the load of the backend device communication module; the message queue is adopted to reduce the coupling of the city single lamp control system, reduce the system response time, improve the throughput, and avoid the collapse of the backend module due to peak pressure caused by instantaneous high concurrency; the load monitoring module is used to flexibly define the expansion scheme of each module, and the distributed micro-service architecture combined with the containerization technology can improve the resource utilization rate and reduce the time required for expansion. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 A flowchart of a city single lamp control method of the million-level concurrent communication provided for the embodiment of the application is provided. Figure 2 An expansion and contraction flowchart of the load monitoring module provided for the embodiment of the application is provided. Figure 3 A system block diagram of a city single lamp control system of the million-level concurrent communication provided for the embodiment of the application is provided. DETAILED DESCRIPTION

[0020] The technical solutions in the application will be described in detail below with reference to the drawings in the application. Obviously, the described technical solutions are only a part of the application, not all. Based on the technical solutions in the application, all other technical solutions obtained by those skilled in the art without creative labor fall within the scope of the application.

[0021] As Figure 1 shown in FIG. 1 is a flowchart of a method for controlling a million-level concurrent communication city single lamp according to an embodiment of the present application, Figure 1 The execution subject of the method shown in FIG. 1 can be a software and / or hardware device. The execution subject of the present application can include, but is not limited to, at least one of the following: user equipment, network equipment, etc. Among them, the user equipment can include, but is not limited to, computers, smart phones, personal digital assistants (Personal Digital Assistant, PDA) and the above-mentioned electronic devices, etc. The network equipment can include, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of computers or network servers based on cloud computing, wherein cloud computing is a kind of distributed computing, which is a super virtual computer composed of a group of loosely coupled computers. The present embodiment does not make any limitation. Including steps S1 to S7, as follows: S1, collecting lamp running state data by single lamp controller, and packing into running data packet and sending to load balancing module; In the present embodiment, a group of street lamps on a city trunk road is taken as an example. The single lamp controller thereof can periodically collect running state parameters including the on-off state, current, voltage, power, illumination intensity, temperature of the lamp, and pack these parameters according to a preset data format to form a running data packet. For example, in a certain sampling period, the lamp state collected by a certain single lamp controller is: the on-off state is "on", the current is 0.8A, the voltage is 220V, the power is 176W, the illumination intensity is 300lx, and the temperature is 38℃. The single lamp controller encapsulates the above data according to the communication protocol to form a running data packet, and sends it to the load balancing module of the system through the wireless communication network. The load balancing module parses the received running data packet, and distributes it to the corresponding device communication module instance based on the four-tuple consistent hashing algorithm, to ensure the stability and consistency of the subsequent communication process.

[0022] S2, using four-tuple consistent hashing algorithm to fix the allocation of the same four-tuple flow in the running data packet to the device communication module instance; It should be noted that the load balancing strategy used in the load balancing module is four-tuple consistent hashing, that is, the flow of the same four-tuple is always allocated to a fixed device communication module instance, which avoids session interruption or state loss caused by connection remapping, reduces the overhead of frequently establishing new connections, reduces server resource consumption, and at the same time splits the million single lamp controller flow to avoid overload of the device communication module instance.

[0023] S3, the device communication module establishes a communication connection with the single lamp controller, receives a protocol frame from the single lamp controller, and distributes the transcoded data packet to the monitoring logic module; It should be noted that the communication module is responsible for processing the protocol communication between the single lamp controller and the monitoring logic module, and is also responsible for processing the device message transmission of the monitoring logic module; the device communication module is responsible for receiving the protocol frame of the single lamp controller, converting it into a message structure body available in the urban single lamp control system after protocol decoding, and then distributing it to the monitoring logic module through a broadcast message queue.

[0024] Specifically, the modules communicate with each other through a message queue, and the direct dependency between the modules is converted into a dependency on the queue through a producer-consumer model, reducing the coupling of the urban single lamp control system; the publishing message is returned immediately without waiting for the receiving party to synchronize processing, thereby reducing system response time and improving throughput; in the face of instantaneous high concurrency, the message queue can be used as a buffer to temporarily store requests, and the consumer can gradually digest them according to processing capacity, avoiding the collapse of the backend module due to peak pressure.

[0025] S4, using the application platform to receive user instructions, issuing device control requests to the monitoring logic module, and displaying lamp state visualization results; It should be noted that the application platform is responsible for responding to user operation instructions and displaying corresponding visual charts or issuing control requests to the monitoring logic module.

[0026] S5, receiving and storing transcoded data packets through the monitoring logic module, processing device control requests and device control messages; In the embodiments of the present application, taking a certain urban road section as an example, when the single lamp controller transcodes the running data packet through the device communication module, the standardized message received by the monitoring logic module contains parameters such as the on-off state, voltage, current, power, light intensity, and temperature of the lamp. The monitoring logic module first writes the message into a database for storage, facilitating historical data query and statistics. Subsequently, the management personnel issues a device control request through the application platform, for example, "automatically dim all street lamps on a certain road section to 50% brightness after 22:00". After receiving the request, the monitoring logic module generates a corresponding device control message and judges whether the execution condition is met in combination with the stored running data, for example, confirming that the current lamp is in the "on" state and the power voltage is normal. If the condition is met, the monitoring logic module encodes the device control message through the protocol, sends it to the message queue, the device communication module listens to the queue, and sends it to the target single lamp controller through the established connection, thereby realizing remote control operation. Through the above process, the monitoring logic module not only completes the reception and storage of the running data, but also effectively processes the device control request issued by the user, ensuring the controllability and intelligence of system operation.

[0027] S6, the device control message is sent to the single lamp controller through the established communication connection after protocol encoding. In the embodiment of the application, the manager issues an instruction through the application platform to automatically turn off the street lamp of a certain section at 1:00 a.m. to save energy. The instruction is first forwarded to the monitoring logic module, which generates a corresponding device control message. The message content includes the unique identifier of the target street lamp, the control type (turning off the lamp), the execution timestamp, and other information. Subsequently, the monitoring logic module encodes the device control message according to the communication protocol specification to generate a protocol frame that conforms to the single lamp controller communication standard. The encoded protocol frame is transmitted through the long connection between the device communication module and the single lamp controller that has been established, ensuring that the control instruction can be reliably delivered to the target single lamp controller. After receiving the protocol frame, the single lamp controller parses the control instruction and immediately executes the lamp-off operation, while returning feedback information of the execution result. Through the above process, remote precise control of the single lamp is realized, ensuring the energy saving and controllability of the urban lighting system.

[0028] S7, cross-verify multiple indicators by monitoring the load indicators of each module through the load monitoring module, and automatically select expansion and contraction operations.

[0029] In a million-level urban lighting system, different city sizes have different requirements for the device communication module. If the scale is 0-100 million single lamps, the focus is on achieving high-concurrency stable communication and low-latency regional response; if the scale is ≥100 million single lamps, it needs to cope with the problem of ultra-large-scale concurrency and global consistency across regions and data centers.

[0030] At 0-1 million single lamp scale, the device communication module adopts zoning access and layered communication architecture. Zoning access: the city is divided into several regions, an independent access gateway is deployed in each region, each gateway manages 20-50 million single lamps, the device communication module maintains a long connection with each regional gateway to realize distributed access. Layered communication: the device communication module is located in the access layer of the city lighting system and is responsible for connection management, data transcoding, protocol encapsulation / decapsulation. At this time, the process of the million-level single lamp control method is: the single lamp controller periodically reports the running state data; the device communication module receives the original data packet, performs protocol decoding and format transcoding; the transcoded data packet is distributed to the corresponding regional monitoring logic module; the monitoring logic module generates a control message according to the data analysis result; the device communication module receives the control message, performs protocol encoding, and sends it to the target single lamp controller through the established long connection; the single lamp executes dimming, switching or alarm processing. Taking "zoning and time-based dimming" as an example: after 22:00 at night, the lighting demand of some secondary trunk roads decreases, the monitoring platform generates a dimming command to reduce the brightness of 50 million street lamps in a certain region to 60%, and the device communication module encodes the batch of control messages and distributes them to the corresponding regional gateway, requiring that all street lamps in the region respond within 500ms. In the embodiment of the present application, the total number of single lamps in a city is about 800,000, which are distributed in urban areas, suburban areas, industrial parks and along highways, and the city lighting system needs to schedule these single lamps uniformly and monitor energy consumption and fault conditions in real time. In this scenario, the device communication module needs to support concurrent connections in the order of millions, which belongs to the range of high concurrency but still controllable, the key is to ensure connection stability, reduce delay and improve regional rapid response capability.

[0031] At ≥100 million single lamp scale, the device communication module adopts multi-data center, distributed cluster deployment, and introduces a global scheduling control platform, responsible for cross-regional task allocation and data synchronization. Multi-data center: set up data centers in different cities or regions, and deploy multiple communication module instances in each data center. Distributed clustering: the device communication module jointly undertakes the connection and message processing tasks of ten million single lamps through distributed message queues and load balancing mechanisms. At this time, the process of the million single lamp control method is as follows: the single lamp controller accesses the communication module through the nearest data center, reducing the cross-regional delay; the communication module instance transcodes the data and transmits it to the global monitoring logic module through the distributed message queue; when unified control is needed, the monitoring logic module generates large-scale control messages; the communication module uses sharding and parallel encoding technology to distribute thousands of messages to multiple instances and issue them in parallel; and each regional single lamp controller receives the instructions and executes them. Taking the "holiday night scene unified dimming" as an example: during the National Day, 1000 million street lamps in the city need to be switched to holiday mode at 20:00, at this time the monitoring logic module generates a unified dimming command, requiring the lamps to complete mode switching within 1 second, the device communication module uses parallel encoding and multi-link transmission technology to split the task to different data centers and issue it in parallel, ensuring that more than 95% of the single lamps complete the control response within 1 second.

[0032] In the embodiment of the application, the number of single lamp controllers exceeds one million, resulting in a significant increase in the pressure on the device communication module instances. The load monitoring module collects the comprehensive load indicators of the device communication module in real time, including CPU utilization, memory occupancy, network throughput, and message queue accumulation, and obtains the current load value according to the comprehensive load calculation formula. For example, at a certain time, the comprehensive load value of the device communication module is monitored to be 0.88, which exceeds the preset expansion threshold of 0.7, and the network throughput indicator has increased sharply. At this time, the load monitoring module automatically triggers the expansion instruction, and calculates the target number of instances according to the expansion formula to expand the number of device communication module instances from 60 to 90, to ensure that the massive protocol frames can be processed in time. Subsequently, during the early morning period, the street lamp running state data significantly decreases, the comprehensive load value drops to 0.25, which is lower than the shrinkage threshold of 0.4, and the utilization of each resource is lower than the safety level. The load monitoring module automatically triggers the shrinkage instruction according to the shrinkage formula to reduce the number of instances from 90 to 30 to release redundant computing resources. Through the above process, the system can dynamically adjust between expansion and shrinkage according to the real-time running state, achieving the effect of meeting high concurrency demand and improving resource utilization.

[0033] Preferably, the four-tuple is composed of source IP, target IP, source port, and target port.

[0034] It should be noted that the same four-tuple flow in the running data packet is a set of continuous data packets identified by the same four-tuple, that is, all protocol frames of the same connection, which constitute a protocol frame set belonging to the same four-tuple connection.

[0035] Preferably, based on the communication module receiving the protocol frame from the single lamp controller, the data packet is converted and distributed to the monitoring logic module, and the specific steps are as follows: protocol decoding is performed on the protocol frame from the single lamp controller, and the protocol frame is converted into an internal standardized message structure of the urban single lamp control system, and is distributed to the monitoring logic module through a broadcast message queue.

[0036] Preferably, the monitoring logic module is composed of a request monitoring task and a device message processing task; wherein the request monitoring task is responsible for monitoring and processing the device control request issued by the application platform and pushing the device control message to the application platform; and the device message processing task is responsible for issuing and processing the device control message to the device communication module.

[0037] Preferably, the monitoring logic module issues the device control message to the device communication module, and the specific steps are as follows: when the monitoring logic module issues a queue sending control request to the device communication module, the device communication module instance ID is used as the routing Key to ensure that the request to the single lamp controller is issued by the device communication module instance that has established a connection, thereby preventing the control request from being issued unsuccessfully due to the absence of the connection in the instance connection cache.

[0038] Preferably, the load monitoring module is used to monitor the load indicators of each module, and the comprehensive load value of the monitored module is calculated based on the load indicators: In the formula: is the comprehensive load value of the monitored module at time t, is the weight corresponding to the i th load indicator, is the i th load indicator at time t.

[0039] Preferably, the load monitoring module is used to monitor the load indicators of each module for multi-index cross verification, and automatically selects the expansion and contraction operation, and the specific steps are as follows: the load indicators of the monitored module in the monitoring period are obtained as a multi-index data set , is the i th load indicator data set, is the n th load indicator data set, is the number of load indicator data sets; wherein, , in the formula, is the i th load indicator at time t, is the i th load indicator at time T, is the monitoring duration; Preprocess all load indicator data sets, divide the sampling period, calculate the local mutation detection value in the sampling period respectively, perform multi-index cross-validation based on the local mutation detection value, screen out false anomalies in the load indicators, and retain true anomalies in the load indicators; When the load monitoring module monitors that the comprehensive load value of the monitored module exceeds the expansion threshold or the single-index surge, the expansion instruction of the monitored module is triggered at this time, and the expansion cooling period is entered. Conversely, when the comprehensive load value of the monitored module is lower than the shrinkage threshold and the resource utilization of the single index is lower than the safety water level, the shrinkage instruction of the monitored module is triggered at this time, and the shrinkage cooling period is entered.

[0040] Further, the local mutation detection value in the sampling period is calculated, multi-index cross-validation is performed based on the local mutation detection value, false anomalies in the load indicators are screened out, and true anomalies in the load indicators are retained. The specific steps are as follows: The local mutation detection value in the sampling period is calculated, and the calculation formula is: In the formula: is the local mutation detection value in the sampling period of the i-th load indicator, is the local mutation detection value in the sampling period of the i-th load indicator, is the i-th load indicator at time t, is the i-th load indicator at time t, is the average value of the load indicator in the monitoring time period; The local mutation detection value is compared with the preset mutation detection threshold range. If the local mutation detection value is not in the preset mutation detection threshold range, the local mutation detection value is marked as a to-be-verified detection value. Otherwise, it is marked as normal. Get the local mutation detection value of all load indicators in the same sampling period. If only one load indicator in the same sampling period has a to-be-verified detection value, and the local mutation detection values of the remaining load indicators are all normal, the to-be-verified detection value in the load indicator is marked as a false anomaly. If more than one load indicator in the same sampling period has a to-be-verified detection value, the to-be-verified detection value in the load indicator is marked as a true anomaly.

[0041] In one case of the embodiment of the application, the load monitoring module performs multi-index monitoring on the device communication module. The load indicators in the monitoring period include CPU utilization, memory occupancy, network throughput and message queue accumulation length, which respectively constitute multi-index data sets . Among them, represents the CPU utilization sequence, represents the memory occupancy sequence, represents the network throughput sequence, Indicates the message queue accumulation sequence. The system monitors with a sampling period of 1 minute. During the period of 10:00–10:05, the CPU utilization rate suddenly increased from 65% to 95%. The local mutation detection value is calculated. =0.46, exceeding the preset mutation threshold of 0.3. However, during the same period, the local mutation detection values ​​for memory utilization, network throughput, and message queue backlog length all fell within the threshold range, indicating that only CPU utilization was abnormal. Based on multi-metric cross-validation rules, the load monitoring module identified the CPU utilization anomaly as a false anomaly and did not trigger capacity expansion.

[0042] Subsequently, between 10:15 and 10:20, CPU utilization was monitored to spike from 70% to 92%, memory usage from 68% to 85%, and network throughput from 300MB / s to 480MB / s. The corresponding local mutation detection values ​​all exceeded the threshold range and were marked as true anomalies. At this point, the load monitoring module calculated a composite load value of 0.82, exceeding the expansion threshold of 0.7. This automatically triggered an expansion command and, according to the expansion formula, increased the number of device communication module instances from 40 to 60. After the expansion operation was completed, the system entered a cool-down period to avoid frequent expansion and contraction due to transient load fluctuations.

[0043] During the low-load period of 02:00–02:10 at night, the monitored combined load value was only 0.22, below the scaling threshold of 0.4. Furthermore, the utilization of individual indicators—CPU utilization, memory usage, network throughput, and message queue backlog length—all fell below the safe level of 30%. Therefore, the load monitoring module automatically triggered a scaling operation, reducing the number of instances from 60 to 25 to free up resources. This example demonstrates that the present invention's solution can effectively identify and eliminate false anomalies in load indicators, and promptly execute capacity expansion or contraction when true anomalies occur, thereby ensuring the stability and resource utilization of the city's single-lamp control system.

[0044] In another embodiment of the present invention, the load monitoring module samples the load of the device communication module for a period of 5 minutes. During the period of 20:00-20:05, the CPU utilization rate is monitored to rise from 55% to 80%, and the local mutation detection value is calculated. =0.45, exceeding the preset threshold. However, the local mutation detection values ​​for memory utilization, network throughput, and message queue backlog length all remained within normal ranges. Based on multi-metric cross-validation, the load monitoring module determined that this CPU anomaly was a false one and therefore did not trigger capacity expansion, avoiding resource waste caused by fluctuations in a single metric.

[0045] At the night 03:00-03:10 period, the system operation pressure is greatly reduced, the comprehensive load value is only 0.18, which is lower than the shrinkage threshold 0.4, and the CPU, memory, network and message queue utilization rates are all below the safe water level, i.e. all less than 25%. The load monitoring module thus automatically triggers the shrinkage instruction to reduce the device communication module instance number from 50 to 20, releasing the excess computing and network resources. Through the above process, the system significantly improves the resource utilization rate while ensuring the performance.

[0046] Preferably, the load monitoring module automatically selects the expansion and shrinkage operation, and the specific steps are as follows: When the load monitoring module monitors that the comprehensive load value of the monitored module exceeds the expansion threshold or the single index suddenly increases, the expansion instruction of the monitored module is triggered at this time, and the expansion cooling period is entered; on the contrary, when the comprehensive load value of the monitored module is lower than the shrinkage threshold and the resource utilization rate of the single index is lower than the safe water level, the shrinkage instruction of the monitored module is triggered at this time, and the shrinkage cooling period is entered.

[0047] It should be noted that in the embodiment of the application, the condition that the load monitoring module monitors the single index sudden increase specifically refers to that a certain load index of the monitored module abnormally rapidly rises in a short time, such as several sampling periods, even if the comprehensive load value does not exceed the expansion threshold, at this time, the expansion protection mechanism is triggered, and the load index can be CPU usage, memory occupancy, network bandwidth occupancy or message queue length, at this time, the condition of single index sudden increase specifically embodies that the CPU usage rate jumps from 40% to 90% in a short time; the memory occupancy rate rapidly rises in a short time, such as rising by 30% in 10s; the network bandwidth occupancy shows that the traffic of a single module instantaneously rises; the message queue length shows that the number of queue backlog items rapidly increases.

[0048] More specifically, the trigger instruction formula for triggering the expansion instruction of the monitored module based on the single index sudden increase is: In the formula, is the load index value in the sampling period, is the i-th load index at t, is the sampling period, is the i-th load index at t, is the set sudden increase threshold.

[0049] According to the application example of the above trigger instruction formula: if the queue length increases by more than 2000 in 1s, the expansion instruction is triggered immediately even if the comprehensive load has not reached the threshold.

[0050] It is further needed to be specified that the resource utilization of the comprehensive load value single index of the monitored module is all lower than a safety water level, specifically, when the comprehensive load value is lower than the shrinkage threshold value, and each single resource index is in a safety range, i.e., low utilization, the shrinkage operation is triggered, which is to avoid blind shrinkage of a certain index in a high load condition. Common safety water level setting can be: CPU usage < 40%; memory occupancy < 50%; network bandwidth usage < 30%; message queue length < 10% threshold value; only when the above conditions are met at the same time, it is considered that the shrinkage can be performed, and part of the resources are released.

[0051] Based on the above, in one case of the embodiment of the application, the comprehensive load value is 68%, which does not exceed the expansion threshold value 70%, but the CPU usage increases from 40% to 85% within 2 seconds, which exceeds the set "single index sudden increase threshold value 30%", so the expansion instruction is triggered. In another case, the comprehensive load value is 25%, which is lower than the shrinkage threshold value 30%, and at the same time, the CPU usage is 20%, the memory occupancy is 30%, the network bandwidth usage is 15%, and the message queue length is 5%, which are all lower than the set "safety water level", so the shrinkage instruction is triggered.

[0052] Preferably, when the expansion instruction of the monitored module is triggered, the load monitoring module calculates the target expansion instance number according to the expansion formula, and the expansion formula is: In the formula, is the target expansion instance number, is the upper limit of the instance number, is the current instance number, is the monitored comprehensive load value at time t, is the target expansion load threshold value, is the expansion buffer factor.

[0053] Preferably, when the shrinkage instruction of the monitored module is triggered, the load monitoring module calculates the target shrinkage instance number according to the shrinkage formula, and the shrinkage formula is: In the formula, is the target shrinkage instance number, is the lower limit of the instance number, is the current instance number, is the monitored comprehensive load value at time t, is the target shrinkage load threshold value, is the shrinkage conservative factor.

[0054] It is needed to be specified that the monitored module is a lamp in a city single lamp control system.

[0055] In the city single lamp control system of the embodiment of the application, a device communication module cluster is deployed to process concurrent data communication from the single lamp controller. The following setting parameters are given: Upper limit of instance quantity Lower limit of instance quantity Target expansion load threshold Target shrinkage load threshold Expansion buffer factor Shrinkage conservative factor 0.2 Load monitoring module detects the comprehensive load value at the current time t Current instance quantity 50, at which time the expansion instruction is triggered, and the target expansion instance number is calculated based on the expansion formula to obtain: ; Therefore, the load monitoring module expands the current device communication module instance number from 50 to 77 to share the high-concurrency communication demand of the million-level single lamp controller.

[0056] When the system runs at night in this embodiment, most single lamps are in the off state, and the load monitoring module detects the comprehensive load value at the current time t Current instance quantity 77, at which time the shrinkage instruction is triggered, and the target shrinkage instance number is calculated based on the shrinkage formula to obtain: .

[0057] Therefore, the load monitoring module reduces the current device communication module instance number from 77 to 26, releases redundant computing and storage resources, and improves energy efficiency.

[0058] Based on the above, when the load suddenly increases, the expansion formula can quickly increase the device communication module instance quantity, guaranteeing the communication stability; when the load decreases, the shrinkage formula can effectively recover resources, avoiding waste; in combination with the expansion and shrinkage cooling period settings, the entire system can be guaranteed to run smoothly under dynamic load.

[0059] It should be noted that the city single lamp control system adopts a distributed micro-service architecture combined with containerization technology. By dividing the system into multiple independent modules, each module can be individually expanded according to the load without expanding other low-load services, greatly improving resource utilization. At the same time, containerization provides a standardized operating environment for microservices, greatly reducing the time required for expansion.

[0060] For example Figure 2The load monitoring module is shown in the expansion and contraction flow chart. After starting the expansion and contraction judgment process, the comprehensive load of each module is obtained: the load monitoring module periodically collects the running load data of the device communication module, the monitoring logic module and the like, such as CPU usage, memory occupancy, message processing delay, queue accumulation and the like, and calculates the comprehensive load value. It is judged whether the expansion condition is met: the comprehensive load value is compared with the preset expansion threshold value. If the comprehensive load exceeds the threshold value, it means that the current processing capacity is insufficient, and the next step is entered. If the expansion condition is not met, it is judged whether the contraction condition is met. If the comprehensive load is lower than the contraction threshold value, and each single index is lower than the safety water level, it is considered that there is resource waste, and the contraction judgment is entered. If the contraction condition is not reached, the load acquisition link is recycled. Expansion cooling period judgment: when the expansion condition is triggered, it is judged whether it is in the expansion cooling period; if it is in the cooling period, frequent expansion and contraction operations are avoided, and the monitoring cycle is returned directly; if it is not in the cooling period, the expansion operation is performed, and the number of module instances is increased to improve the processing capacity. Contraction cooling period judgment: when the system triggers the contraction condition, it is also judged whether it is in the contraction cooling period; if it is in the cooling period, frequent contraction due to instantaneous low load is avoided, and the monitoring cycle is returned directly; if it is not in the cooling period, the contraction operation is performed, and the redundant instances are released to save resources. The expansion and contraction operations specifically include: expansion operation: the target instance number is calculated through the expansion formula, and the number of instances of the device communication module or the monitoring logic module is increased on the premise that it does not exceed the upper limit of the instance number; contraction operation: the target instance number is calculated through the contraction formula, and the idle or low-load instances are reduced on the premise that it does not fall below the lower limit of the instance number. After the expansion and contraction operations are completed, the next round of load collection and judgment process is continued, forming a dynamic self-adaptive scheduling mechanism.

[0061] A million-level concurrent communication urban single lamp control system, comprising a single lamp controller, a load balancing module, a device communication module, a monitoring logic module, an application platform and a load monitoring module; the single lamp controller is connected with the load balancing module, the load balancing module is connected with the device communication module, the device communication module is connected with the single lamp controller, the device communication module is connected with the monitoring logic module, the application platform is connected with the monitoring logic module, and the load monitoring module is connected with the load balancing module, the device communication module, the monitoring logic module and the application platform respectively; The single lamp controller is used for collecting lamp running state parameters, and packaging into running data packets and sending to the load balancing module; The load balancing module is used for receiving running data packets, and distributing running data flow to the device communication module instance by using a four-tuple consistency hash algorithm; The application platform is used for issuing device control requests to the monitoring logic module, and displaying lamp state visualization results; The monitoring logic module is configured to receive single lamp controller data and store lamp operation state parameters, and process device control requests and device control messages; The device communication module is configured to establish a connection with the single lamp controller, distribute transcoded data packets to the monitoring logic module, and receive device control messages, and send the device control messages to the single lamp controller after protocol encoding through the established connection. The load monitoring module is configured to monitor the load indicators of each module for multi-indicator cross-validation, and perform expansion and contraction operations.

[0062] As shown in Figure 3 , it is a system block diagram of a million-level concurrent communication urban single lamp control system according to an embodiment of the present application, which can be used to execute the steps in the method embodiment shown in Figure 1 , and the implementation principle and technical effects are similar, which will not be repeated here.

[0063] Through the introduction of the above embodiments, the present application uses a four-tuple consistent hash algorithm to fixedly allocate the same four-tuple flow to the corresponding device communication module instance, avoiding connection interruption and state loss caused by session remapping, realizing high-concurrency access and stable communication of a million-level single lamp controller, and significantly improving the expansibility of the system; the device communication module maintains a long connection with the single lamp controller, and the protocol frame is transcoded into a standardized message structure, improving the reliability and data processing efficiency of the communication; the modules are decoupled through the message queue, which not only reduces the coupling degree of the system, but also enhances the throughput capacity, and can play a buffering role during traffic peaks, avoiding backend crashes caused by instantaneous pressure; the application platform provides a visual interactive interface, which can intuitively display the lamp operation state and control results, simplifying the operation process and improving the convenience and controllability of urban lighting management; the load monitoring module monitors the module operation state in real time based on a comprehensive load formula, automatically triggers expansion when the load is too high or a single indicator suddenly increases, and automatically triggers contraction when the load is too low and the utilization rate of each resource is lower than the safety water level, thereby improving resource utilization while ensuring stable operation of the system; in addition, the present application uses a distributed micro-service architecture combined with containerization deployment, so that each module can be independently scaled, supporting rapid and elastic expansion, and reducing maintenance and operation costs.

[0064] The embodiment of the present application uses four-tuple consistent hash to reduce the overhead of frequent connection establishment and reduce the load of the backend device communication module; uses the message queue to reduce the coupling of the urban single lamp control system, reduce the system response time and improve the throughput, and avoid the collapse of the backend module due to peak pressure caused by instantaneous high concurrency; uses the load monitoring module to flexibly define the expansion scheme of each module and the distributed micro-service architecture combined with containerization technology, which can improve resource utilization and reduce the time required for expansion.

[0065] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, and all of them should be included in the protection scope of the present application.

[0066] Finally, the above merely provides the preferred schemes of the present application, but is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A city single lamp control method with millions of concurrent communications, characterized in that: The following steps are involved: The single lamp controller collects the lamp operation status data, packages it into an operation data packet and sends it to the load balancing module; Using the four-tuple consistent hashing algorithm, the same four-tuple traffic in the running data packet is fixedly assigned to the device communication module instance; Establish a communication connection with the single lamp controller based on the device communication module, receive the protocol frame from the single lamp controller, and transcode the data packet to distribute it to the monitoring logic module; Utilize the application platform to receive user instructions, send device control requests to the monitoring logic module, and display the visual results of the lighting status; Receive and store transcoded data packets through the monitoring logic module, and process device control requests and device control messages; The device control message is encoded by the protocol and sent to the single lamp controller through the established communication connection; The load monitoring module monitors the load indicators of each module to perform multi-indicator cross-validation and automatically select expansion and reduction operations.

2. The city single lamp control method with millions of concurrent communications according to claim 1 is characterized in that: The communication module receives protocol frames from the single-lamp controller, transcodes the data packets and distributes them to the monitoring logic module. The specific steps are: protocol decoding the protocol frames from the single-lamp controller, converting them into the standardized message structure within the city single-lamp control system, and distributing them to the monitoring logic module through the broadcast message queue.

3. The city single lamp control method with millions of concurrent communications according to claim 2 is characterized in that: The monitoring logic module consists of a request monitoring task and a device message processing task; the request monitoring task is responsible for monitoring and processing the device control requests issued by the application platform and pushing device control messages to the application platform; the device message processing task is responsible for issuing and processing device control messages to the device communication module.

4. The city single lamp control method with millions of concurrent communications according to claim 3 is characterized in that: The monitoring logic module sends device control messages to the device communication module. The specific steps are as follows: when the monitoring logic module sends a control request to the device communication module, the device communication module instance ID is used as the routing key to ensure that the request to the single lamp controller is issued by the device communication module instance with which a connection has been established.

5. The city single lamp control method with millions of concurrent communications according to claim 1 is characterized in that: The load monitoring module monitors the load indicators of each module for multi-indicator cross-validation and automatically selects expansion and reduction operations. The specific steps are as follows: Obtain the load indicators of the monitored modules during the monitoring period as a multi-indicator data set , is the i-th load indicator data set, is the nth load indicator data set, is the number of load indicator data sets; in, , where is the i-th load index at time t, is the i-th load index at time T, The monitoring duration; All load indicator data sets are preprocessed, divided into sampling periods, and local mutation detection values ​​within each sampling period are calculated. Multi-indicator cross-validation is performed based on the local mutation detection values ​​to filter out false anomalies in the load indicators and retain true anomalies in the load indicators. When the load monitoring module detects that the comprehensive load value of the monitored module exceeds the expansion threshold or a single indicator suddenly increases, the expansion instruction of the monitored module is triggered and the expansion cooling period begins; conversely, when the comprehensive load value of the monitored module is lower than the reduction threshold and the resource utilization of a single indicator is lower than the safe water level, the reduction instruction of the monitored module is triggered and the reduction cooling period begins.

6. The city single lamp control method with millions of concurrent communications according to claim 5 is characterized in that: Calculate the local mutation detection values ​​within the sampling period respectively, perform multi-index cross-validation based on the local mutation detection values, filter out false anomalies in the load indicators, and retain true anomalies in the load indicators. The specific steps are as follows: Compare the local mutation detection value with the preset mutation detection threshold range. If the local mutation detection value is not within the preset mutation detection threshold range, mark the local mutation detection value as a pending verification value; otherwise, mark it as normal; Obtain the local mutation detection values ​​of all load indicators within the same sampling period. If only one load indicator has a detection value to be verified within the same sampling period, and the local mutation detection values ​​of the remaining load indicators are all output normally, then the detection value to be verified in the load indicator is marked as a false anomaly; if more than one load indicator has a detection value to be verified within the same sampling period, then the detection value to be verified in the load indicator is marked as a true anomaly.

7. The city single lamp control method with millions of concurrent communications according to claim 5 is characterized in that: The trigger instruction formula for triggering the expansion instruction of the monitored module based on a sudden increase in a single indicator is: Where: is the load index value within the sampling period, is the i-th load index at time t, is the sampling period, is the load index at time i, The sudden increase threshold is set.

8. The city single lamp control method with millions of concurrent communications according to claim 7 is characterized in that: When the expansion instruction of the monitored module is triggered, the load monitoring module calculates the target number of expansion instances according to the expansion formula. The expansion formula is: Where: The number of instances for target expansion is set. is the upper limit of the number of instances. is the current number of instances, is the monitored comprehensive load value at time t, is the target expansion load threshold, is the expansion buffer factor.

9. The city single lamp control method with millions of concurrent communications according to claim 5, characterized in that: When the shrinking instruction of the monitored module is triggered, the load monitoring module calculates the target shrinking instance number according to the shrinking formula. The shrinking formula is: Where: is the target number of scale-down instances, is the lower limit of the number of instances, is the current number of instances, is the monitored comprehensive load value at time t, is the target shrinkage load threshold, is the conservative shrinkage factor.

10. A city single lamp control system with millions of concurrent communications, applied to a city single lamp control method with millions of concurrent communications as claimed in any one of claims 1 to 9, characterized in that: The system includes: a single lamp controller, a load balancing module, a device communication module, a monitoring logic module, an application platform and a load monitoring module; The single lamp controller is used to collect the operating status parameters of the lamp, package them into operating data packets and send them to the load balancing module; The load balancing module is used to receive running data packets and distribute the running data traffic to the device communication module instance using the four-tuple consistent hashing algorithm; The application platform is used to send device control requests to the monitoring logic module and display the visual results of the lighting status; The monitoring logic module is used to receive data from the single lamp controller and store the lamp operating status parameters, and process device control requests and device control messages; The device communication module is used to establish a communication connection with the single lamp controller, transcode data packets and distribute them to the monitoring logic module, and receive device control messages, encode the device control messages through the protocol and send them to the single lamp controller through the established connection; The load monitoring module is used to monitor the load indicators of each module to perform multi-indicator cross-validation and perform expansion and reduction operations.

Citation Information

Patent Citations

  • System and method for supporting automatic capacity expansion and contraction to access different numbers of single lamp controllers

    CN117156649A

  • Smart led street lamp designed for saving energy, monitored and controlled by a remote control center

    EP2131630A2

  • Distributed intelligence ballast system and extended lighting control protocol

    US20060125426A1

Cited By

  • Urban lighting intelligent management and comprehensive evaluation method and system

    CN121660200A