Nothing Special   »   [go: up one dir, main page]

TWI756685B - Computer program product and apparatus for arranging and executing jobs - Google Patents

Computer program product and apparatus for arranging and executing jobs Download PDF

Info

Publication number
TWI756685B
TWI756685B TW109116332A TW109116332A TWI756685B TW I756685 B TWI756685 B TW I756685B TW 109116332 A TW109116332 A TW 109116332A TW 109116332 A TW109116332 A TW 109116332A TW I756685 B TWI756685 B TW I756685B
Authority
TW
Taiwan
Prior art keywords
mentioned
work
type
main queue
executing
Prior art date
Application number
TW109116332A
Other languages
Chinese (zh)
Other versions
TW202145003A (en
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 TW109116332A priority Critical patent/TWI756685B/en
Publication of TW202145003A publication Critical patent/TW202145003A/en
Application granted granted Critical
Publication of TWI756685B publication Critical patent/TWI756685B/en

Links

Images

Landscapes

  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure discloses a computer program product for arranging and executing jobs being loaded and executed by a processing unit of an application server to include program code to: acquire an object for the top of a primary queue, which is generated by a client to request the application server to execute a service; determine whether the primary queue contains any same object as the acquired object; and if so, drop the object from being processed.

Description

排程和執行工作的電腦程式產品和裝置Computer program products and devices for scheduling and performing work

本發明關連於一種工作處理技術,特別是一種排程和執行工作的電腦程式產品和裝置。The present invention relates to a job processing technology, and more particularly to a computer program product and apparatus for scheduling and executing jobs.

應用程式伺服器通常需要處理各種不同類型的工作。有些工作需要執行的工作很短,例如單純的資料庫交易;另一些工作需要執行很長的時間,例如資料庫中資料表的大量總結計算,造成需要執行很長時間的工作會阻礙短時間工作的執行。此外,有些工作的執行需要依照順序並且有條件分支,要在延遲一小段時間後,等待主分支執行完成後才會接續次分支的執行。例如,將多筆資料寫入資料庫,寫入完成後取得最後一筆資料的生成流水號,做為下個步驟的輸入參數。有時候,當資料庫系統忙碌時,無法很快的生成流水號,造成欲取得最後一筆資料的生成流水號的工作不能馬上完成。傳統上,應用程式會啟動一個計時器,反覆偵測資料庫系統是否存在最後一筆資料的生成流水號,造成應用程式伺服器連續收到很多偵測的工作。另有時候,使用者常常在使用者介面上連續按重新整理按鈕來查詢資料,造成應用程式伺服器連續收到很多相同的查詢工作。這些重複的相同工作都會加重應用程式伺服器的工作負載。因此,需要一種電腦程式產品和裝置,用於排程和執行工作,有效率地處理應用程式產生的不同類型的工作。Application servers are often required to handle a variety of different types of work. Some tasks need to be performed for a short period of time, such as simple database transactions; other tasks need to be performed for a long time, such as a large number of summary calculations for data tables in the database, resulting in long-term tasks that will hinder short-time tasks. execution. In addition, some jobs need to be executed sequentially and conditionally. After a short delay, the execution of the secondary branch will not be continued until the execution of the primary branch is completed. For example, multiple pieces of data are written into the database, and after the writing is completed, the generation serial number of the last piece of data is obtained as the input parameter of the next step. Sometimes, when the database system is busy, the serial number cannot be generated quickly, so that the work of generating the serial number to obtain the last piece of data cannot be completed immediately. Traditionally, the application program will start a timer to repeatedly detect whether the database system has the generation serial number of the last piece of data, causing the application server to continuously receive a lot of detection work. In other cases, users often press the refresh button on the user interface to query data continuously, causing the application server to continuously receive many of the same query jobs. These repetitions of the same work can increase the workload of the application server. Therefore, there is a need for a computer program product and apparatus for scheduling and executing jobs that efficiently handle the different types of jobs generated by applications.

有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。In view of this, how to alleviate or eliminate the above-mentioned deficiencies in related fields is a problem to be solved.

本說明書涉及一種電腦程式產品,用於排程和執行工作,包含能夠應用程式伺服器的處理單元載入並執行的程式碼,用於:從主要佇列的頂端取出物件,此物件由客戶端產生來請求應用程式伺服器執行服務;判斷主要佇列中是否存在相同於此物件的任何物件;以及當主要佇列中存在相同於此物件的任何物件時,丟棄此物件而不處理。This specification relates to a computer program product for scheduling and executing work, including code that can be loaded and executed by a processing unit of an application server for: fetching an object from the top of the main queue, the object being executed by the client Generated to request the application server to perform service; determine whether there is any object identical to this object in the main queue; and when there is any object identical to this object in the main queue, discard this object without processing.

本說明書另涉及一種排程和執行工作的裝置,包含記憶體和處理單元。記憶體配置空間給主要佇列。處理單元耦接記憶體,用於從主要佇列的頂端取出物件,此物件由客戶端產生來請求此裝置執行服務;判斷主要佇列中是否存在相同於此物件的任何物件;以及當主要佇列中存在相同於此物件的任何物件時,丟棄此物件而不處理。The present specification also relates to an apparatus for scheduling and executing work, including a memory and a processing unit. Memory allocation space for the main queue. The processing unit is coupled to the memory, and is used for fetching an object from the top of the main queue, the object is generated by the client to request the device to execute the service; determining whether there is any object identical to the object in the main queue; and when the main queue When there is any object in the row that is identical to this object, this object is discarded and not processed.

本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。Other advantages of the present invention will be explained in more detail in conjunction with the following description and drawings.

以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。The following description is a preferred implementation manner to complete the invention, and its purpose is to describe the basic spirit of the invention, but it is not intended to limit the invention. Reference must be made to the scope of the following claims for the actual inventive content.

必須了解的是,使用於本說明書中的“包含”、“包括”等詞,用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。It must be understood that the words "comprising" and "including" used in this specification are used to indicate the existence of specific technical features, values, method steps, operation processes, elements and/or components, but do not exclude the possibility of adding More technical features, values, method steps, job processes, elements, components, or any combination of the above.

於權利要求中使用如“第一”、“第二”、“第三”等詞是用來修飾權利要求中的元件,並非用來表示之間具有優先順序,前置關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。The use of words such as "first", "second", "third", etc. in the claims is used to modify the elements in the claims, and is not used to indicate that there is a priority order, a preceding relationship between them, or an element Prior to another element, or chronological order in which method steps are performed, is only used to distinguish elements with the same name.

必須了解的是,當元件描述為“連接”或“耦接”至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為“直接連接”或“直接耦接”至另一元件時,其中不存在任何中間元件。使用來描述元件之間關係的其他語詞也可類似方式解讀,例如“介於”相對於“直接介於”,或者是“鄰接”相對於“直接鄰接”等等。It must be understood that when an element is described as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, and intervening elements may be present. In contrast, when an element is described as being "directly connected" or "directly coupled" to another element, there are no intervening elements present. Other words used to describe the relationship between elements can also be read in a similar fashion, such as "between" versus "directly interposed," or "adjacent" versus "directly adjoining," and the like.

本發明實施例提出一種網路系統架構,包含伺服器(servers)與多部客戶端(clients)。圖1係依據本發明實施例的網路系統架構圖。應用程式伺服器110、桌上型電腦151、平板電腦153以及手機155之間可透過網路100彼此通訊,網路100可為網際網路(Internet)、有線區域網路(wired Local Area Network,LAN)、無線區域網路,或以上的任意組合。桌上型電腦151、平板電腦153以及手機155可稱為客戶端,通過網路100將應用程式部署到應用程式伺服器110上,或者是通過網路100執行應用程式伺服器110上運行的服務。應用程式通常由服務提供者(Service Provider)開發並部署到應用程式伺服器110,包含各式各樣的業務邏輯,可涵蓋但不限於數位銀行管理、網路銀行、行動客服、企業內部流程管理、大數據存儲、大數據資料整合、大數據資料檢索等領域。An embodiment of the present invention provides a network system architecture, including a server (servers) and a plurality of clients (clients). FIG. 1 is an architecture diagram of a network system according to an embodiment of the present invention. The application server 110 , the desktop computer 151 , the tablet computer 153 and the mobile phone 155 can communicate with each other through the network 100 , and the network 100 can be the Internet, a wired local area network, LAN), wireless local area network, or any combination of the above. The desktop computer 151 , the tablet computer 153 and the mobile phone 155 can be referred to as clients, deploying applications to the application server 110 through the network 100 , or executing services running on the application server 110 through the network 100 . The application is usually developed by a service provider and deployed to the application server 110, and includes various business logics, which may include but are not limited to digital banking management, online banking, mobile customer service, and enterprise internal process management , big data storage, big data data integration, big data data retrieval and other fields.

