Disclosure of Invention
Based on the background, the invention aims to provide a system and a method for supporting automatic capacity expansion and contraction to access different numbers of single light controls, so as to solve the problem of insufficient system concurrency performance under the condition of large-scale single light control access and the condition of server resource waste during concurrency valley.
In order to achieve the above purpose, the invention adopts the following technical scheme:
a first aspect of the present invention provides a system for supporting automatic capacity expansion and contraction access to different numbers of single light controls, comprising:
the at least one service processing module is used for carrying out service management and data instruction issuing of the access equipment;
the system comprises a plurality of lamp control data transmission modules, a lamp control protocol adaptation module and a lamp control protocol adaptation module, wherein the lamp control data transmission modules are used for monitoring and maintaining communication links between the port monitoring and access equipment, forwarding the received data packets to the lamp control protocol adaptation module after data identification and verification, and receiving instructions of the lamp control protocol adaptation module and issuing the instructions to the specified access equipment;
the lamp control protocol adaptation modules are used for analyzing the uplink access equipment data packet of the lamp control data transmission module according to the protocol, converting the data packet into a data format in the illumination management platform, continuing to uplink the corresponding service processing module, packaging an instruction issued by the service processing module according to the protocol, and issuing the packaged instruction packet to the appointed lamp control data transmission module;
The resource scheduler comprises a lamp control instance management coordination service, a lamp control instance starting service, a lamp control instance monitoring service and a storage unit, and is used for performing management coordination and monitoring of the lamp control data transmission module and the lamp control protocol adaptation module;
the access device comprises a single lamp control and a centralized control, the lamp control data transmission module and the lamp control protocol adaptation module are set to be of different types based on the protocol of the corresponding access device, the lamp control data transmission module and the lamp control protocol adaptation module are started and then run as a lamp control data transmission program instance and a lamp control protocol adaptation program instance, and the lamp control data transmission program instance or the lamp control protocol adaptation program instance of the same type is managed as an instance cluster.
Further, the lamp control instance management coordination service is used for setting operation parameters of the lamp control instance monitoring service and receiving information of the lamp control instance monitoring service; transmitting a starting command to a lamp control instance starting service to start a lamp control data transmission module or a lamp control protocol adaptation module; setting an upper limit threshold, a lower limit threshold and a maximum delay threshold of throughput of a lamp control data transmission program example or a lamp control protocol adaptation program example;
The lamp control instance starting service is used for receiving a lamp control instance management coordination service instruction, calling an execution script to start a lamp control data transmission module or a lamp control protocol adaptation module, or sending a stopping instruction to a running program instance, and calling the execution script to stop a program instance process; managing the start-up parameters;
the lamp control instance monitoring service is used for receiving the status report of each running program instance and periodically reporting information to the lamp control instance management coordination service;
the storage unit is used for storing parameters of each program instance, including starting preset information and current information of the program instance.
The first aspect of the present invention provides a method for supporting automatic expansion and contraction capacity to access different numbers of single light controls, which is based on the system for supporting automatic expansion and contraction capacity to access different numbers of single light controls described in the first aspect, and comprises the following steps:
s1, before planned lighting time, a resource scheduler pre-starts a lamp control data transmission module and a lamp control protocol adaptation module according to the historical access conditions of centralized control and single lamp control;
s2, establishing a data transmission relation among the service processing module, the lamp control data transmission program instance and the lamp control protocol adaptation program instance;
And S3, dynamically adding or reducing the starting quantity of the lamp control data transmission program instance and the lamp control protocol adaptation program instance according to the load condition acquired by the lamp control instance monitoring service in the resource scheduler.
Further, the step S1 specifically includes:
s11, starting a lamp control instance management coordination service, acquiring a lamp control data transmission module and a lamp control protocol adaptation module starting record, judging whether the lamp control data transmission module and the lamp control protocol adaptation module need to be started or not, and putting the modules needing to be started into a starting list;
s12, the lamp control instance management coordination service informs the lamp control instance starting service to call an execution script to start the lamp control data transmission module and the lamp control protocol adaptation module recorded in the starting list;
and S13, the execution script returns a starting result, and the lamp control instance monitoring service monitors the newly started lamp control data transmission program instance and the lamp control protocol adaptation program instance.
Further, the step S2 specifically includes:
the interface addresses of the lamp control protocol adaptation program instance and the lamp control data transmission program instance are pre-determined, wherein the interface addresses comprise an IP and a port;
when a new lamp control protocol adaptation program instance is started, the interface addresses of the service processing module and the lamp control data transmission program instance are taken as starting parameters to be transmitted in, and the interface address of the newly-created lamp control protocol adaptation program instance is returned to the service processing module;
When a new lamp control data transmission program example is started, the interface address of the lamp control protocol adaptation program example is taken as a starting parameter to be input.
Further, the step S3 specifically includes:
s31, based on the load condition obtained by the lamp control instance monitoring service, the lamp control instance management coordination service judges whether to start or close the program instance, wherein the load condition comprises throughput and processing time delay periodically reported by the lamp control protocol adaptation program instance and the lamp control data transmission program instance;
s32, starting the lamp control data transmission module or the lamp control protocol adaptation module and closing the lamp control protocol adaptation program instance or the lamp control data transmission program instance according to the judging result.
Further, in step S31, the lamp control instance management coordination service determines whether to start or stop the program instance based on the throughput upper and lower limit thresholds and the maximum delay threshold of the preset lamp control data transmission program instance or the lamp control protocol adaptation program instance, and the monitored actual throughput and processing delay of the program instance, which specifically includes:
if the throughput of the program instance is greater than the preset throughput upper threshold and the processing time delay is greater than the preset maximum time delay, judging that the program instance needs to be shunted;
If the throughput of the program instance is larger than the preset throughput upper threshold and the processing time delay is smaller than the preset maximum time delay, the throughput upper threshold preset by the program instance is improved;
if the throughput of the program instance is smaller than the preset throughput lower threshold, judging that the program instance can be combined;
if the program instance is determined to be in a crash state, the program instance is restarted.
Further, in step S32, if it is determined that the program instance needs to be shunted, the following operations are performed:
if the total throughput of the instance cluster where the current program instance is located is greater than the sum of the preset upper limit throughput of all the program instances in the cluster, starting a new instance;
if the total throughput of the instance cluster where the current program instance is located is smaller than the sum of the preset upper limit throughput of all the program instances in the cluster, load balancing allocation is carried out, and the data packet processing proportion of the current program instance is reduced.
Further, in step S32, the starting of the light control data transmission module or the light control protocol adaptation module, and the closing of the light control protocol adaptation program instance or the light control data transmission program instance specifically include:
when the lamp control protocol adaptation module needs to be started, the lamp control instance management coordination service calls the lamp control instance starting service to start a new lamp control protocol adaptation module to be a lamp control protocol adaptation program instance, and establishes a data transmission relation with the service processing module and the lamp control data transmission program instance;
When the lamp control data transmission module needs to be started, the lamp control instance management coordination service calls the lamp control instance starting service to start a new lamp control data transmission module to be a lamp control data transmission program instance, a data transmission relation between the lamp control data transmission module and the lamp control protocol adaptation program instance is established, and meanwhile, the lamp control instance management coordination service notifies the service processing module to issue an uplink address change command to related equipment;
when the lamp control protocol adaptation program instance needs to be closed, the lamp control instance starting service firstly sends a closing command to the target program instance, the target program instance stops receiving external data after receiving the command, after all current data are processed, the lamp control instance starting service calls an execution script to transfer the server IP and the process ID where the instance is located, and the execution script ends the program instance process;
when the lamp control data transmission program instance needs to be closed, the lamp control instance management coordination service notifies the service processing module to issue an uplink address changing instruction, all equipment connected to the lamp control data transmission program instance is changed and connected to other lamp control data transmission program instances in the current instance cluster, and then the closing step is executed;
When the program instance crashes and needs to be restarted, the light control instance starting service calls the execution script to transfer the server IP and the process ID where the program instance is located, the execution script ends the program instance process, and then the light control instance starting service starts the program instance according to the stored program instance record.
Further, in step S3, dynamically adding or subtracting the enabled number of the lamp control data transmission program instance and the lamp control protocol adaptation program instance further includes:
and if the current time enters the lamp-off state time period, stopping all lamp control protocol adaptation program instances and lamp control data transmission program instances, wherein the field value for keeping the operation of the instances is judged to be the operation in the parameters of the program instances except for the fact that the field value for keeping the operation of the instances is judged to be the operation.
Further, the method further comprises:
in the lighting period, the resource scheduler performs survival judgment on each lamp control protocol adaptation program instance record and each lamp control data transmission program instance record, and whether the program instance needs to be initialized and started when the lamp is turned on next time or not:
if one program instance is the only one program instance of the type of protocol, judging that the program instance needs to survive all the time;
the resource scheduler sets a delay time, after the delay time of the on-time, the resource scheduler sets the surviving program instance to be initialized and started when the program instance is turned on next time, and other program instances are set to be not started.
The beneficial effects of the invention are as follows:
according to the system and the method for supporting automatic capacity expansion and contraction access of different numbers of single light controls, the equipment access program is decoupled and separated according to different working contents in the module, and the device access program is decoupled into the light control data transmission module and the light control protocol adaptation module which are adapted to different protocols, so that the management and control of access equipment are finer, and meanwhile, the transverse capacity expansion can be conveniently carried out. Meanwhile, the starting, stopping and state monitoring of the single-light control and centralized control equipment access module (program example) are carried out through the resource scheduler, so that the situation that enough computer resources are prepared in advance before the lamp is turned on to expand the capacity of the system is realized, and the resources are released to shrink the capacity of the system in daytime without lighting the lamp is realized, the problem of insufficient system concurrency performance under the condition of large-batch single-light control access is solved, and the condition of server resource waste during concurrency low is avoided.
Detailed Description
For a further understanding of the present invention, preferred embodiments of the invention are described below in conjunction with the examples, but it should be understood that these descriptions are merely intended to illustrate further features and advantages of the invention, and are not limiting of the claims of the invention.
The communication of the single light control has high concurrency of instantaneous access and the tidal property of data reporting in different time periods, the single light control can intensively send data to the illumination management platform at the moment of turning on the light at night, and the single light control can hardly communicate with the platform in daytime. Therefore, the management system should prepare enough computer resources in advance before turning on the lamp to perform system capacity expansion, and release the resources to perform system capacity reduction during the daytime when the lamp is not turned on.
Based on this, an embodiment of the present invention first provides a system for supporting automatic capacity expansion and contraction access to different numbers of single light controls, which is configured in a lighting management platform, and includes:
The access equipment comprises a single lamp control and a centralized control to be accessed or accessed;
the system comprises a plurality of lamp control data transmission modules, a lamp control protocol adaptation module and a lamp control protocol adaptation module, wherein the lamp control data transmission modules are used for monitoring and maintaining communication links between the port monitoring and access equipment, forwarding the received data packets to the lamp control protocol adaptation module after data identification and verification, and receiving instructions of the lamp control protocol adaptation module and issuing the instructions to the specified access equipment;
the lamp control protocol adaptation modules are used for analyzing the uplink access equipment data packet of the lamp control data transmission module according to the protocol, converting the data packet into a data format in the illumination management platform, continuing to uplink the corresponding service processing module, packaging an instruction issued by the service processing module according to the protocol, and issuing the packaged instruction packet to the appointed lamp control data transmission module;
the resource scheduler comprises a lamp control instance management coordination service, a lamp control instance starting service, a lamp control instance monitoring service and a storage unit, and is used for managing, coordinating and monitoring the lamp control data transmission module and the lamp control protocol adaptation module;
the lamp control data transmission module and the lamp control protocol adaptation module are related to the centralized control and single lamp control protocol, namely different protocols have different types; the lamp control data transmission module and the lamp control protocol adaptation module are called a lamp control data transmission program instance and a lamp control protocol adaptation program instance after being started, and the lamp control data transmission program instance or the lamp control protocol adaptation program instance with the same type is managed as an instance cluster.
In the embodiment of the invention, the lamp control data transmission module and the lamp control protocol adaptation module are obtained by a device access program of the decoupling illumination management platform. The device access program is a module in the lighting management platform, which is responsible for receiving data packets of single light control and centralized control and issuing instructions, and the module is decoupled and separated according to different internal working contents of the module and is divided into a plurality of light control data transmission modules and a light control protocol adaptation module. After decoupling and separation, the control of the access equipment is finer, and the transverse expansion can be conveniently performed.
The lamp control data transmission module is closer to one side of the equipment, and is a lamp control data transmission program example after being started, and three things are mainly done:
1) And maintaining a communication link between the device and the device, monitoring a certain port by the started program instance, and sending data to the port after waiting for centralized control and single-lamp control to be on line. The communication link includes a TCP method, a UDP method, and an HTTP method. In the TCP mode, the device side needs to keep a long link with the lamp control data transmission program instance, and needs to keep consistent with the lamp control data transmission program instance in the uplink when the instruction is issued.
2) And (4) after the uplink data carries out simple data identification and verification on the received data packet, forwarding the data packet to the lamp control protocol adaptation program instance.
3) And issuing an instruction, receiving the instruction of the lamp control protocol adaptation program instance, and issuing the instruction to the designated equipment.
The lamp control protocol adaptation module is a lamp control protocol adaptation program example after being started, and the working contents of the lamp control protocol adaptation module mainly comprise the following components on the lamp control data transmission program example:
1) And analyzing the equipment data packet of the lamp control data transmission program example uplink according to the protocol, converting the equipment data packet into a data format in the illumination management platform, and continuing uplink to a specific service processing module.
2) And encapsulating the instruction issued by the service processing module according to the protocol, and continuing to issue the encapsulated instruction packet to the lamp control data transmission program instance.
3) Some complex business operations are performed, such as encapsulation of multiple instructions, merging of multiple data packets, etc.
In the embodiment of the invention, the lamp control data transmission program instance and the lamp control protocol adaptation program instance are in a many-to-many relationship, namely, one lamp control data transmission program instance can send data packets to different lamp control protocol adaptation program instances, and one lamp control protocol adaptation program instance can also receive or send data of a plurality of lamp control data transmission program instances. In general, the logic of the lamp control protocol adaptation program is more complex, which is a performance bottleneck for accessing a large number of devices, so that more lamp control protocol adaptation program instances are often started in actual deployment.
Fig. 1 is an example illustrating the structure and relationship of a lamp control data transmission program example, a lamp control protocol adaptation program example, and a service processing module. As can be seen from fig. 1, the access device includes a centralized control and a single lamp control, wherein, because the number of the centralized control is generally smaller, one centralized control lamp control data transmission program instance and one lamp control protocol adaptation program instance are deployed separately for the centralized control, n single lamp control data transmission program instances and n lamp control protocol adaptation program instances are deployed separately, and the lamp control protocol adaptation program instances of the same type can form a lamp control protocol adaptation program instance cluster, and the lamp control data transmission program instances are the same.
In the embodiment of the invention, the resource scheduler is an independently operated service process, does not serve as a specific lighting management service, and only serves as management coordination and monitoring of the lamp control data transmission module (lamp control data transmission program instance) and the lamp control protocol adaptation module (lamp control protocol adaptation program instance). The resource scheduler comprises three modules, namely a lamp control instance management coordination service, a lamp control instance starting service and a lamp control instance monitoring service, and a storage unit is used for storing data. Fig. 2 shows the main relations of three services and storage units inside the resource scheduler, and the relation schematic of the three services with external execution scripts, lamp control data transmission program examples and lamp control protocol adaptation program examples.
As shown in fig. 2, the lamp control instance management coordination service responsibilities mainly include the following: setting operation parameters of a lamp control instance monitoring service, and receiving information of the lamp control instance monitoring service; transmitting a starting command to a lamp control instance starting service to start a lamp control data transmission module or a lamp control protocol adaptation module; and setting an upper throughput threshold, a lower throughput threshold and a maximum delay threshold of the lamp control data transmission program instance or the lamp control protocol adaptation program instance.
The lamp control instance starting service is used for receiving a lamp control instance management coordination service instruction, calling an execution script to start a lamp control data transmission module or a lamp control protocol adaptation module, or sending a stopping instruction to a running program instance, and calling the execution script to stop a program instance process; and managing starting parameters, including the port of the lamp control data transmission program instance, the concurrent thread number of the lamp control protocol adaptation program instance, the reporting time interval between the lamp control data transmission program instance and the lamp control protocol adaptation program instance, and the like.
The lamp control instance monitoring service opening interface is used for receiving status report of each running program instance, including instance information, throughput, time delay and the like, and periodically reporting the information to the lamp control instance management coordination service. Meanwhile, the lamp control instance monitoring service is also used for maintaining an external web monitoring page, and a user can see the states and the processing amounts of each adapting program and the transmission program in the page.
The storage unit stores parameters of each lamp control data transmission program instance and each lamp control protocol adaptation program instance, and the parameters are mainly starting preset information and current information of the lamp control data transmission program instance and the lamp control protocol adaptation program instance. For example, the following information is a record of an example of a lamp control data transmission program in the memory unit:
in the information, the PID is the process ID of the lamp control data transmission program instance in the current server; host_id is the identification of the server, and through the identification, only one piece of server information such as server IP, configuration and the like can be determined; port is the port monitored by the lamp control data transmission program example; the resource_id is the equipment protocol type associated with the lamp control data transmission program instance; keep_alive is whether or not to keep the instance running all the time; the reed run represents whether it should be started before turning on the lamp; and max_capability is a throughput upper limit value preset by the lamp control data transmission program example.
The above-mentioned fields are only a part of the actual practice, and other fields are not listed. In addition, the lamp control protocol adaptation program instance information field is different from the listener instance field, and is not listed one by one.
The execution script in fig. 2 is a script which is pre-written to start (or stop) a specific lamp control protocol adaptation program instance or a lamp control data transmission program instance, and the lamp control instance starting service truly starts (or stops) the lamp control protocol adaptation program instance or the lamp control data transmission program instance by calling the execution script. Because of the different server operating systems deployed, the execution scripts are also different, in the linux operating system, the suffix of the script is sh, and in the windows, the suffix of the script is bat.
Another embodiment of the present invention provides a method for supporting automatic capacity expansion and contraction access to different numbers of single light controls, which is performed based on the system supporting automatic capacity expansion and contraction access to different numbers of single light controls in the first embodiment, and includes the following steps:
1. before the planned lighting time, the resource scheduler performs pre-starting of the lamp control data transmission module and the lamp control protocol adaptation module according to the centralized control and single lamp control access condition of the previous day.
Specifically, in the embodiment of the invention, the lamp control instance management coordination service scans all records in the storage unit in a timing task mode, and starts a lamp control data transmission module and a lamp control protocol adaptation module which need to be started in advance. The method comprises the following specific steps:
firstly, a lamp control instance management coordination service needs to be started, a lamp control data transmission module and a lamp control protocol adaptation module start record are obtained, whether the modules need to be started or not is judged, and the modules needing to be started are put into a start list. The lamp control instance management coordination service operates in the form of a timed task, the operating time is typically advanced by a period of time from the scheduled lighting. After the timing task is started, starting to scan all lamp control data transmission modules and lamp control protocol adaptation modules in the storage unit to start records, and judging the acquired records: if the new run field is 1 and the record is not running, it is placed in the to-be-started list.
And then, the lamp control instance management coordination service informs the lamp control instance starting service to call an execution script to start the lamp control data transmission module and the lamp control protocol adaptation module recorded in the starting list. The lamp control example starts the service to scan the record in the starting list, and determines starting parameters according to the fields of the record, such as: determining a target server operated by a module (program instance) to be started according to the host_id field so as to determine an operating system and a login account of the server; and determining the type of the specific started module (program instance) according to the resource_id, and transmitting the parameters into the execution script to start the specific module (program instance).
And finally, the execution script returns a starting result, and the lamp control instance monitoring service monitors the newly started lamp control data transmission program instance and the lamp control protocol adaptation program instance. The execution script returns the process ID of the program instance after the starting module, and the lamp control instance starting service updates the process ID into the storage unit. And the started program instance also periodically reports various state data to the lamp control instance monitoring service according to preset parameters.
Fig. 3 is an example illustrating the process of starting an instance of adaptation program a.
2. And establishing a data transmission relation among the service processing module, the lamp control data transmission program instance and the lamp control protocol adaptation program instance.
In a specific implementation, the lamp control protocol adaptation program instance and the lamp control data transmission program instance are dynamically increased or decreased, so that transmission addresses of opposite parties are required to be known between the service processing module and the lamp control protocol adaptation program instance and between the lamp control protocol adaptation program instance and the lamp control data transmission program instance, so as to transmit uplink data packets of single lamp control and centralized control or command packets of the service processing module.
The specific implementation scheme is as follows: the service processing module, the lamp control protocol adaptation program instance and the lamp control data transmission program instance establish a data transmission relation through a message queue service, and specifically comprise the following steps:
the resource scheduler establishes a message queue according to rules before starting the lamp control protocol adaptation module and the lamp control data transmission module, and transmits the queue name as one of starting parameters to the execution script, the execution script transmits the starting parameters to the specific lamp control protocol adaptation module and the lamp control data transmission module when executing a starting command, and a program instance after the lamp control protocol adaptation module and the lamp control data transmission module are started carries out data transmission based on the message queue. The number of message queues is related to the number of device types, protocol types, transport types accessed.
Fig. 4 is an example showing an overall configuration of the system after information transfer using a message queue. In the figure, there is a lamp control protocol adaptation program A example cluster, including two lamp control protocol adaptation program A examples; the lamp control protocol adaptation program B example cluster comprises three lamp control protocol adaptation program B examples; the lamp control data transmission program A example cluster comprises two lamp control data transmission program A examples; the lamp control data transmission program B example cluster also comprises two lamp control data transmission program B examples. In the communication between the lamp control protocol adaptation program instance and the service processing module, all the lamp control protocol adaptation program instances share one uplink message queue to send the converted equipment data packet to the service processing module, and the downlink data packet sent by the service processing module is sent down to different message queues according to different lamp control protocol adaptation program instance clusters. In the communication between the lamp control data transmission program instance and the lamp control protocol adaptation program instance, the lamp control data transmission program instance of the same resource_id and the lamp control protocol adaptation program instance cluster share the same message queue. Specifically, when the device transmission mode adopts TCP, the downlink message queues correspond to the lamp control data transmission program instances one by one, and the lamp control protocol adaptation program instance needs to determine the issued message queues according to the lamp control data transmission program instances connected with the centralized control and single lamp control device.
Another specific implementation scheme is that an open lamp control protocol adaptation program instance, a lamp control data transmission program instance and an Http interface address of a service processing module report and command issuing of a single lamp control and centralized control message packet are carried out by calling the Http interface. The specific implementation scheme is as follows:
the interface addresses of the lamp control protocol adaptation program instance and the lamp control data transmission program instance are pre-determined, wherein the interface addresses comprise an IP and a port;
when a new lamp control protocol adaptation program instance is started, the interface addresses of the service processing module and the lamp control data transmission program instance are taken as starting parameters to be transmitted in, and the interface address of the newly-created lamp control protocol adaptation program instance is returned to the service processing module; when a new lamp control data transmission program example is started, the interface address of the lamp control protocol adaptation program example is taken as a starting parameter to be input.
3. And dynamically adding or reducing the starting quantity of the lamp control data transmission program examples and the lamp control protocol adaptation program examples according to the load condition obtained by the lamp control example monitoring service in the resource scheduler.
In the embodiment of the invention, based on the load condition acquired by the lamp control instance monitoring service, the lamp control instance management coordination service judges whether to start or close the program instance. The load condition mainly comprises the number of data packets processed in the past period of time, i.e. throughput, periodically reported by the lamp control protocol adaptation program instance and the lamp control data transmission program instance, and the average duration used for processing the data packets in the period of time, i.e. processing time delay. In particular, if a program instance does not report a load condition beyond a certain time, the service is considered to have crashed.
And after the lamp control instance monitoring service acquires the information, processing according to the instance cluster division condition, and continuously reporting to the lamp control instance management coordination service periodically according to a certain data format. The lamp control instance management coordination service judges whether to start or close the program instance based on the throughput upper and lower limit thresholds and the maximum time delay threshold of the preset lamp control data transmission program instance or the lamp control protocol adaptation program instance, and the monitored actual throughput and processing time delay of the program instance, and specifically comprises the following steps:
if the throughput of the program instance is greater than the preset throughput upper threshold and the processing time delay is greater than the preset maximum time delay, judging that the program instance needs to be shunted. Split flow is divided into two cases:
if the total throughput of the instance cluster where the current program instance is located is greater than the sum of the preset upper limit throughput of all the program instances in the cluster, starting a new instance;
if the total throughput of the instance cluster where the current program instance is located is smaller than the sum of the preset upper limit throughput of all the program instances in the cluster, load balancing allocation is carried out, and the data packet processing proportion of the current program instance is reduced.
If the throughput of the program instance is larger than the preset throughput upper threshold and the processing time delay is smaller than the preset maximum time delay, the throughput upper threshold preset by the program instance is improved;
If the throughput of the program instance is smaller than the preset throughput lower threshold, judging that the program instance can be combined;
specifically, if the program instance is determined to be in a crash state, the program instance is restarted.
And then, starting the lamp control data transmission module or the lamp control protocol adaptation module and closing the lamp control protocol adaptation program instance or the lamp control data transmission program instance according to the judging result. The following categories are used:
when the lamp control protocol adaptation module needs to be started, the lamp control instance management coordination service calls the lamp control instance starting service to start a new lamp control protocol adaptation module to be a lamp control protocol adaptation program instance, and establishes a data transmission relation with the service processing module and the lamp control data transmission program instance;
when the lamp control data transmission module needs to be started, the lamp control instance management coordination service calls the lamp control instance starting service to start a new lamp control data transmission module to be a lamp control data transmission program instance, a data transmission relation between the lamp control data transmission module and the lamp control protocol adaptation program instance is established, and meanwhile, the lamp control instance management coordination service notifies the service processing module to issue an uplink address change command to related equipment;
When the lamp control protocol adaptation program instance needs to be closed, the lamp control instance starting service firstly sends a closing command to the target program instance, the target program instance stops receiving external data after receiving the command, after all current data are processed, the lamp control instance starting service calls an execution script to transfer the server IP and the process ID where the instance is located, and the execution script ends the program instance process;
when the lamp control data transmission program instance needs to be closed, the lamp control instance management coordination service notifies the service processing module to issue an uplink address changing instruction, all equipment connected to the lamp control data transmission program instance is changed and connected to other lamp control data transmission program instances in the current instance cluster, then a closing step is executed, and the method is consistent with the lamp control protocol closing adaptation program instance;
when the program instance crashes and needs to be restarted, the light control instance starting service calls the execution script to transfer the server IP and the process ID where the program instance is located, the execution script ends the program instance process, and then the light control instance starting service starts the program instance according to the stored program instance record.
In general, each time the above-described actions are performed, a data change of the corresponding program instance record needs to be performed in the storage unit.
Fig. 5 shows an example of an implementation of the off-lamp control data transfer procedure.
As a special case, in the embodiment of the present invention, dynamically adding or reducing the number of enabled lamp control data transmission program instances and lamp control protocol adaptation program instances further includes:
and if the current time enters the light-off state time period, stopping all the light control protocol adaptation program instances and the light control data transmission program instances except that the field value for keeping the operation of the instances is judged to be operation (for example, when the keep_alive field value is 1) in the parameters of the program instances.
As a further preferred embodiment, in the examples of the present invention, the method further comprises:
4. and recording the running condition of the storage system, and guiding the system to run in the next lighting period.
Specifically, in the lighting period, the resource scheduler performs a survival judgment on each lamp control protocol adaptation program instance record and each lamp control data transmission program instance record, and whether the program instance needs to be initialized and started when the lamp is turned on next time or not:
if one program instance is the only one program instance of the type of protocol, judging that the program instance needs to survive all the time;
the resource scheduler sets a delay time, after the delay time of the on-time, the resource scheduler sets the surviving program instance to be initialized and started when the program instance is turned on next time, and other program instances are set to be not started.
In one specific example, the delay time is set to 60 minutes, i.e., after judging that the lamp is turned on for 60 minutes, the system is adjusted to the optimal state, then the new run value of the currently running program instance is set to 1, and the other instances are set to 0.
The above description of the embodiments is only for aiding in the understanding of the method of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.