WO2022062186A1 - 通过定时任务实现服务器动态增减的方法、系统及装置 - Google Patents

通过定时任务实现服务器动态增减的方法、系统及装置 Download PDF

Info

Publication number
WO2022062186A1
WO2022062186A1 PCT/CN2020/134284 CN2020134284W WO2022062186A1 WO 2022062186 A1 WO2022062186 A1 WO 2022062186A1 CN 2020134284 W CN2020134284 W CN 2020134284W WO 2022062186 A1 WO2022062186 A1 WO 2022062186A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
notification
load
maintenance
loads
Prior art date
Application number
PCT/CN2020/134284
Other languages
English (en)
French (fr)
Inventor
陈宇川
姜志强
Original Assignee
同程网络科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 同程网络科技股份有限公司 filed Critical 同程网络科技股份有限公司
Priority to DE212020000560.5U priority Critical patent/DE212020000560U1/de
Publication of WO2022062186A1 publication Critical patent/WO2022062186A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3058Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations
    • G06F11/3062Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations where the monitored property is the power consumption
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2465Query processing support for facilitating data mining operations in structured databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/18Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets

Definitions

  • the present application relates to the field of dynamic server allocation, and in particular, to a method, system and device for dynamically increasing or decreasing servers through timed tasks.
  • the Chinese patent text with publication number CN106375420A discloses a server cluster intelligent monitoring system based on load balancing, which includes a detection module, a monitoring module, an information distribution module, an output module and an alarm module; the detection module is used for periodic Send service requests to the load balancing node; the monitoring module is used to monitor the request processing status of the load balancing node in real time; the information distribution module is used to process the distribution control information; the input module is used to set the time interval for periodically sending service requests, and each The maximum number of concurrent processing of load balancing nodes; the alarm module is used to alarm abnormal information.
  • the purpose of this system is to formulate a reasonable strategy for task allocation after the server cluster receives the service request, and accurately select the appropriate application server to respond, so that the server cluster can better serve users.
  • the inventor believes that they have the following defects: at present, the method of increasing servers and then allocating service requests to appropriate servers is basically used to meet business needs, but the rationality of the number of servers is ignored; if the number of servers is After the configuration is more and the business volume drops in the later period, the cost of the enterprise will also increase virtually, and the utilization rate of the server will be greatly reduced.
  • the present application provides a method, system and device for dynamically increasing or decreasing servers through timed tasks.
  • the present application provides a method for dynamically increasing or decreasing servers through timed tasks, using the following technical solutions:
  • a method for dynamically increasing or decreasing servers through timed tasks comprising:
  • Load data collection Obtain the relevant indicator data of the load, then compare the obtained relevant indicator data with the pre-configured threshold, and record the number of loads that exceed and fall below the threshold respectively;
  • Automatic report push Calculate the number of loads T that needs to be increased or decreased in an average way according to the number of loads that are over and below the threshold, and then write the calculated number of loads T that need to be increased or decreased into the report notification and specify Time to push the report notification to the corresponding application person in charge;
  • Notification operation and maintenance operation After the corresponding application person in charge confirms the content of the report notification, an operation notification is pushed to the operation and maintenance for operation, and the operation notification includes the application name, the number of increase or decrease, the operation and maintenance processor and the confirmer.
  • the report notification is automatically sent to the application person in charge in a timely manner, and the operation notification is sent to the application person in time according to the confirmation operation of the application person in charge. Operation and maintenance to increase or decrease the application load.
  • the related art which mainly relies on manual observation of the load operation or ignores the rationality of the number of servers, the cost is greatly reduced, and the management efficiency is also improved.
  • the load data collection specifically includes:
  • the application configuration includes an application identifier
  • the relevant indicator data includes CPU usage, memory usage and GC;
  • the data can be persistently persisted to mysql, the authenticity of the data is ensured, and real-time monitoring is realized.
  • the automatic report push specifically includes:
  • the report notification received by the application person in charge includes EXCEL, and the application person in charge can observe the detailed load increase and decrease data through EXCEL, so as to provide data reference and basis for subsequent confirmation.
  • the number T of the load to be increased or decreased is calculated in the form of an average value, which specifically includes:
  • the number of loads to be increased or the number of loads to be reduced corresponding to each relevant indicator data obtain the number of loads to be increased or the number of loads to be reduced corresponding to each relevant indicator data.
  • the number of loads to be increased is a positive number, and the number of loads to be reduced is a negative number;
  • the method of considering the positive number and the negative number is used to calculate the load increase or decrease in various situations.
  • the average value of the quantity is the quantity T of the load that needs to be increased or decreased, so that the final calculated increase or decrease data is more in line with the actual operation scenario.
  • the report notification is sent to the corresponding person in charge of the application by email, and the EXCEL file is used as an attachment to the email; the local EXCEL file is deleted after the email is sent.
  • email has the characteristics of immediacy and long-term retention.
  • the sending and viewing of notifications greatly saves operating costs and operating costs.
  • an operation link is added to the email content of the sent email
  • the notification operation and maintenance operations include:
  • the corresponding push information is obtained in redis according to the unique value messagekey in the link, and an operation notification is formed.
  • the operation notification is pushed to the designated operation and maintenance or to the group where the designated operation and maintenance is located through the group robot for the operation and maintenance to perform server addition or reduction operations.
  • the person in charge of the application clicks the operation link
  • the person in charge of the application performs a confirmation operation on behalf of the person in charge of the application, which improves the processing efficiency of the entire process.
  • the method further includes: Set the preset opsKey corresponding to the corresponding application to false;
  • the method also includes automatically checking an application, the automatic checking application comprising:
  • Obtain application configuration which includes the number of servers corresponding to the application and the state of opsKey; wherein, when the number of servers changes, the opsKey corresponding to the application will be set to true;
  • the operation notification corresponding to the inactive application is pushed again to the specified operation and maintenance or to the group where the specified operation and maintenance is located.
  • the present application provides a system for realizing dynamic increase and decrease of servers through timed tasks, and adopts the following technical solutions:
  • a system for dynamically increasing or decreasing servers through timed tasks including:
  • the load data collection module is used to obtain the relevant index data of the load, and then compare the obtained relevant index data with the pre-configured threshold, and record the number of loads exceeding and below the threshold respectively;
  • Automatic report push module including,
  • a data acquisition sub-module for acquiring the number of loads recorded by the load data collection module that exceed and fall below the threshold
  • the report generation submodule is used to write the quantity T of the load that needs to be increased or decreased calculated by the data calculation submodule into EXCEL, and at the specified time, the generated EXCEL is used as an attachment of the report notification and the report notification is added to the operation link Then send it to the corresponding application person in charge;
  • the notification operation and maintenance operation module is used to push an operation notification to the operation and maintenance for operation after the corresponding application person in charge clicks the operation link in the report notification, and at the same time set the preset opsKey corresponding to the corresponding application to false, so
  • the above operation notification includes the application name, the number of units added or removed, the operation and maintenance handler and the confirmer; and,
  • the application configuration acquisition sub-module is used to acquire application configuration information including the number of servers corresponding to the application, and when the number of servers changes, set the opsKey corresponding to the application to true;
  • the operation status viewing sub-module is used to view the operation status according to the opsKey corresponding to the application. If the opsKey is still false, the application is marked as an inoperative application, and if the opsKey is true, the application is marked as an operated application; and,
  • the secondary push sub-module is used to push the operation notification corresponding to the inactive application to the specified operation and maintenance or to the group where the specified operation and maintenance is located at the specified time.
  • the real-time monitoring load index can be compared with the configured threshold, so as to obtain the amount of load that needs to be increased or decreased and sent to the corresponding application person in charge and operation and maintenance, so that the operation and maintenance can carry out the operation and maintenance on the application load.
  • Increase or decrease operations so as to maintain the number of loads within a reasonable range, effectively reducing costs.
  • the system has a high degree of automation. Except for the actual operation and maintenance of increasing and decreasing the load, the entire process basically does not require human intervention, which greatly improves the management efficiency.
  • the present application provides a device for dynamically increasing or decreasing servers through timed tasks, using the following technical solutions:
  • An apparatus for dynamically increasing or decreasing servers through timed tasks includes a memory and a processor, where a computer program capable of being loaded by the processor and executing the method described in the first aspect is stored in the memory.
  • the present application provides a computer-readable storage medium, which adopts the following technical solutions:
  • a computer-readable storage medium storing a computer program capable of being loaded by a processor and executing the method as described in the first aspect.
  • FIG. 1 is a flowchart of a method for dynamically increasing or decreasing a server through a scheduled task according to an embodiment of the present application.
  • FIG. 2 is a flowchart of step S100 in the embodiment of the present application.
  • FIG. 3 is a flowchart of step S200 in the embodiment of the present application.
  • FIG. 4 is a flowchart of step S230 in this embodiment of the present application.
  • FIG. 5 is a flowchart of step S300 in this embodiment of the present application.
  • FIG. 6 is a flowchart of step S400 in the embodiment of the present application.
  • FIG. 7 is a structural block diagram of a system for realizing dynamic increase and decrease of servers through timed tasks according to an embodiment of the present application.
  • Reference numeral description 1. Load data collection module; 2. Automatic report push module; 21. Data acquisition sub-module; 22. Data calculation sub-module; 23. Report generation sub-module; 3. Notification operation and maintenance operation module; 4. 41. Application configuration acquisition sub-module; 42. Operation status viewing sub-module; 43. Secondary push sub-module.
  • the embodiment of the present application discloses a method for dynamically increasing or decreasing servers through timed tasks. Referring to Figure 1, the method includes the following steps:
  • load data collection obtain relevant index data of the load, then compare the obtained relevant index data with a pre-configured threshold, and record the number of loads that exceed and fall below the threshold.
  • the load here refers to the server.
  • step S100 includes the following sub-steps:
  • the relevant indicator data includes CPU usage, memory usage, and GC (garbage collection);
  • each relevant index data of each load corresponds to a threshold. After comparing the relevant index data with the corresponding threshold, record each relevant threshold. The number of loads that exceed and fall below the corresponding threshold corresponding to the indicator data, so as to obtain low-load data and high-load data;
  • the relevant indicator data corresponds to The number of loads exceeding the threshold is recorded as N1, and the number of loads below the threshold corresponding to the relevant indicator data is recorded as N2.
  • automatic report push calculate the number T of loads that need to be increased or decreased in an average way according to the recorded number of loads that exceed and are below the threshold, and then write the calculated number of loads T that need to be increased or decreased into the report notification, And push the report notification to the corresponding application person at a specified time, such as Monday morning.
  • step S200 includes the following sub-steps:
  • EXCEL write the calculated number of loads that need to be increased or decreased into EXCEL; it should be noted here that, in addition to the increase or decrease of the number of units, EXCEL also includes the corresponding application name, operation and maintenance handler and confirmer, as well as the original monitoring data;
  • sub-step S203 specifically includes:
  • step S300 includes the following sub-steps:
  • step S400 includes the following sub-steps:
  • an embodiment of the present application further discloses a system for realizing dynamic increase and decrease of servers through timed tasks.
  • the system includes:
  • the load data collection module 1 is used to obtain the relevant index data of the load, and then compare the obtained relevant index data with the pre-configured threshold, and record the number of loads that exceed and fall below the threshold;
  • Automatic report push module 2 including,
  • the data acquisition sub-module 21 is used to acquire the load quantity that exceeds and falls below the threshold value recorded by the load data collection module 1;
  • the data calculation sub-module 22 is used to calculate the quantity T of the load that needs to be increased or decreased by means of an average value according to the number of loads obtained by the data acquisition sub-module 21 exceeding and below the threshold; and,
  • the report generation submodule 23 is used to write the quantity T of the load that needs to be increased or decreased calculated by the data calculation submodule 22 into EXCEL, and at the specified time, the EXCEL that will be generated is used as the attachment of the report notification and the report notification is added to the operation link Then send it to the corresponding application person in charge;
  • the notification operation and maintenance operation module 3 is used to push an operation notification to the operation and maintenance for operation after the corresponding application person in charge clicks the operation link in the report notification, and at the same time set the preset opsKey corresponding to the corresponding application to false,
  • the operation notification includes the name of the application, the number of units added or removed, the operation and maintenance handler and the confirmation person; and,
  • the application configuration acquisition sub-module 41 is used to acquire application configuration information including the number of servers corresponding to the application, and when the number of servers changes, the opsKey corresponding to the application is set to true;
  • the operation state checking submodule 42 is used to check the operation state according to the opsKey corresponding to the application, if the opsKey is still false, then the application is marked as an unoperated application, and if the opsKey is true, the application is marked as an operated application; and,
  • the secondary push sub-module 43 is used to push the operation notification corresponding to the unoperated application again to the designated operation and maintenance or to the group where the designated operation and maintenance is located at the designated time, or to send the administrator to the administrator to manually notify the corresponding application person in charge or Corresponding operation and maintenance alarm signal.
  • the embodiment of the present application further discloses a device for dynamically increasing or decreasing servers through timed tasks, which includes a memory and a processor, wherein the memory stores data that can be loaded by the processor and execute the above-mentioned dynamic increase or decrease of servers through timed tasks.
  • a device for dynamically increasing or decreasing servers through timed tasks which includes a memory and a processor, wherein the memory stores data that can be loaded by the processor and execute the above-mentioned dynamic increase or decrease of servers through timed tasks.
  • a computer program of the method is a computer program of the method.
  • the embodiment of the present application also discloses a computer-readable storage medium.
  • a computer program that can be loaded by a processor and executes the above-mentioned method for dynamically increasing or decreasing a server through a timed task is stored in a computer-readable storage medium.
  • Memory Read-Only Memory, ROM
  • random access memory Random Access Memory, RAM
  • magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Computing Systems (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Pure & Applied Mathematics (AREA)
  • Algebra (AREA)
  • Operations Research (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Quality & Reliability (AREA)
  • Fuzzy Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请涉及一种通过定时任务实现服务器动态增减的方法、系统及装置,其中方法包括:负载数据收集:获取负载的相关指标数据,再将获取的相关指标数据与预先配置的阈值进行比较,并分别记录超过和低于阈值的负载数量;自动报表推送:根据记录的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T,然后将计算出的需要增减的负载的数量T写入报表通知并将该报表通知推送给相应的应用负责人;通知运维操作:在相应的应用负责人确认报表通知的内容后,将一操作通知推送给运维进行操作,操作通知包括应用名称、增减台数、运维处理人和确认人。本申请能够有效改善满足业务需求过程中服务器数量配置不合理的问题,大大节省了运营成本。

Description

通过定时任务实现服务器动态增减的方法、系统及装置 技术领域
本申请涉及服务器动态调配的领域,尤其是涉及一种通过定时任务实现服务器动态增减的方法、系统及装置。
背景技术
随着互联网业务的不断壮大,不同业务的应用对服务器的要求也越来越多。为应对业务的快速增长,最常用的做法即为使用多台服务器来共同分担业务量,并且所有的服务请求数据都会经过负载均衡设备,由负载均衡设备将所有的服务请求转发到适当的服务器进行响应。
例如,公开号为CN106375420A的中国专利文本就公开了一种基于负载均衡的服务器集群智能监控系统,其包括检测模块、监控模块、信息分发模块、输出模块和报警模块;检测模块用于周期性的向负载均衡节点发送服务请求;监控模块用于实时监控负载均衡节点请求处理状态;信息分发模块用于处理分发控制信息;输入模块用于设定周期性发送服务请求的时间间隔,以及同一时间各负载均衡节点的最大并发处理数量;报警模块用于对异常信息进行报警。该系统旨在服务器集群收到服务请求后,制定合理的策略进行任务分配,准确的选择适当的应用服务器响应,从而使服务器集群能更好的为用户服务。
针对上述中的相关技术,发明人认为其存在以下缺陷:目前基本都是采用增加服务器然后再将服务请求分配到适当服务器的方式来满足业务需求,但是忽视了服务器数量的合理性;如果服务器数量配置较多而后期业务量下降后,无形之中也会增加企业的成本,大大降低服务器的使用率。
发明内容
为了改善满足业务需求过程中服务器数量配置不合理的问题,本申请提供一种通过定时任务实现服务器动态增减的方法、系统及装置。
第一方面,本申请提供一种通过定时任务实现服务器动态增减的方法,采用如下的技术方案:
一种通过定时任务实现服务器动态增减的方法,包括:
负载数据收集:获取负载的相关指标数据,再将获取的相关指标数据与预先配置的阈值进行比较,并分别记录超过和低于阈值的负载数量;
自动报表推送:根据记录的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T,然后将计算出的需要增减的负载的数量T写入报表通知并在指定时间将该报表通知推送给相应的应用负责人;
通知运维操作:在相应的应用负责人确认报表通知的内容后,将一操作通知推送给运维进行操作,所述操作通知包括应用名称、增减台数、运维处理人和确认人。
通过采用上述技术方案,通过实时监控负载的各项指标,根据负载指标与配置的阈值比较,及时的将报表通知自动发给应用负责人,并根据应用负责人的确认操作及时将操作通知发给运维,以对应用负载进行增加或减少的操作。相比于相关技术中主要靠人工观察负载运行情况或者忽视了服务器数量的合理性的情况,大大降低了成本,同时也提高了管理效率。
优选的,所述负载数据收集具体包括:
获取应用配置,所述应用配置包括应用标识;
根据应用标识获取groupId;
根据groupId获取hostname;
根据hostname获取负载的相关指标数据,所述相关指标数据包括CPU使用率、内存使用率和GC;
将每一负载的各个相关指标数据均分别与配置的相关阈值进行比较,记录每一相关指标数据所对应的超过和低于阈值的负载数量,从而得到低负载数据和高负载数据;
低负载数据和高负载数据异步落地mysql。
通过采用上述技术方案,能够使数据持续持久化到mysql,保证了数据的真实性,实现了实时监控。
优选的,所述自动报表推送具体包括:
获取应用配置;
根据应用标识获取已落地的低负载数据和高负载数据;
根据获取的低负载数据和高负载数据以平均值的方式计算需要增减的负载的数量T;
将计算出的需要增减的负载的数量写入EXCEL;
将生成的EXCEL作为报表通知的附件并在指定时间将该报表通知发送给相应的应用负责人。
通过采用上述技术方案,应用负责人接收到的报表通知中包含EXCEL,应用负责人通过EXCEL即可观察到详细的负载增减数据,以为其后面的确认提供数据参考和依据。
优选的,根据获取的低负载数据和高负载数据以平均值的方式计算需要增减的负载的数量T,具体包括:
根据获取的低负载数据和高负载数据得到每个相关指标数据所对应的需要增加的负载数量或需要减小的负载数量,需要增加的负载数量为正数,需要减小的负载数量为负数;
识别获取到的正数的数量a和负数的数量b;
将所有的负载数量相加得到终值c并判断终值c是正数还是负数;
若判断终值c为正数,则通过计算公式T=c/a来计算需要增减的负载的数量T;
若判断终值c为负数,则通过计算公式T=c/b来计算需要增减的负载的数量T。
通过采用上述技术方案,独立考虑每个相关指标数据所对应的需要增加的负载数量或需要减小的负载数量之后,采用考虑正数数量和负数数量的方式来计算各种情况下的负载增减数量平均值即需要增减的负载的数量T,使得最终算出的增减数据更符合实际运营场景。
优选的,在所述自动报表推送中,所述报表通知采用邮件的方式发送给对应的应用负责人,EXCEL文件作为邮件的附件;在邮件发送完成后删除本地EXCEL文件。
通过采用上述技术方案,邮件作为一种常用的信息沟通方式,具备即时性和长久保留性的特点,其一,便于使用者查看信息和使用,其二,不必再开发一种沟通平台来满足报表通知的发送和查看,大大节省了运营成本和操作使用成本。
优选的,在所述自动报表推送中,所发送邮件的邮件内容中加入有操作链接;
所述通知运维操作包括:
在相应的应用负责人点击操作链接后,根据链接中唯一值messagekey在redis中获取对应的推送信息并形成操作通知,所述操作通知包括应用名称、增减台数、运维处理人和确认人;
通过群机器人将操作通知推送给指定运维或推送到指定运维所在的群以供运维进行服务器的增减操作。
通过采用上述技术方案,在应用负责人点击操作链接后即代表应用负责人进行了确认操作,提高了整个流程处理的效率。
优选的,在所述通知运维操作中,在所述通过群机器人将操作通知推送给指定运维或推送到指定运维所在的群以供运维进行服务器的增减操作之后,还包括:将预设的与相应应用对应的opsKey置为false;
所述方法还包括自动检查应用,所述自动检查应用包括:
获取应用配置,所述应用配置包括应用所对应的服务器数量和opsKey的状态;其中,当服务器数量发生变化时,应用所对应的opsKey会被置为true;
根据应用所对应的opsKey查看操作状态,若opsKey仍然为false,则将应用标记为未操作应用;若opsKey为true,则将应用标记为已操作应用;
在指定时间将未操作应用对应的操作通知再次推送给指定运维或推送到指定运维所在的群。
通过采用上述技术方案,能够在发完操作通知后自动检查运维有没有对负载的数量进行重新配置,若在指定时间长度过后没有被处理,可以进行二次通知,保证负载增减的时效性。
第二方面,本申请提供一种通过定时任务实现服务器动态增减的系统,采用如下的技术方案:
一种通过定时任务实现服务器动态增减的系统,包括:
负载数据收集模块,用于获取负载的相关指标数据,再将获取的相关指标数据与预先配置的阈值进行比较,并分别记录超过和低于阈值的负载数量;
自动报表推送模块,包括,
数据获取子模块,用于获取所述负载数据收集模块记录的超过和低于阈值的负载数量;
数据计算子模块,用于根据所述数据获取子模块获取的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T;以及,
报表生成子模块,用于将所述数据计算子模块计算出的需要增减的负载的数量T写入EXCEL,且在指定时间将生成的EXCEL作为报表通知的附件并将该报表通知加入操作链接后发送给相应的应用负责人;
通知运维操作模块,用于在相应的应用负责人点击报表通知中的操作链接后,将一操作通知推送给运维进行操作,同时将预设的与相应应用对应的opsKey置为false,所述操作通知包括应用名称、增减台数、运维处理人和确认人;以及,
自动检查应用模块,包括,
应用配置获取子模块,用于获取包括应用所对应的服务器数量的应用配置信息,且在当服务器数量发生变化时,将应用所对应的opsKey置为true;
操作状态查看子模块,用于根据应用所对应的opsKey查看操作状态,若opsKey仍然为false,则将应用标记为未操作应用,若opsKey为true,则将应用标记为已操作应用;以及,
二次推送子模块,用于在指定时间将未操作应用对应的操作通知再次推送给指定运维或推送到指定运维所在的群。
通过采用上述技术方案,能够将实时监控到的负载指标与配置的阈值进行比较,从而得出需要增减的负载数量并发送给对应的应用负责人和运维,以使运维对应用负载进行增加或减少的操作,进而使得负载的数量维持在一个较为合理的范围内,有效降低了成本。另外,系统自动化程度高,除了运维的实际增减负载的操作外,整个流程基本不需要人为干预,也大大提升了管理效率。
第三方面,本申请提供一种通过定时任务实现服务器动态增减的装置,采用如下的技术方案:
一种通过定时任务实现服务器动态增减的装置,包括存储器和处理器,所述存储器上存储有能够被处理器加载并执行如第一方面中所述方法的计算机程序。
通过采用上述技术方案,便于实现对负债数据的自动监控,并给出相应的建议应用增减的负载台数的功能,有效降低了企业的成本,也大大增加了负载的使用率。
第四方面,本申请提供一种计算机可读存储介质,采用如下的技术方案:
一种计算机可读存储介质,存储有能够被处理器加载并执行如第一方 面中所述方法的计算机程序。
通过采用上述技术方案,存储能够加载并执行上述方法的程序,有利于减小运营成本,并且提高了管理效率和负载使用率。
附图说明
图1是本申请实施例的通过定时任务实现服务器动态增减的方法的流程图。
图2是本申请实施例的步骤S100的流程图。
图3是本申请实施例的步骤S200的流程图。
图4是本申请实施例的步骤S230的流程图。
图5是本申请实施例的步骤S300的流程图。
图6是本申请实施例的步骤S400的流程图。
图7是本申请实施例的通过定时任务实现服务器动态增减的系统的结构框图。
附图标记说明:1、负载数据收集模块;2、自动报表推送模块;21、数据获取子模块;22、数据计算子模块;23、报表生成子模块;3、通知运维操作模块;4、自动检查应用模块;41、应用配置获取子模块;42、操作状态查看子模块;43、二次推送子模块。
具体实施方式
以下结合附图1-7对本申请作进一步详细说明。
本申请实施例公开一种通过定时任务实现服务器动态增减的方法。参照图1,方法包括以下步骤:
S100、负载数据收集:获取负载的相关指标数据,再将获取的相关指 标数据与预先配置的阈值进行比较,并记录超过和低于阈值的负载数量。这里的负载即指服务器。
具体的,参照图2,步骤S100包括以下子步骤:
S101、获取应用配置,应用配置包括应用标识;
S102、根据应用标识获取groupId,groupId即指应用组名称;
S103、根据groupId获取hostname,hostname即指服务器名称;
S104、根据hostname获取负载的相关指标数据,具体来说,在本实施例中,相关指标数据包括CPU使用率、内存使用率和GC(垃圾回收);
S105、将每一负载的各个相关指标数据均分别与配置的相关阈值进行比较,具体来说,每一相关指标数据均对应一个阈值,在将相关指标数据与对应阈值比较过后,记录每一相关指标数据所对应的超过和低于对应阈值的负载数量,从而得到低负载数据和高负载数据;
S106、低负载数据和高负载数据异步落地mysql,换句话说,就是将低负载数据和高负载数据持久化到mysql;
需要说明的是,在一个检测周期内例如一天内,若某一相关指标数据的超过相应阈值的服务器总数量为N1,小于等于相应阈值的服务器总数量为N2,则将该相关指标数据所对应的超过阈值的负载数量记为N1,并且将该相关指标数据所对应的低于阈值的负载数量记为N2。
S200、自动报表推送:根据记录的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T,然后将计算出的需要增减的负载的数量T写入报表通知,并在指定时间例如周一上午将该报表通知推送给相应的应用负责人。
具体的,参照图3,步骤S200包括以下子步骤:
S201、获取应用配置;
S202、根据子步骤S201中获取到的应用配置中的应用标识获取已落地的低负载数据和高负载数据;
S203、根据获取的低负载数据和高负载数据以平均值的方式计算需要增减的负载的数量T;
S204、将计算出的需要增减的负载的数量写入EXCEL;这里需要说明的是,EXCEL中除了增减台数外,还包括相应的应用名称、运维处理人和确认人,以及原始的监控数据;
S205、将子步骤S204中生成的EXCEL作为报表通知的附件并在指定时间将该报表通知发送给相应的应用负责人;具体的,报表通知采用邮件的方式发送给对应的应用负责人,EXCEL文件作为邮件的附件,而且在发送的邮件的邮件内容中加入有操作链接;
S206、在邮件发送完成后删除本地EXCEL文件。
其中,参照图4,子步骤S203具体包括:
S2301、根据获取的低负载数据和高负载数据得到每个相关指标数据所对应的需要增加的负载数量或需要减小的负载数量;需要增加负载时的负载数量为正数,需要减小负载时的负载数量为负数;
S2302、识别获取到的正数的数量a和负数的数量b;
S2303、将所有的负载数量相加得到终值c并判断终值c是正数还是负数;若判断终值c为正数,则进入S2304;若判断终值c为负数,则进入S2305;
S2304、通过计算公式T=c/a来计算需要增减的负载的数量T;
S2305、则通过计算公式T=c/b来计算需要增减的负载的数量T。
S300、通知运维操作:在相应的应用负责人确认报表通知的内容后,将一操作通知推送给运维进行操作,操作通知的内容包括应用名称、增减台数、运维处理人和确认人。
具体的,参照图5,步骤S300包括以下子步骤:
S301、在相应的应用负责人点击操作链接后,根据链接中的唯一值messagekey在redis中获取对应的推送信息并形成操作通知,所述操作通知包括应用名称、增减台数、运维处理人和确认人;redis中存储的推送信息即包括应用名称、增减台数、运维处理人和确认人,其为在子步骤S204中将计算出的需要增减的负载的数量写入EXCEL时同步存入redis的数据;
S302、通过群机器人将操作通知推送给指定运维或推送到指定运维所在的群以供运维进行服务器的增减操作;
S303、将预设的与相应应用对应的opsKey置为false;
S400、自动检查应用:自动检查与应用相对应的运维是否有去进行负载的增减操作,并在长时间未操作时,将未操作应用推送给相应运维。
具体的,参照图6,步骤S400包括以下子步骤:
S401、获取应用配置,应用配置包括应用所对应的服务器数量以及opsKey的状态;应注意的是,当服务器数量发生变化时,应用所对应的opsKey会被置为true;
S402、根据应用所对应的opsKey查看操作状态,若opsKey仍然为false,则将应用标记为未操作应用;若opsKey为true,则将应用标记为已操作应 用;
S403、在指定时间将未操作应用对应的操作通知再次推送给指定运维或推送到指定运维所在的群,或者采用人工的方式通知相应的应用负责人或相应的运维。
基于上述方法,本申请实施例还公开一种通过定时任务实现服务器动态增减的系统。参照图7,系统包括:
负载数据收集模块1,用于获取负载的相关指标数据,再将获取的相关指标数据与预先配置的阈值进行比较,并记录超过和低于阈值的负载数量;
自动报表推送模块2,包括,
数据获取子模块21,用于获取负载数据收集模块1记录的超过和低于阈值的负载数量;
数据计算子模块22,用于根据数据获取子模块21获取的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T;以及,
报表生成子模块23,用于将数据计算子模块22计算出的需要增减的负载的数量T写入EXCEL,且在指定时间将生成的EXCEL作为报表通知的附件并将该报表通知加入操作链接后发送给相应的应用负责人;
通知运维操作模块3,用于在相应的应用负责人点击报表通知中的操作链接后,将一操作通知推送给运维进行操作,同时将预设的与相应应用对应的opsKey置为false,操作通知包括应用名称、增减台数、运维处理人和确认人;以及,
自动检查应用模块4,包括,
应用配置获取子模块41,用于获取包括应用所对应的服务器数量的应用配置信息,且在当服务器数量发生变化时,将应用所对应的opsKey置为true;
操作状态查看子模块42,用于根据应用所对应的opsKey查看操作状态,若opsKey仍然为false,则将应用标记为未操作应用,若opsKey为true,则将应用标记为已操作应用;以及,
二次推送子模块43,用于在指定时间将未操作应用对应的操作通知再次推送给指定运维或推送到指定运维所在的群,或者向管理员发送需要其人工通知相应应用负责人或相应运维的报警信号。
本申请实施例还公开一种通过定时任务实现服务器动态增减的装置,其包括存储器和处理器,其中,存储器上存储有能够被处理器加载并执行如上述的通过定时任务实现服务器动态增减的方法的计算机程序。
本申请实施例还公开一种计算机可读存储介质。计算机可读存储介质内存储有能够被处理器加载并执行如上述的通过定时任务实现服务器动态增减的方法的计算机程序,所述计算机可读存储介质例如包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上均为本申请的较佳实施例,并非依此限制本申请的保护范围,故:凡依本申请的结构、形状、原理所做的等效变化,均应涵盖于本申请的保护范围之内。

Claims (8)

  1. 一种通过定时任务实现服务器动态增减的方法,其特征在于,包括:
    负载数据收集:获取负载的相关指标数据,再将获取的相关指标数据与预先配置的阈值进行比较,并分别记录超过和低于阈值的负载数量;
    自动报表推送:根据记录的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T,然后将计算出的需要增减的负载的数量T写入报表通知并在指定时间将该报表通知推送给相应的应用负责人;
    通知运维操作:在相应的应用负责人确认报表通知的内容后,将一操作通知推送给运维进行操作,所述操作通知包括应用名称、增减台数、运维处理人和确认人。
  2. 根据权利要求1所述的方法,其特征在于,所述负载数据收集具体包括:
    获取应用配置,所述应用配置包括应用标识;
    根据应用标识获取groupId;
    根据groupId获取hostname;
    根据hostname获取负载的相关指标数据,所述相关指标数据包括CPU使用率、内存使用率和GC;
    将每一负载的各个相关指标数据均分别与配置的相关阈值进行比较,记录每一相关指标数据所对应的超过和低于阈值的负载数量,从而得到低负载数据和高负载数据;
    低负载数据和高负载数据异步落地mysql。
  3. 根据权利要求2所述的方法,其特征在于,所述自动报表推送具体包括:
    获取应用配置;
    根据应用标识获取已落地的低负载数据和高负载数据;
    根据获取的低负载数据和高负载数据以平均值的方式计算需要增减的负载的数量T;
    将计算出的需要增减的负载的数量写入EXCEL;
    将生成的EXCEL作为报表通知的附件并在指定时间将该报表通知发送给相应的应用负责人。
  4. 根据权利要求3所述的方法,其特征在于,根据获取的低负载数据和高负载数据以平均值的方式计算需要增减的负载的数量T,具体包括:
    根据获取的低负载数据和高负载数据得到每个相关指标数据所对应的需要增加的负载数量或需要减小的负载数量,需要增加的负载数量为正数,需要减小的负载数量为负数;
    识别获取到的正数的数量a和负数的数量b;
    将所有的负载数量相加得到终值c并判断终值c是正数还是负数;
    若判断终值c为正数,则通过计算公式T=c/a来计算需要增减的负载的数量T;
    若判断终值c为负数,则通过计算公式T=c/b来计算需要增减的负载的数量T。
  5. 根据权利要求3所述的方法,其特征在于,在所述自动报表推送中,所述报表通知采用邮件的方式发送给对应的应用负责人,EXCEL文件作为邮件的附件;在邮件发送完成后删除本地EXCEL文件。
  6. 根据权利要求5所述的方法,其特征在于,在所述自动报表推送中, 所发送邮件的邮件内容中加入有操作链接;
    所述通知运维操作包括:
    在相应的应用负责人点击操作链接后,根据链接中唯一值messagekey在redis中获取对应的推送信息并形成操作通知,所述操作通知包括应用名称、增减台数、运维处理人和确认人;
    通过群机器人将操作通知推送给指定运维或推送到指定运维所在的群以供运维进行服务器的增减操作。
  7. 根据权利要求6所述的方法,其特征在于,在所述通知运维操作中,在所述通过群机器人将操作通知推送给指定运维或推送到指定运维所在的群以供运维进行服务器的增减操作之后,还包括:将预设的与相应应用对应的opsKey置为false;
    所述方法还包括自动检查应用,所述自动检查应用包括:
    获取应用配置,所述应用配置包括应用所对应的服务器数量和opsKey的状态;其中,当服务器数量发生变化时,应用所对应的opsKey会被置为true;
    根据应用所对应的opsKey查看操作状态,若opsKey仍然为false,则将应用标记为未操作应用;若opsKey为true,则将应用标记为已操作应用;
    在指定时间将未操作应用对应的操作通知再次推送给指定运维或推送到指定运维所在的群。
  8. 一种通过定时任务实现服务器动态增减的系统,其特征在于,包括:
    负载数据收集模块(1),用于获取负载的相关指标数据,再将获取的相关指标数据与预先配置的阈值进行比较,并分别记录超过和低于阈值的负 载数量;
    自动报表推送模块(2),包括,
    数据获取子模块(21),用于获取所述负载数据收集模块(1)记录的超过和低于阈值的负载数量;
    数据计算子模块(22),用于根据所述数据获取子模块(21)获取的超过和低于阈值的负载数量以平均值的方式计算需要增减的负载的数量T;以及,
    报表生成子模块(23),用于将所述数据计算子模块(22)计算出的需要增减的负载的数量T写入EXCEL,且在指定时间将生成的EXCEL作为报表通知的附件并将该报表通知加入操作链接后发送给相应的应用负责人;
    通知运维操作模块(3),用于在相应的应用负责人点击报表通知中的操作链接后,将一操作通知推送给运维进行操作,同时将预设的与相应应用对应的opsKey置为false,所述操作通知包括应用名称、增减台数、运维处理人和确认人;以及,
    自动检查应用模块(4),包括,
    应用配置获取子模块(41),用于获取包括应用所对应的服务器数量的应用配置信息,且在当服务器数量发生变化时,将应用所对应的opsKey置为true;
    操作状态查看子模块(42),用于根据应用所对应的opsKey查看操作状态,若opsKey仍然为false,则将应用标记为未操作应用,若opsKey为true,则将应用标记为已操作应用;以及,
    二次推送子模块(43),用于在指定时间将未操作应用对应的操作通知再次推送给指定运维或推送到指定运维所在的群。
PCT/CN2020/134284 2020-09-25 2020-12-07 通过定时任务实现服务器动态增减的方法、系统及装置 WO2022062186A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
DE212020000560.5U DE212020000560U1 (de) 2020-09-25 2020-12-07 System, Vorrichtung und Medium zum dynamischen Hinzufügen und Entfernen von Servern mittels zeitgesteuerter Aufgaben

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011026440.6 2020-09-25
CN202011026440.6A CN112199251B (zh) 2020-09-25 2020-09-25 通过定时任务实现服务器动态增减的方法、系统及装置

Publications (1)

Publication Number Publication Date
WO2022062186A1 true WO2022062186A1 (zh) 2022-03-31

Family

ID=74007233

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/134284 WO2022062186A1 (zh) 2020-09-25 2020-12-07 通过定时任务实现服务器动态增减的方法、系统及装置

Country Status (2)

Country Link
CN (1) CN112199251B (zh)
WO (1) WO2022062186A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105099935A (zh) * 2015-07-28 2015-11-25 小米科技有限责任公司 服务器负载控制方法及装置
CN106067852A (zh) * 2016-06-08 2016-11-02 智者四海(北京)技术有限公司 服务器使用量的监控方法及装置
CN106375420A (zh) * 2016-08-31 2017-02-01 武汉钢信软件有限公司 一种基于负载均衡的服务器集群智能监控系统及方法
CN106878064A (zh) * 2017-01-16 2017-06-20 腾讯科技(深圳)有限公司 数据监控方法和装置
WO2017161820A1 (zh) * 2016-03-25 2017-09-28 乐视控股(北京)有限公司 一种服务器分组管理方法、装置和电子设备
CN109032904A (zh) * 2018-07-19 2018-12-18 郑州云海信息技术有限公司 被监控、管理服务器及数据获取、分析方法和管理系统

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100715674B1 (ko) * 2005-09-15 2007-05-09 한국전자통신연구원 부하 분산 방법 및 장치, 그리고 이를 이용한 소프트웨어스트리밍 시스템
CN105024842A (zh) * 2014-04-25 2015-11-04 深圳市腾讯计算机系统有限公司 服务器的扩容方法及装置
CN106470219A (zh) * 2015-08-17 2017-03-01 阿里巴巴集团控股有限公司 计算机集群的扩容和缩容方法及设备
CN106375395B (zh) * 2016-08-30 2019-06-11 厦门中学西渐信息科技有限公司 节点服务器的负载均衡方法和系统
CN108063784B (zh) * 2016-11-08 2022-01-25 阿里巴巴集团控股有限公司 一种云环境下应用集群资源分配的方法、装置和系统
CN108848166A (zh) * 2018-06-20 2018-11-20 中国联合网络通信集团有限公司 一种容器的负载均衡调度方法及装置
CN109669758A (zh) * 2018-09-11 2019-04-23 深圳平安财富宝投资咨询有限公司 服务器资源的调配方法、装置、设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105099935A (zh) * 2015-07-28 2015-11-25 小米科技有限责任公司 服务器负载控制方法及装置
WO2017161820A1 (zh) * 2016-03-25 2017-09-28 乐视控股(北京)有限公司 一种服务器分组管理方法、装置和电子设备
CN106067852A (zh) * 2016-06-08 2016-11-02 智者四海(北京)技术有限公司 服务器使用量的监控方法及装置
CN106375420A (zh) * 2016-08-31 2017-02-01 武汉钢信软件有限公司 一种基于负载均衡的服务器集群智能监控系统及方法
CN106878064A (zh) * 2017-01-16 2017-06-20 腾讯科技(深圳)有限公司 数据监控方法和装置
CN109032904A (zh) * 2018-07-19 2018-12-18 郑州云海信息技术有限公司 被监控、管理服务器及数据获取、分析方法和管理系统

Also Published As

Publication number Publication date
CN112199251B (zh) 2022-04-29
CN112199251A (zh) 2021-01-08

Similar Documents

Publication Publication Date Title
CN110032567B (zh) 报表查询方法、装置、服务器和存储介质
TWI761349B (zh) 風險識別方法、客戶端設備及風險識別系統
CN107426274B (zh) 基于时序的业务应用及监控分析调度的方法和系统
CN104407926B (zh) 一种云计算资源的调度方法
WO2023125672A1 (zh) 一种平台消息跟踪方法、系统、装置及存储介质
CN109981702B (zh) 一种文件存储方法及系统
CN112445857A (zh) 一种基于数据库的资源配额管理方法和装置
CN111984495A (zh) 一种大数据监控方法、装置和存储介质
CN101827120A (zh) 一种集群存储方法及系统
CN102904942B (zh) 服务资源控制系统和服务资源控制方法
CN117370138A (zh) 大容量分布式存储系统
CN116662020A (zh) 应用服务动态管理方法、系统、电子设备及存储介质
CN109165207B (zh) 基于Hadoop的饮用水海量数据存储管理方法和系统
WO2022062186A1 (zh) 通过定时任务实现服务器动态增减的方法、系统及装置
CN114090230A (zh) 一种面向海量异构资源的物联网北向中间件服务治理方法
CN103530173B (zh) 动态权重事件处理系统和方法
CN117472652A (zh) 一种云计算运维平台的数据备份方法、装置及系统
CN204425400U (zh) 应用服务器系统
CN113537530B (zh) 基于智慧社区物联网大数据的智能分析及应用方法
CN115718732A (zh) 一种磁盘文件管理方法、装置、设备及存储介质
CN106713051A (zh) 一种网络管理系统
DE212020000560U1 (de) System, Vorrichtung und Medium zum dynamischen Hinzufügen und Entfernen von Servern mittels zeitgesteuerter Aufgaben
CN112667460A (zh) 一种航空电子系统应用任务栈空间的监控方法
CN115114133B (zh) 基于java的系统自适应限流方法、装置及存储介质
CN113422845B (zh) 一种号码调度方法及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20955028

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20955028

Country of ref document: EP

Kind code of ref document: A1