圖2係依據本發明實施例的運算裝置的系統架構圖。此系統架構可實施於應用程式伺服器110、桌上型電腦151、平板電腦153以及手機155中之任一者,至少包含處理單元210。處理單元210可使用多種方式實施,例如以專用硬體電路或通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器),並且在執行程式碼或軟體時,提供之後所描述的功能。系統架構另包含記憶體250及儲存單元240,記憶體250儲存程式碼執行過程中需要的資料,例如,變數、資料表(Data Tables)等,儲存單元240儲存各式各樣的電子檔案,例如,網頁、文件、音訊檔、視訊檔等。系統架構另包含通訊介面260,讓處理單元210可藉以跟其他電子裝置進行溝通。通訊介面260可以是無線電信通訊模組(Wireless Telecommunications Module)、區域網路(Local Area Network, LAN)通訊模組或無線區域網路通訊模組(WLAN)。無線電信通訊模組(Wireless Telecommunications Module)可包含支援2G、3G、4G或以上技術世代的任意組合的調變解調器(Modem)。輸入裝置230可包含鍵盤、滑鼠、觸控面板等。使用者可按壓鍵盤上的硬鍵來輸入字元,藉由操作滑鼠來控制鼠標,或者是在觸控面板製造手勢來控制執行中的應用程式。手勢可包含單擊、雙擊、單指拖曳、多指拖曳等,但不限定於此。顯示單元220可包含顯示面板(例如,薄膜液晶顯示面板、有機發光二極體面板或其他具顯示能力的面板),用以顯示輸入的字元、數字、符號、拖曳鼠標的移動軌跡、繪製的圖案或應用程式所提供的畫面,提供給使用者觀看。FIG. 2 is a system architecture diagram of a computing device according to an embodiment of the present invention. This system architecture can be implemented in any one of the application server 110 , the desktop computer 151 , the tablet computer 153 , and the mobile phone 155 , including at least the processing unit 210 . The processing unit 210 may be implemented in a variety of ways, such as in dedicated hardware circuits or general-purpose hardware (eg, a single processor, a multiprocessor with parallel processing capabilities, a graphics processor, or other processors with computing capabilities), and in When the code or software is executed, the functions described later are provided. The system architecture further includes a memory 250 and a storage unit 240. The memory 250 stores data required during the execution of the code, such as variables, data tables, etc., and the storage unit 240 stores various electronic files, such as , web pages, documents, audio files, video files, etc. The system architecture further includes a communication interface 260 for the processing unit 210 to communicate with other electronic devices. The communication interface 260 may be a wireless telecommunications module (Wireless Telecommunications Module), a local area network (LAN) communication module or a wireless local area network communication module (WLAN). The Wireless Telecommunications Module may include any combination of modems (Modems) supporting 2G, 3G, 4G or above technology generations. The input device 230 may include a keyboard, a mouse, a touch panel, and the like. The user can press hard keys on the keyboard to input characters, control the mouse by operating the mouse, or control the running application by making gestures on the touch panel. Gestures may include single-click, double-click, single-finger drag, multi-finger drag, etc., but are not limited thereto. The display unit 220 may include a display panel (eg, a thin-film liquid crystal display panel, an organic light-emitting diode panel, or other panels with display capability) for displaying inputted characters, numbers, symbols, dragging mouse movements, and drawn The picture provided by the pattern or the application program is provided for the user to watch.

