1307231 九、發明說明: 【發明所屬之技術領域】 本發明係關於一種伺服器系統及其工作方法,尤其係關於一 、 種可以快速處理TCP請求的伺服器系統及方法。 1 【先前技術】 目鈾,網絡間交互日夜頻繁,譬如網絡遊戲或網絡聊天,這 些多涉及到信息的迅速並且可靠的傳遞,這些均要求網絡祠服器 ® 系統多程序並發工作且要有很好的回應速度。目前,通常採用多 程序以實現並發工作。然而習知技術的這種做法存有諸多缺陷, 因爲目前的操作系統基本都使用CPU分時的方法來達到程序並 發工作之目的,在工作時,存在程序間上下文切換的開銷,一味 使用多程序達到並發的目的反而會降低系統工作效率,伯用系統 資源,並使回應速度變慢。 【發明内容】 鲁為了解決上述習知技術中的問題與缺陷,本發明的目的之一 在於提供一處理TCP請求之系統,係用以快速處理TCP請求,該 系統包括以下模組:-程序啓動模組,_以在祕啓動時預先 啓動-管理程序和複數個工作程序,並把該複數個工作程序的屬 性標記為靜態工作程序;一程序分配及生成模組,係用以在用戶 端連接到系統後’由所述管理程序根據每個工作程序的工作情況 安排確定用於處理該連接之工作程序或生成新的動態工作程序; 一 S〇Cket異步輸入/輸出控繼、组,係用以透過socket異步輸入 1307231 /輸出魏令触功程相岐㈣料理⑽有Tcp連接及 每一連接的X作處雜ι·以及-_工作程序釋放模組,係用 以根據系統當前之網路連接數量及工作狀況,關所生成之動態 工作程序。 本發明的又-目的在於提供—處理Tcp請求之方法,係用以 快速處理TCP請求’該方法包括以下步驟:—程序啓動步驟,係 用以在系統啓動時預先啓動-管理程序和複數個工作程序,並把 該複數個工作程序的屬性標記為靜態工作程序;—程序分配及生 成步驟,_以在用戶端連接_統後,由所述管理程序根據每 個工作程相功情況安排確定祕處_連接之卫作程序或生 成新的動態工作程序;— SGeket異步輸人/輸出控制步驟,係用 以透過S〇eket異錄人/輸㈣能令所虹作餅_監控由盆 管理的所有TCP連接及每—連接的工作處理狀況;以及—祕二 作私序釋放步驟,伽啸據系統當前之_連紐量及工作 況,關閉所生成之動態工作程序。 、士發縣雌態工作程序和靜態王作料相結合的 2地_系統中程序_數’從喊省了系 占用率並提高了系統的工作效率。此外,本發明中料貝原 s λ /χ. , 了 socket 々月’』輸出功能’使每個工作程序可以負責管理 ;接二單料,式,—的異步 高L=面上發處理’從而減小並發的工作程序數量,: 1307231 綜上所述,與習知技術相比,本發明的優點是:由於本發明 之處理TCP請求之伺服器系統及方法採用動態工作程序和靜態工 作耘序相結合的方式實現程序並發工作,因而提高了系統工作效 率,並降低了系統的資源佔用率,從而使系統工作在較佳的工作 狀態。此外,透過socket異步輸入/輸出功能,系統以單程序工 作模式同時監視多個SGeket的異步處理,從而減小了並發的工作 程序數量,提高了系統效能。 【實施方式】 將、、-σ δ附圖對本發明的優選實施方式作詳細說明 一請參考「第1圖」及「第2圖」,「第1圖」爲本發明之飼服 …系m统架構賴,「第2圖」爲本發明之處理請求之 方法的部分步騎朗。如「第⑼」所示,本發明之値器系 統啓動後,透過-程序啓動模組,啓動—個管理程序ig和p個靜 恶工作程序20。管理程序10監聽向系統發出的TCP連接請求, 分配及生成模組中的平均分配模組根據系統當前連 將TCP連接任務按照平均分配的原則分配給相應 均達到“預:處理’當每個靜態工作程序20的TCP連接個數 祕U統預狄之門檻值M時,將透過程序分配及生成做中的 一門播值報警模組按照程序分配t 、 動態工作程序30,則,告 ▲報3原則,生成一個 分配的频㈣• 的取連接接人時,按照平均 :的原則’新的連接會盡量交給這個動態工作程序3G來處理, 一悲工條序3G具有最讀數之_,當射辦純警原則生 1307231 鱗3G的個數達到系統設置的上限值q時,系統 新的_#=^賴財的—祕關難令錢不再生成 、、作程序,而^系、统出現新的TCP連接請求時,管理程 二〇仍按平均分配的原則提交給合適的工作程序(包括靜態工^ 王和動態工作程序)來處理,但每個工作程序處理的tc ::還是有限制的’限制數為N,當所有— 數都達到N時,系統將拒絕新的連接接人,此 接到另外上去辦。 ^連 另外,本發明之處理TCP請求之系統還包括:- Socket異步 輸入/輸轉韻組’侧以透過SQeket異步輸V輸出功能令 工作私序啊監控由其管理的所有連接及每-賴的工作處理狀 j ’系統錄設置触’伽以在械纽環境下(cpu頻率 咼低、物理内存大小、硬盤速度快慢、是否是多CPU、何種操作 系統等),㈣性㈣試確定味理想的祕倾m統參數 值包括.靜‘紅作轉之個數P、每個卫作程序處理的連接個數 之門松值]VI、生成的動態工作程序之個數的上限值Q以及每個工 作程序所能纽的連接健之極限值N ;以及—動態工作程轉 放板組’係用以根據系統當前之網路連接數量及工作狀況,關閉 所生成之動||二作料,鞠態工伽轉賴崎在下述三種 情況之一的情況下關閉所生成之動態工作程序: 第種情況,系統停止時若存在動態工作程序,則關閉該動 態工作程序;BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a server system and a method for operating the same, and more particularly to a server system and method for rapidly processing TCP requests. 1 [Prior Art] Uranium, network interactions day and night, such as online games or web chat, these involve rapid and reliable transmission of information, which requires the network server system multi-program concurrent work and there must be very Good response speed. Currently, multiple programs are often used to achieve concurrent work. However, this practice of the prior art has many drawbacks, because the current operating system basically uses the CPU time-sharing method to achieve the purpose of the program concurrent work, at work, there is overhead of inter-program context switching, blindly using multiple programs. Concurrency will reduce the efficiency of the system, use system resources, and slow down the response. SUMMARY OF THE INVENTION In order to solve the problems and defects in the above-mentioned prior art, one of the objects of the present invention is to provide a system for processing a TCP request for quickly processing a TCP request, the system comprising the following modules: - Program Startup The module, _ pre-launched at the start of the secret-management program and a plurality of working programs, and marks the attributes of the plurality of working programs as static working programs; a program allocation and generating module is used to connect at the user end After the system, the management program determines the working program for processing the connection or generates a new dynamic working program according to the working condition of each working program; a S〇Cket asynchronous input/output control, group, system Through the socket asynchronous input 1307231 / output Wei Ling touch the power of the phase (four) cuisine (10) have Tcp connection and each connection X work miscellaneous ι· and _ work program release module, according to the current number of network connections according to the system And the working conditions, the dynamic work procedures generated by the off. Yet another object of the present invention is to provide a method for processing a Tcp request for quickly processing a TCP request. The method includes the following steps: - a program startup step for pre-launching at the system startup - a hypervisor and a plurality of jobs a program, and mark the attributes of the plurality of working programs as a static working program; - the program allocation and generating steps, _ after the user terminal is connected, the management program arranges the secret according to each working process. Connected to the program or generate a new dynamic work program; - SGeket asynchronous input / output control steps, through the S〇eket different recording / loss (four) can make the rainbow cake _ monitor all TCP managed by the basin The connection and the working condition of each connection; and the secret second release procedure, the gaer is based on the current system and the working condition, and the generated dynamic working program is closed. The combination of the female work program in Shifa County and the static king work material _ the number of programs in the system _ number from the call to save the system occupancy rate and improve the efficiency of the system. In addition, in the present invention, the material of the original s λ / χ., the socket 々 month '』 output function 'so that each work program can be responsible for management; two materials, the type, - asynchronous high L = face processing" Reducing the number of concurrent work programs, 1307231 In summary, the advantages of the present invention over the prior art are that the server system and method for processing TCP requests of the present invention employ dynamic working procedures and static working sequences. The combined method realizes the concurrent operation of the program, thereby improving the system work efficiency and reducing the resource occupancy rate of the system, thereby making the system work in a better working state. In addition, through the asynchronous input/output function of the socket, the system simultaneously monitors the asynchronous processing of multiple SGekets in a single-program mode, thereby reducing the number of concurrent programs and improving system performance. [Embodiment] The preferred embodiment of the present invention will be described in detail with reference to the drawings and drawings. Please refer to "Fig. 1" and "Fig. 2", and "Fig. 1" is a feeding service of the present invention. The "Architecture 2" is part of the method of processing the request of the present invention. As shown in "(9)", after the device system of the present invention is started, a management program ig and p static work programs 20 are started through the program startup module. The hypervisor 10 listens to the TCP connection request sent to the system, and the average allocation module in the allocation and generation module allocates the TCP connection task according to the current system according to the principle of the average allocation to the corresponding "pre-processing" when each static When the TCP connection number of the working program 20 is the secret value of the pre-Ddi's threshold value M, the program will be assigned and generated by the program distribution alarm module according to the program, and the dynamic work program 30, then, the report 3 Principle, generate an assigned frequency (four) • When taking the connection, according to the principle of averaging: 'The new connection will be handed over to this dynamic working program 3G to handle, a sorrowful sequence 3G has the most reading _, when Shooting pure police principle students 1307231 scale 3G number reaches the upper limit q of the system setting, the system new _#=^赖财--secret is difficult to make money no longer generate, program, and ^ system, When a new TCP connection request occurs, the management process is still submitted to the appropriate working program (including the static worker and the dynamic worker) according to the principle of even distribution, but the tc:: limited 'The limit number is N. When all the numbers reach N, the system will reject the new connection, which is connected to the other. ^ In addition, the system for processing TCP requests of the present invention further includes: - Socket asynchronous input /Transfer to rhyme group side to pass the SQeket asynchronous V output function to make the work private order monitor all the connections managed by it and the work processing of each of them - the system is set to touch the gamma in the mechanical environment ( Cpu frequency is low, physical memory size, hard disk speed, whether it is multi-CPU, what kind of operating system, etc.), (four) sex (four) try to determine the taste of the ideal secret d-parameter parameter value. Static 'red-turned number P , the number of connections processed by each processing program] VI, the upper limit value Q of the generated dynamic working program, and the limit value N of the connection health of each working program; and - dynamic work The process of transferring the board group is used to close the generated motion||two materials according to the current number of network connections and working conditions of the system, and the state is turned off by Laiqi in one of the following three situations: Dynamic working procedure: first In case, if there is a dynamic working program when the system is stopped, the dynamic working program is closed;
1307231 值匕括·靜態工作程序之個數P、每個工作程序處理的 =伽、生成的動態工作程序之個數的上限值Q以及每個2 乍私序所祕理的連接健之極限值N;以及—動態工作程 =驟’係用以峨統當前之網路連接數量及工作狀況,關閉 成之動紅作程序,該_工作程序釋放步驟將在下述三種 情況之一的叙下_所生成之作程序·· =種情況’系統停止時若存在_工作㈣,觸閉該動 悲工作程序, 第-種情況’動態工作程序在運行過程中,其處理之TC 接個數為G時,賴職動態工作程序;以及 第二種情況,當系統根據當前工作情況決定關某些動態工 作私序時,啦統把將要顧之祕丄擁序處理之連接交給其 它工作程序處理後,關閉該動態工作程序。其中在第二種情況下、’ 關閉動作4序之步驟進—步包括以下步驟: .一睛求步驟,係用以將關閉動態工作程序之請求發送給系 、、先’以及斷步驟’係由系統決定是否可以關閉該絲工作程 序(以防止程序生成抖動),若系統允許關閉,則關閉該動態工作 程序。 +雖然本發a㈣前迷之優選實施方式揭露如上,然其並非用以 F疋本發明。本領域的技術人貞應該意識到在*脫離本發明所附 所揭示的本發明之範圍和精神的情況下,所爲之 1307231 ^動與/閏飾’均屬本發明之專利保護細之内。關於本發明所界 疋之保護範圍請參考所附之申請專利範圍。 【圖式簡單說明】 「第1圖」爲本發明之飼服器系統之系統架構簡圖;以及 「第2圖」爲本發明之處理TCP請求之方法的部分步驟流程 圖。 【主要元件符號說明】 !〇 管理程序 20 靜態工作程序 30 動態工作程序 M每個ι作轉處理的連接她之門檻值 N每個工倾序所能處理的雜健之極限值 P 靜態工作程序之個數 Q 生成的動態工作程序之個數的上限值 步驟201系、統啓動時’啟動-管理程序和Μ固靜態工作程 序 步驟202平均分配TCP連接至各工作程序 乂驟203判斷系統當前各程序之連接個數是否達到μ 步驟204生成動態工作程序 步驟205判斷動態工作程序之個數是否達到q 、 步驟206 $再生成動&工作程序,且平均分配新連接至各 工作程序 12 1307231 步驟207判斷各工作程序之連接個數是否均達到N 步驟208拒絕新的連接接入1307231 The value includes the number of static working programs P, the = gamma processed by each work program, the upper limit value of the number of generated dynamic working programs, and the limit of the connection health of each 2 乍 private order. The value N; and - the dynamic working process = step ' is used to shut down the current number of network connections and the working status, and the program is released in the following three cases. _ generated program ·· = kind of situation 'If there is _ work (4) when the system stops, the erroneous work program is closed, the first case 'dynamic work program during the running process, the number of TCs processed is G, the dynamic work process of the Lai; and the second case, when the system decides to close certain dynamic work private orders according to the current work situation, the system will hand over the connection that will take care of the secret processing to other work programs. After that, close the dynamic worker. In the second case, the step of 'closing the action 4 step' includes the following steps: The first step is to send the request to close the dynamic working program to the system, the first 'and the first step' It is up to the system to decide whether the wire work program can be closed (to prevent the program from generating jitter), and if the system allows shutdown, the dynamic work program is closed. Although the preferred embodiment of the prior art (a) is disclosed above, it is not intended to be used in the present invention. It is to be understood by those skilled in the art that within the scope and spirit of the invention disclosed in the appended claims, the <RTI ID=0.0># </ RTI> </ RTI> </ RTI> . Please refer to the attached patent application for the scope of protection of the invention. BRIEF DESCRIPTION OF THE DRAWINGS "FIG. 1" is a schematic diagram of a system architecture of a feeding device system of the present invention; and "FIG. 2" is a partial flow chart of a method for processing a TCP request of the present invention. [Main component symbol description] !〇Management program 20 Static work program 30 Dynamic work program M Each ι is transferred to the connection of her threshold NN The limit value of the fitness that can be handled by each work order P Static work program The upper limit value of the number of dynamic working programs generated by the number Q is step 201, and the startup-management program and the tampering static working program step 202 averagely allocate TCP connections to the respective working programs 203 to determine the current system. Whether the number of connections of each program reaches μ or step 204 generates a dynamic working program. Step 205 determines whether the number of dynamic working programs reaches q, step 206 regenerates the dynamic & working program, and evenly allocates a new connection to each working program 12 1307231 Step 207: determining whether the number of connections of each working program reaches N. Step 208 rejects new connection access.
1313