應用程式伺服器110提供一個應用程式執行的環境,為每個應用程式提供多樣的服務,例如,請求分派與負載平衡、數位認證中心、應用程式介面(Application Programming Interface,API)授權管理、用戶授權/流量/網際網路通訊協定(Internet Protocol,IP)控制、組織階層管理、資安連線(SSL/TLS)管理、數位簽章驗證、機敏資料加密、單一登入主動目錄(Single Sign-On Active Directory,SSO AD)整合、跨站指令(Cross-Site Scripting,XSS)防駭攻擊、API熱部署、區段故障切換(Session Fail-over)、預防重複交易機制、貴賓API優先、異質部署/多版本運行、API偵錯、API軌跡紀錄、伺服器監控/告警、逐API/用戶報表、(Java)DC主機綁定管理、.NET站台綁定管理、註冊主機管理、API服務註冊、API模組佈署發佈、API組合與設計等。從另一面來說,這些功能也可以被多種不同的應用程式使用,因此,如上所述應用程式執行的環境又稱為共用服務平台(Shared Service Platform)。The application server 110 provides an application execution environment and provides various services for each application, such as request dispatch and load balancing, digital authentication center, application programming interface (API) authorization management, user authorization /traffic/Internet Protocol (IP) control, organization level management, information security connection (SSL/TLS) management, digital signature verification, sensitive data encryption, single sign-on active directory (Single Sign-On Active Directory) Directory, SSO AD) integration, Cross-Site Scripting (XSS) anti-hack attack, API hot deployment, Session Fail-over, Duplicate transaction prevention mechanism, VIP API priority, heterogeneous deployment/multiple Version operation, API debugging, API track record, server monitoring/alarm, API/user report, (Java)DC host binding management, .NET platform binding management, registered host management, API service registration, API module Deployment release, API composition and design, etc. On the other hand, these functions can also be used by a variety of different applications. Therefore, the environment in which the applications are executed as described above is also called a Shared Service Platform.

為了將需要長時間執行和短時間執行的工作分開處理,應用程式伺服器110可在其記憶體250中提供兩個工作佇列:主要佇列和二級佇列。圖3為依據本發明實施例的佇列配置示意圖。舉例來說,記憶體250分別配置空間給主要佇列310和二級佇列330,主要佇列310用於依照到達應用程式伺服器110的時間順序儲存用戶端發送的物件(包含需要短時間和長時間處理的工作),而二級佇列330用於依照到達應用程式伺服器110的時間順序儲存從主要佇列310遷移來的物件(只包含需要長時間處理的工作)。主要佇列310和二級佇列330各包含多筆項目(Entry)形成的集合(Collection)。主要佇列310和二級佇列330中的每一筆項目可儲存一個物件。主要佇列310和二級佇列330的操作基本原則是由結束位置(如指標T所指的位置)新增物件(可稱為入列),並且由開始位置(如指標H所指的位置)移除物件(可稱為出列)。也就是說,第一個新增至主要佇列310或二級佇列330的物件,也將會是第一個被移出的,符合先進先出(First-In First-Out,FIFO)的原則。To separate long-running and short-running jobs, the application server 110 may provide two job queues in its memory 250: a primary queue and a secondary queue. FIG. 3 is a schematic diagram of a queue configuration according to an embodiment of the present invention. For example, the memory 250 allocates space to the primary queue 310 and the secondary queue 330, respectively. The primary queue 310 is used to store the objects (including the objects that need a short time and Long-running jobs), while the secondary queue 330 is used to store objects migrated from the primary queue 310 (including only long-running jobs) in chronological order of arrival at the application server 110. The primary queue 310 and the secondary queue 330 each contain a collection formed by multiple entries (Entry). Each item in the primary queue 310 and the secondary queue 330 can store one object. The basic principle of operation of the main queue 310 and the secondary queue 330 is to add an object (which can be called enqueue) from the end position (such as the position indicated by the indicator T), and add an object (which can be called entering the queue) from the end position (such as the position indicated by the index H), and add an object (may be called entering the queue) from the end position (such as the position indicated by the index H), and start the position (such as the position indicated by the index H). ) to remove the object (may be called dequeuing). That is to say, the first object added to the primary queue 310 or the secondary queue 330 will also be the first to be removed, which conforms to the First-In First-Out (FIFO) principle. .

為了區分需要長時間處理的工作和短時間處理的工作,客戶端執行的應用程式可產生繼承不同抽象類別(Abstract Class)的物件,並且將產生的物件通過網路100傳送給應用程式伺服器110。圖4A和圖4B係依據本發明實施例的類別圖(Class Diagram)。In order to distinguish the work that needs to be processed for a long time from the work that needs to be processed in a short time, the application program executed by the client can generate objects that inherit different abstract classes, and transmit the generated objects to the application server 110 through the network 100 . 4A and 4B are class diagrams according to an embodiment of the present invention.

圖4A的類別圖包含工作抽象類別“Abstract Job”410,至少包含一個屬性:工作類型“jobType”的長整數;以及一個方法:不傳回值的工作執行“runJob()”。郵件類別“Mail”422和資料庫處理類別“DB_Trans”424擴充(Extends)工作抽象類別“Abstract Job”410,代表它們是短時間處理的工作。郵件類別“Mail”422至少包含幾個屬性:群組識別碼“groupID”的長整數、多個接收地址“To[]”的字串和多個副本地址“CC[]”的字串;以及一個方法:不傳回值的工作執行“runJob()”。資料庫處理類別“DB_Trans”424至少包含幾個屬性:群組識別碼“groupID”的長整數、資料庫名稱“dbName”的字串和SQL命令“sqlQuery”的字串;以及一個方法:不傳回值的工作執行“runJob()”。其中,群組識別碼“groupID”用來區別不同物件之間相同與否。例如,應用程式為反覆偵測資料庫系統是否存在最後一筆資料的生成流水號會產生的多個資料庫處理類別“DB_Trans”424的物件,然而,它們的群組識別碼“groupID”是相同的。The class diagram of Figure 4A contains a job abstract class "Abstract Job" 410, containing at least one attribute: a long integer of job type "jobType"; and a method: a job execution "runJob()" that returns no value. The mail class "Mail" 422 and the database processing class "DB_Trans" 424 extend (Extends) the job abstract class "Abstract Job" 410 to represent that they are short-term processing jobs. The mail class "Mail" 422 contains at least several attributes: a long integer of the group identifier "groupID", a string of multiple recipient addresses "To[]", and a string of multiple copy addresses "CC[]"; and One method: Execute "runJob()" for jobs that do not return a value. The database processing category "DB_Trans" 424 contains at least several attributes: a long integer for the group identifier "groupID", a string for the database name "dbName", and a string for the SQL command "sqlQuery"; and a method: not transfer The job that returns the value executes "runJob()". Among them, the group identification code "groupID" is used to distinguish whether different objects are the same or not. For example, the application program repeatedly detects whether the database system has the generation serial number of the last data, and multiple databases will be generated to process objects of type "DB_Trans" 424, however, their group ID "groupID" is the same .

圖4B的類別圖包含可延遲工作抽象類別“Abstract DefferableJob”450,至少包含一個屬性:工作類型“jobType”的長整數;以及一個方法:不傳回值的工作執行“runJob()”。群組郵件類別“GroupMail”462和資料庫批次處理類別“DB_BatchTrans”464擴充可延遲工作抽象類別“Abstract DefferableJob”450,代表它們是長時間處理的工作。群組郵件類別“GroupMail”462至少包含幾個屬性:群組識別碼“groupID”的長整數、多個接收地址“To[]”的字串和多個副本地址“CC[]”的字串;以及一個方法:不傳回值的工作執行“runJob()”。 資料庫批次處理類別“DB_BatchTrans”464至少包含幾個屬性:群組識別碼“groupID”的長整數、資料庫名稱“dbName”的字串和SQL命令“sqlQuery”的字串;以及一個方法:不傳回值的工作執行“runJob()”。類似地,群組識別碼“groupID”用來區別不同物件之間相同與否。The class diagram of Figure 4B contains a deferred job abstract class "Abstract DefferableJob" 450, containing at least one attribute: a long integer of job type "jobType"; and a method: a job execution "runJob()" that returns no value. The group mail class "GroupMail" 462 and the database batch class "DB_BatchTrans" 464 extend the deferred job abstract class "Abstract DefferableJob" 450 to represent that they are long-running jobs. The group mail category "GroupMail" 462 contains at least several attributes: a long integer of the group identification code "groupID", a string of multiple recipient addresses "To[]", and a string of multiple copy addresses "CC[]" ; and a method: a job that does not return a value executes "runJob()". The database batch class "DB_BatchTrans" 464 contains at least several attributes: a long integer for the group identifier "groupID", a string for the database name "dbName", and a string for the SQL command "sqlQuery"; and a method: Jobs that do not return a value execute "runJob()". Similarly, the group identifier "groupID" is used to distinguish different objects from being the same or not.

此外,工作類型“jobType”的長整數可儲存一個物件的類別是擴充自工作抽象類別“Abstract Job”410或可延遲工作抽象類別“Abstract DefferableJob”450的資訊。In addition, the long integer of the job type "jobType" can store information that the class of an object is extended from the job abstract class "Abstract Job" 410 or the deferred job abstract class "Abstract DefferableJob" 450 .

客戶端可在產生郵件類別“Mail”422、資料庫處理類別“DB_Trans”424、群組郵件類別“GroupMail”462、資料庫批次處理類別“DB_BatchTrans”464或其他類別的物件後,將請求應用伺服器110執行的指令放在工作執行方法“runJob()”,用以當應用伺服器110執行這些指令後,完成請求的工作。The client may request the application after generating objects of the mail class "Mail" 422, the database processing class "DB_Trans" 424, the group mail class "GroupMail" 462, the database batch processing class "DB_BatchTrans" 464 or other classes. The instructions executed by the server 110 are placed in the job execution method "runJob( )" to complete the requested job after the application server 110 executes the instructions.

圖5係依據本發明實施例的排程和執行工作的方法流程圖,由應用程式伺服器110的處理單元210(以下簡稱處理單元210以求簡明)於載入並執行特定軟體模組時實施,用於完成主要佇列310中儲存的工作。詳細說明如下:5 is a flowchart of a method for scheduling and executing tasks according to an embodiment of the present invention, which is implemented by the processing unit 210 (hereinafter referred to as the processing unit 210 for brevity) of the application server 110 when loading and executing a specific software module , used to complete the work stored in the main queue 310. Details are as follows:

步驟S510:從主要佇列310的頂端取出一個物件,此物件由客戶端產生來請求應用程式伺服器執行特定的服務。Step S510: Take out an object from the top of the main queue 310, the object is generated by the client to request the application server to execute a specific service.

步驟S520:判斷主要佇列310中是否存在相同於取出物件的任何物件。如果是,則繼續進行步驟S530的處理;否則,繼續進行步驟S550的處理。詳細來說,處理單元210可判斷主要佇列310中是否存在任何一個物件,包含與取出物件的群組識別碼“groupID”相同的群組識別碼。如果是,則代表主要佇列310中是否存在相同的物件。Step S520: Determine whether there is any object in the main queue 310 that is the same as the extracted object. If yes, proceed to the process of step S530; otherwise, proceed to the process of step S550. Specifically, the processing unit 210 can determine whether there is any object in the main queue 310, which includes the same group ID as the group ID "groupID" of the extracted object. If yes, it represents whether the same object exists in the main queue 310.

步驟S530:丟棄此物件而不處理。由於相同的工作只要執行一次就可以,因此,處理單元210可以先將之前重複的工作丟棄,只執行最後一次的工作,用來避免應用程式伺服器110花費不必要的時間和資源來處理。雖然之前重複的工作被丟棄,使用者依然可以獲得最後一次的工作執行結果。Step S530: Discard the object without processing. Since the same work only needs to be performed once, the processing unit 210 can discard the previously repeated work first, and only execute the last work, so as to avoid the application server 110 spending unnecessary time and resources for processing. Although the previous repeated work is discarded, the user can still obtain the result of the last work execution.

步驟S540:等待一段預設時間,例如0.5秒、1秒,或者依據系統需求預先設定大於0秒的時間。Step S540: Wait for a preset time, such as 0.5 seconds, 1 second, or preset a time greater than 0 seconds according to system requirements.

步驟S550:判斷取出的物件是否包含短時間處理工作。如果是,則繼續進行步驟S560的處理;否則,繼續進行步驟S580的處理。詳細來說,處理單元210可判斷取出的物件是擴充自工作抽象類別“Abstract Job”410還是擴充自可延遲工作抽象類別“Abstract DefferableJob”450。如果是擴充自工作抽象類別“Abstract Job”410,則代表判斷成立。Step S550: Determine whether the extracted object includes short-time processing work. If yes, proceed to the process of step S560; otherwise, proceed to the process of step S580. Specifically, the processing unit 210 can determine whether the fetched object is extended from the job abstract class “Abstract Job” 410 or from the deferred job abstract class “Abstract DefferableJob” 450 . If it is extended from the job abstract category "Abstract Job" 410, it means that the judgment is established.

步驟S560:執行取出物件的工作。詳細來說,處理單元210可執行取出物件的工作執行方法“runJob()”來完成短時間處理工作。Step S560: Execute the work of taking out the object. In detail, the processing unit 210 can execute the job execution method "runJob( )" for taking out objects to complete the short-time processing job.

步驟S570:回覆此工作的執行結果給客戶端。詳細來說,處理單元210可通過通訊介面260經由網路100將此工作的執行結果(例如,執行成功或失敗的訊息、搜索到的資料等)回覆給客戶端。Step S570: Reply the execution result of the work to the client. Specifically, the processing unit 210 can reply the execution result of the work (eg, a message of execution success or failure, searched data, etc.) to the client through the communication interface 260 via the network 100 .

步驟S580:回覆此工作正在執行的訊息給客戶端。詳細來說,由於此工作需要執行一段較長的時間,處理單元210可通過通訊介面260經由網路100先回覆此工作正在執行的訊息給客戶端。Step S580: Reply the message that the job is being executed to the client. In detail, since the work needs to be performed for a long time, the processing unit 210 can first reply the message that the work is being performed to the client through the communication interface 260 via the network 100 .

步驟S590:將取出的物件遷移到二級佇列330的底端。在這裡需要注意的是,處理單元210將在適當的時間以FIFO的順序取出二級佇列330中的物件並執行。Step S590 : Move the extracted object to the bottom of the secondary queue 330 . It should be noted here that the processing unit 210 will fetch the objects in the secondary queue 330 in the order of FIFO at an appropriate time and execute them.

以下舉出數個使用案例來輔助說明如圖5所示的方法。假設主要佇列310和二級佇列330的初始狀態如圖3所示,其中,物件“X”代表資料庫批次處理類別“DB_BatchTrans”464的物件,物件“Y”代表資料庫處理類別“DB_Trans”424的物件,而物件“Z”代表群組郵件類別“GroupMail”462的物件。Several use cases are listed below to assist in explaining the method shown in Figure 5. Assume that the initial state of the primary queue 310 and the secondary queue 330 is as shown in Figure 3, wherein the object "X" represents the object of the database batch processing class "DB_BatchTrans" 464, and the object "Y" represents the database processing class " DB_Trans" 424 object, and object "Z" represents an object of the group mail class "GroupMail" 462.

圖6是依據本發明實施例在時間點t1執行主要佇列中的工作的示意圖。由於物件“Y”包含需要短時間處理的工作(步驟S550中“是”的路徑),處理單元210直接執行物件“Y”中指示的工作(步驟S560),並且回覆此工作的執行結果給客戶端(步驟S570)。FIG. 6 is a schematic diagram of executing work in the main queue at time point t1 according to an embodiment of the present invention. Since the object "Y" contains a job that needs to be processed in a short time (the path of "Yes" in step S550 ), the processing unit 210 directly executes the job indicated in the object "Y" (step S560 ), and returns the execution result of this job to the client terminal (step S570).

圖7是依據本發明實施例在時間點t2至t4執行主要佇列中的工作的示意圖。由於主要佇列310中包含了相同的物件“X”(步驟S520中“是”的路徑),處理單元210直接從主要佇列310取出這些重複的物件“X”並丟棄而不執行。FIG. 7 is a schematic diagram of performing work in the main queue at time points t2 to t4 according to an embodiment of the present invention. Since the main queue 310 contains the same object "X" (the path of "Yes" in step S520), the processing unit 210 directly takes out these duplicate objects "X" from the main queue 310 and discards them without executing.

圖8是依據本發明實施例在時間點t5執行主要佇列中的工作的示意圖。由於主要佇列310中已經沒有相同的物件“X”(步驟S520中“否”的路徑)並且物件“X”包含需要長時間處理的工作(步驟S550中“否”的路徑),處理單元210回覆此工作正在執行的訊息給客戶端(步驟S580),並且將從主要佇列310取出的物件“X”遷移到二級佇列330的底端,等候將來被執行(步驟S590)。在這裡需要注意的是,應用程式伺服器110可於載入並執行相關程式碼時執行另一個方法,用於依序從二級佇列330的頂端取出物件並執行此物件所請求的服務。FIG. 8 is a schematic diagram of executing work in the main queue at time t5 according to an embodiment of the present invention. Since the same object "X" already does not exist in the main queue 310 (the path of "No" in step S520) and the object "X" contains work that needs to be processed for a long time (the path of "No" in step S550), the processing unit 210 Reply the message that the job is being executed to the client (step S580 ), and migrate the object “X” taken out from the primary queue 310 to the bottom of the secondary queue 330 , waiting to be executed in the future (step S590 ). It should be noted here that the application server 110 may execute another method when the relevant code is loaded and executed, for sequentially fetching the object from the top of the secondary queue 330 and executing the service requested by the object.

本發明所述的方法中的全部或部分步驟可以電腦程式實現,例如電腦的作業系統、電腦中特定硬體的驅動程式、或軟體應用程式。此外,也可實現於如上所示的其他類型程式。所屬技術領域具有通常知識者可將本發明實施例的方法撰寫成電腦程式,為求簡潔不再加以描述。依據本發明實施例方法實施的電腦程式,可儲存於適當的電腦可讀取資料載具,例如DVD、CD-ROM、USB碟、硬碟,亦可置於可通過網路(例如,網際網路,或其他適當載具)存取的網路伺服器。All or part of the steps in the method of the present invention can be implemented by a computer program, such as a computer's operating system, a specific hardware driver in the computer, or a software application. In addition, it can also be implemented in other types of programs as shown above. Those skilled in the art can write the methods of the embodiments of the present invention into computer programs, which are not described for brevity. The computer program implemented by the method according to the embodiment of the present invention can be stored in a suitable computer-readable data carrier, such as DVD, CD-ROM, USB disk, hard disk, or can be stored in a computer that can be accessed through a network (for example, the Internet route, or other suitable vehicle) to access the web server.

雖然圖2中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然圖5的步驟採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。Although the above-described elements are included in FIG. 2 , it is not excluded that more other additional elements may be used to achieve better technical effects without departing from the spirit of the invention. In addition, although the steps in FIG. 5 are performed in a specified order, those skilled in the art can modify the order of these steps on the premise of achieving the same effect without violating the spirit of the invention. Therefore, the present invention does not Constrained to use only the sequence as described above. In addition, those skilled in the art can also integrate several steps into one step, or in addition to these steps, perform more steps sequentially or in parallel, and the present invention is not limited thereby.

雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用以限縮本發明。相反地,此發明涵蓋了熟習此技藝人士顯而易見的修改與相似設置。所以,申請權利要求範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。Although the present invention is described using the above embodiments, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, this invention covers modifications and similar arrangements obvious to those skilled in the art. Therefore, the scope of the appended claims is to be construed in the broadest manner so as to encompass all obvious modifications and similar arrangements.

100:網路 110:應用程式伺服器 151:桌上型電腦 153:平板電腦 155:手機 210:處理單元 220:顯示單元 230:輸入裝置 240:儲存裝置 250:記憶體 260:通訊介面 310:主要佇列 330:二級佇列 410,450:抽象類別 422,424,462,464:類別 S510~S590:方法步驟 X,Y,Z:物件 t1~t5:時間點100: Internet 110: Application Server 151: Desktop Computers 153: Tablet PC 155: cell phone 210: Processing Unit 220: Display unit 230: Input Device 240: Storage Device 250: memory 260: Communication interface 310: Main Queue 330: Level 2 Queue 410,450: Abstract Category 422,424,462,464: Category S510~S590: method steps X,Y,Z: object t1~t5: time point

圖1係依據本發明實施例的網路系統架構圖。 圖2係依據本發明實施例的運算裝置的系統架構圖。 圖3為依據本發明實施例的佇列配置示意圖。 圖4A和圖4B係依據本發明實施例的類別圖。 圖5係依據本發明實施例的排程和執行工作的方法流程圖。 圖6是依據本發明實施例在時間點t1執行主要佇列中的工作的示意圖。 圖7是依據本發明實施例在時間點t2至t4執行主要佇列中的工作的示意圖。 圖8是依據本發明實施例在時間點t5執行主要佇列中的工作的示意圖。FIG. 1 is an architecture diagram of a network system according to an embodiment of the present invention. FIG. 2 is a system architecture diagram of a computing device according to an embodiment of the present invention. FIG. 3 is a schematic diagram of a queue configuration according to an embodiment of the present invention. 4A and 4B are class diagrams according to embodiments of the present invention. FIG. 5 is a flowchart of a method for scheduling and executing work according to an embodiment of the present invention. FIG. 6 is a schematic diagram of executing work in the main queue at time point t1 according to an embodiment of the present invention. FIG. 7 is a schematic diagram of performing work in the main queue at time points t2 to t4 according to an embodiment of the present invention. FIG. 8 is a schematic diagram of executing work in the main queue at time t5 according to an embodiment of the present invention.

S510~S590:方法步驟S510~S590: method steps

Claims (8)

一種排程和執行工作的電腦程式產品,包含能夠被一應用程式伺服器的一處理單元載入並執行的程式碼,用於:從一主要佇列的頂端取出一物件,其中上述物件由一客戶端產生來請求上述應用程式伺服器執行一服務;判斷上述主要佇列中是否存在相同於上述物件的任何物件;當上述主要佇列中存在相同於上述物件的任何物件時,丟棄上述物件而不處理;當上述主要佇列中不存在相同於上述物件的任何物件時,判斷上述物件包含一第一類別工作或者一第二類別工作,其中上述第一類別工作需要的處理時間比上述第二類別工作需要的處理時間短;當上述物件包含上述第一類別工作時,執行上述第一類別工作;以及當上述物件包含上述第二類別工作時,將上述物件遷移到一二級佇列的底端以等待將來處理。 A computer program product for scheduling and executing work, comprising code capable of being loaded and executed by a processing unit of an application server for: retrieving an object from the top of a main queue, wherein the object is composed of a The client is generated to request the above-mentioned application server to perform a service; it is judged whether there is any object identical to the above-mentioned object in the above-mentioned main queue; when there is any object that is identical to the above-mentioned object in the above-mentioned main queue, the above-mentioned object is discarded and No processing; when there is no object identical to the above-mentioned object in the above-mentioned main queue, it is determined that the above-mentioned object contains a first-type job or a second-type job, wherein the above-mentioned first-type job requires more processing time than the above-mentioned second type of job. The processing time required for the type of work is short; when the above-mentioned object contains the above-mentioned first type of work, the above-mentioned first type of work is executed; and when the above-mentioned object contains the above-mentioned second type of work, the above-mentioned object is moved to the bottom of the first-level queue. terminal for future processing. 如請求項1所述的排程和執行工作的電腦程式產品,其中,通過偵測上述主要佇列中所有物件的一群組識別碼屬性來判斷上述主要佇列中是否存在相同於上述物件的任何物件。 The computer program product for scheduling and executing work as claimed in claim 1, wherein whether there is an object in the main queue that is the same as the object is determined by detecting a group identifier attribute of all objects in the main queue. any object. 如請求項1所述的排程和執行工作的電腦程式產品,其中,通過判斷上述物件是擴充自一第一抽象類別或者一第二抽象類別來判斷上述物件包含上述第一類別工作或者上述第二類別工作。 The computer program product for scheduling and executing work according to claim 1, wherein it is judged that the object includes the work of the first class or the work of the first class by judging whether the object is extended from a first abstract class or a second abstract class Two categories of work. 如請求項1所述的排程和執行工作的電腦程式產品,其中,通過執行上述物件中的一方法來完成上述第一類別工作。 The computer program product for scheduling and performing work of claim 1, wherein the work of the first category is accomplished by executing a method of the objects. 一種排程和執行工作的裝置,包含:一記憶體,用於配置空間給一主要佇列;以及一處理單元,耦接上述記憶體,用於從上述主要佇列的頂端取出一物件,其中上述物件由一客戶端產生來請求上述裝置執行一服務;判斷上述主要佇列中是否存在相同於上述物件的任何物件;以及當上述主要佇列中存在相同於上述物件的任何物件時,丟棄上述物件而不處理;其中:當上述主要佇列中不存在相同於上述物件的任何物件時,上述處理單元判斷上述物件包含一第一類別工作或者一第二類別工作,其中上述第一類別工作需要的處理時間比上述第二類別工作需要的處理時間短;當上述物件包含上述第一類別工作時,執行上述第一類別工作;以及當上述物件包含上述第二類別工作時,將上述物件遷移到一二級佇列的底端以等待將來處理。 A device for scheduling and executing work, comprising: a memory for allocating space to a main queue; and a processing unit, coupled to the memory, for fetching an object from the top of the main queue, wherein The above-mentioned object is generated by a client to request the above-mentioned device to perform a service; it is judged whether there is any object identical to the above-mentioned object in the above-mentioned main queue; and when any object identical to the above-mentioned object exists in the above-mentioned main queue, the above-mentioned object is discarded The object is not processed; wherein: when the above-mentioned main queue does not exist any object identical to the above-mentioned object, the above-mentioned processing unit judges that the above-mentioned object includes a first type of work or a second type of work, wherein the above-mentioned first type of work requires The processing time is shorter than the processing time required for the above-mentioned second type of work; when the above-mentioned object contains the above-mentioned first type of work, execute the above-mentioned first type of work; and when the above-mentioned object contains the above-mentioned second type of work, migrate the above-mentioned object to The bottom of the first- and second-level queues for future processing. 如請求項5所述的排程和執行工作的裝置,其中,上述處理單元通過偵測上述主要佇列中所有物件的一群組識別碼屬性來判斷上述主要佇列中是否存在相同於上述物件的任何物件。 The device for scheduling and executing work according to claim 5, wherein the processing unit determines whether the same object exists in the main queue by detecting a group identifier attribute of all objects in the main queue of any object. 如請求項5所述的排程和執行工作的裝置,其中,上述處理單元通過判斷上述物件是擴充自一第一抽象類別或者一第二抽象類別來判斷上述物件包含上述第一類別工作或者上述第二類別工作。 The apparatus for scheduling and executing work according to claim 5, wherein the processing unit determines that the object includes the work of the first class or the work of the first class by judging whether the object is extended from a first abstract class or a second abstract class The second category of work. 如請求項5所述的排程和執行工作的裝置,其中,上述處理單元通過執行上述物件中的一方法來完成上述第一類別工作。 The apparatus for scheduling and executing work according to claim 5, wherein the processing unit completes the work of the first category by executing a method in the object.
TW109116332A 2020-05-15 2020-05-15 Computer program product and apparatus for arranging and executing jobs TWI756685B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109116332A TWI756685B (en) 2020-05-15 2020-05-15 Computer program product and apparatus for arranging and executing jobs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109116332A TWI756685B (en) 2020-05-15 2020-05-15 Computer program product and apparatus for arranging and executing jobs

Publications (2)

Publication Number Publication Date
TW202145003A TW202145003A (en) 2021-12-01
TWI756685B true TWI756685B (en) 2022-03-01

Family

ID=80783642

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109116332A TWI756685B (en) 2020-05-15 2020-05-15 Computer program product and apparatus for arranging and executing jobs

Country Status (1)

Country Link
TW (1) TWI756685B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW561369B (en) * 1999-08-31 2003-11-11 Andersen Consulting Llp A system, method and article of manufacture for remote demonstration of business capabilities in an e-commerce environment
WO2016004073A1 (en) * 2014-06-30 2016-01-07 Amazon Technologies, Inc. Machine learning service
US9672474B2 (en) * 2014-06-30 2017-06-06 Amazon Technologies, Inc. Concurrent binning of machine learning data
US20170257258A1 (en) * 2013-04-30 2017-09-07 Brian Bingham Processing of Log Data and Performance Data Obtained via an Application Programming Interface (API)

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW561369B (en) * 1999-08-31 2003-11-11 Andersen Consulting Llp A system, method and article of manufacture for remote demonstration of business capabilities in an e-commerce environment
US20170257258A1 (en) * 2013-04-30 2017-09-07 Brian Bingham Processing of Log Data and Performance Data Obtained via an Application Programming Interface (API)
WO2016004073A1 (en) * 2014-06-30 2016-01-07 Amazon Technologies, Inc. Machine learning service
US9672474B2 (en) * 2014-06-30 2017-06-06 Amazon Technologies, Inc. Concurrent binning of machine learning data

Also Published As

Publication number Publication date
TW202145003A (en) 2021-12-01

Similar Documents

Publication Publication Date Title
US11922232B2 (en) Responding to incidents identified by an information technology and security operations application using a mobile application
US11921672B2 (en) Query execution at a remote heterogeneous data store of a data fabric service
US11494380B2 (en) Management of distributed computing framework components in a data fabric service system
US10877987B2 (en) Correlating log data with performance measurements using a threshold value
US11880558B1 (en) Interface layout profiles including interface actions in an information technology and security operations application
US11868359B2 (en) Dynamically assigning queries to secondary query processing resources
US11782989B1 (en) Correlating data based on user-specified search criteria
US11119982B2 (en) Correlation of performance data and structure data from an information technology environment
US20190310977A1 (en) Bucket data distribution for exporting data to worker nodes
US20070168525A1 (en) Method for improved virtual adapter performance using multiple virtual interrupts
US20150046425A1 (en) Methods and systems for searching software applications
US11726843B2 (en) File upload modifications for client side applications
US11714683B1 (en) Information technology and security application automation architecture
US12045201B1 (en) Automatically configuring connectors of an information technology and security operations application
TWM600871U (en) Computer program product and apparatus for arranging and executing jobs
TWI756685B (en) Computer program product and apparatus for arranging and executing jobs
TWM599936U (en) Computer program product and apparatus for managing data caches
US8650548B2 (en) Method to derive software use and software data object use characteristics by analyzing attributes of related files
TWI745966B (en) Computer program product and apparatus for managing data caches
CN116134428A (en) Interactive signal processing in a distributed computing system
US10684898B2 (en) In-line event handlers across domains
US20160150038A1 (en) Efficiently Discovering and Surfacing Content Attributes
TWI758736B (en) Computer program product and apparatus for scheduling and executing jobs employed in parallel-processing environment
WO2024044612A1 (en) Dynamically updating classifier priority of a classifier model in digital data discovery
CN115795188A (en) Method and device for acquiring serial number, intelligent terminal and storage medium