TWI704783B - Electronic device and resource health management method - Google Patents
Electronic device and resource health management method Download PDFInfo
- Publication number
- TWI704783B TWI704783B TW108105854A TW108105854A TWI704783B TW I704783 B TWI704783 B TW I704783B TW 108105854 A TW108105854 A TW 108105854A TW 108105854 A TW108105854 A TW 108105854A TW I704783 B TWI704783 B TW I704783B
- Authority
- TW
- Taiwan
- Prior art keywords
- resource
- target resource
- target
- health management
- timing data
- Prior art date
Links
Images
Abstract
Description
本發明是有關於一種管理方法,且特別是有關於一種電子裝置及其所使用的資源健康管理方法。The present invention relates to a management method, and particularly relates to an electronic device and a resource health management method used by it.
傳統上,對於網路的延遲時間的檢測,瀏覽器應用程式僅可對屬於同一網域或通訊協定的目標資源進行延遲時間的檢測。Traditionally, for the detection of network delay time, browser applications can only perform delay time detection on target resources belonging to the same network domain or communication protocol.
隨著科技的進展,目前已經逐漸開始利用HTML的圖片元素來產生對應目標資源的圖片元素實例,以針對不是屬於同一個網域或通訊協定的目標資源來進行延遲時間的檢測。也就是說,利用HTML的圖片元素的方式,可以作到跨網域/跨通訊協定的網路延遲時間檢測操作。With the development of science and technology, HTML image elements have been gradually used to generate image element instances corresponding to target resources to detect the delay time of target resources that do not belong to the same network domain or communication protocol. In other words, by using HTML picture elements, cross-domain/cross-protocol network delay time detection operations can be performed.
然而,當目標資源不為圖片檔案時,載入上述的圖片元素實例會導致錯誤的發生,而使得網路延遲時間檢測操作失敗。However, when the target resource is not a picture file, loading the above-mentioned picture element instance will cause an error to occur, and the network delay time detection operation will fail.
基此,要如何有效地利用對應目標資源的圖片元素實例來作到跨網域/跨通訊協定的網路延遲時間檢測操作且可有效且精確地辨識目標資源的健康狀態,為本領域人員致力發展的目標之一。Based on this, how to effectively use the image element instance corresponding to the target resource to perform the cross-domain/cross-protocol network delay time detection operation and to effectively and accurately identify the health status of the target resource is dedicated to those in the field One of the goals of development.
“先前技術”段落只是用來幫助了解本發明內容,因此在“先前技術”段落所揭露的內容可能包含一些沒有構成所屬技術領域中具有通常知識者所知道的習知技術。在“先前技術”段落所揭露的內容,不代表該內容或者本發明一個或多個實施例所要解決的問題,在本發明申請前已被所屬技術領域中具有通常知識者所知曉或認知。The "prior art" paragraph is only used to help understand the content of the present invention. Therefore, the content disclosed in the "prior art" paragraph may contain some conventional technologies that do not constitute the common knowledge in the technical field. The content disclosed in the "prior art" paragraph does not represent the content or the problem to be solved by one or more embodiments of the present invention, and has been known or recognized by those with ordinary knowledge in the technical field before the application of the present invention.
本發明提供一種電子裝置與其所使用的資源健康管理方法,可有效地檢測目標資源是否健康,以對健康或不健康的資源進行後續的操作。The present invention provides an electronic device and a resource health management method used by it, which can effectively detect whether a target resource is healthy, so as to perform follow-up operations on healthy or unhealthy resources.
本發明的一實施例提供一種電子裝置。所述電子裝置包括儲存單元、通訊單元以及處理器。所述儲存單元用以儲存資料。所述通訊單元用以建立網路連線。所述處理器耦接至所述儲存單元與所述通訊單元。所述處理器用以載入且執行一瀏覽器應用程式,並且更用以載入且執行一資源健康管理模組,以實現一資源健康管理方法。其中,所述資源健康管理模組用以根據一目標資源位址產生對應一目標資源的一圖片元素實例,並且根據所述圖片元素實例來經由所述網路連線載入所述目標資源。所述資源健康管理模組更用以判斷是否發生對應所述目標資源的onLoad事件或onError事件。反應於判定發生對應所述目標資源的所述onLoad事件,所述資源健康管理模組更用以記錄所述目標資源為一健康狀態。此外,反應於判定發生對應所述目標資源的所述onError事件,所述資源健康管理模組更用以根據所述目標資源的所述資源計時資料判斷所述目標資源為健康或不健康。其中,反應於判定所述目標資源為不健康,所述資源健康管理模組更用以記錄所述目標資源為一不健康狀態。反應於判定所述目標資源為健康,所述資源健康管理模組更用以記錄所述目標資源為所述健康狀態。An embodiment of the present invention provides an electronic device. The electronic device includes a storage unit, a communication unit and a processor. The storage unit is used for storing data. The communication unit is used to establish a network connection. The processor is coupled to the storage unit and the communication unit. The processor is used to load and execute a browser application program, and is further used to load and execute a resource health management module to implement a resource health management method. The resource health management module is used to generate a picture element instance corresponding to a target resource according to a target resource address, and load the target resource via the network connection according to the picture element instance. The resource health management module is further used to determine whether an onLoad event or an onError event corresponding to the target resource occurs. In response to determining that the onLoad event corresponding to the target resource occurs, the resource health management module is further configured to record that the target resource is in a health state. In addition, in response to determining that the onError event corresponding to the target resource occurs, the resource health management module is further configured to determine whether the target resource is healthy or unhealthy according to the resource timing data of the target resource. Wherein, in response to determining that the target resource is unhealthy, the resource health management module is further configured to record that the target resource is in an unhealthy state. In response to determining that the target resource is healthy, the resource health management module is further configured to record that the target resource is in the health state.
本發明的一實施例一種資源健康管理方法,適用於一電子裝置,其中所述電子裝置已建立一網路連線,並且已執行一瀏覽器應用程式。所述方法包括:根據一目標資源位址產生對應一目標資源的一圖片元素實例,並且根據所述圖片元素實例來經由所述網路連線載入所述目標資源;判斷是否發生對應所述目標資源的onLoad事件或onError事件;反應於判定發生對應所述目標資源的所述onLoad事件,記錄所述目標資源為一健康狀態;反應於判定發生對應所述目標資源的所述onError事件,根據所述目標資源的所述資源計時資料判斷所述目標資源為健康或不健康;反應於判定所述目標資源為不健康,記錄所述目標資源為一不健康狀態;以及反應於判定所述目標資源為健康,記錄所述目標資源為所述健康狀態。An embodiment of the present invention is a resource health management method, which is applicable to an electronic device, wherein the electronic device has established a network connection and has executed a browser application. The method includes: generating a picture element instance corresponding to a target resource according to a target resource address, and loading the target resource via the network connection according to the picture element instance; determining whether the corresponding The onLoad event or onError event of the target resource; in response to determining that the onLoad event corresponding to the target resource occurs, recording the target resource as a healthy state; in response to determining that the onError event corresponding to the target resource occurs, according to The resource timing data of the target resource determines whether the target resource is healthy or unhealthy; in response to determining that the target resource is unhealthy, recording the target resource as an unhealthy state; and in response to determining that the target resource is healthy To record the target resource as the health state.
基於上述,本發明的實施例所提供的電子裝置與資源健康管理方法,可經由跨網域及跨通訊協定的對應目標資源的圖片元素實例來載入所述目標資源,並且對應所載入的所述目標事件的onLoad事件、onError事件及資源計時資料來判斷所述目標資源是否健康,以對健康或不健康的所述目標資源進行對應的後續處理,進而可拓展且有效率地處理跨網域與跨通訊協定的所述目標資源的健康狀態的判斷。Based on the above, the electronic device and resource health management method provided by the embodiments of the present invention can load the target resource through the image element instance corresponding to the target resource across network domains and cross communication protocols, and correspond to the loaded The onLoad event, onError event, and resource timing data of the target event are used to determine whether the target resource is healthy, so as to perform corresponding follow-up processing on the healthy or unhealthy target resource, which can expand and efficiently process cross-domain Judging the health status of the target resource with the cross-communication protocol.
為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, the following specific embodiments are described in detail in conjunction with the accompanying drawings.
有關本發明之前述及其他技術內容、特點與功效,在以下配合參考圖式之一較佳實施例的詳細說明中,將可清楚的呈現。以下實施例中所提到的方向用語,例如:上、下、左、右、前或後等,僅是參考附加圖式的方向。因此,使用的方向用語是用來說明並非用來限制本發明。The foregoing and other technical content, features and effects of the present invention will be clearly presented in the following detailed description of a preferred embodiment with reference to the drawings. The directional terms mentioned in the following embodiments, for example: up, down, left, right, front or back, etc., are only directions for referring to the attached drawings. Therefore, the directional terms used are used to illustrate but not to limit the present invention.
圖1A是根據本發明的一實施例所繪示的電子裝置的方塊示意圖。請參照圖1A,在本實施例中,電子裝置10包括處理器110、輸入/輸出單元120、主記憶體130、儲存單元140及通訊單元150。處理單元110耦接至輸入/輸出單元120、主記憶體130、儲存單元140及通訊單元150。FIG. 1A is a schematic block diagram of an electronic device according to an embodiment of the invention. 1A, in this embodiment, the
處理器110為具備運算能力的硬體(例如晶片組、處理器等),用以管理電子裝置10的整體運作。在本實施例中,處理器110,例如是一核心或多核心的中央處理單元(Central Processing Unit,CPU)、微處理器(micro-processor)、或是其他可程式化之處理單元(Programmable processor)、數位訊號處理器(Digital Signal Processor,DSP)、可程式化控制器、特殊應用積體電路(Application Specific Integrated Circuits,ASIC)、可程式化邏輯裝置(Programmable Logic Device,PLD)或其他類似裝置。The
輸入/輸出單元120用以接收使用者的輸入操作,以及輸出影像。輸入/輸出單元120例如是觸控螢幕。The input/
主記憶體130用以接收處理器110的指示來暫存資料。主記憶體130例如是任意形式的固定式或可移動式隨機存取記憶體(random access memory,RAM)或其他類似裝置、積體電路及其組合。The
儲存單元140耦接至處理器110。儲存單元140可記錄一些需要長時間儲存的資料。例如,用以運行電子裝置的韌體、作業系統或多種應用程式(如,瀏覽器應用程式)。儲存單元140例如是任何形式的非揮發性記憶體(如,硬碟、固態硬碟、快閃記憶體模組)或其他類似的裝置、積體電路及其組合。The
通訊單元150用以透過無線通訊的方式來傳輸或是接收資料。在本實施例中,通訊單元150可具有一無線通訊模組(未繪示),並支援全球行動通信(Global System for Mobile Communication,GSM)系統、個人手持式電話系統(Personal Handy-phone System,PHS)、碼多重擷取(Code Division Multiple Access,CDMA)系統、無線相容認證(Wireless Fidelity,WiFi)系統、全球互通微波存取(Worldwide Interoperability for Microwave Access,WiMAX)系統、第三代無線通信技術(3G)、第四代無線通信技術(4G)、第五代無線通信技術(5G)、長期演進技術(Long Term Evolution, LTE)、藍芽(bluetooth)通訊技術的其中之一或其組合,且不限於此。The
除此之外,通訊單元150也可具有一有線通訊模組(如,網路介面卡),並透過有線通訊的方式來傳輸或是接收資料。另外,在本實施例中,通訊單元150亦可建立網路連線,以使所述電子裝置10可連接至網際網路或區域網路。應注意的是,在本實施例中,通訊單元150可根據處理器110的指示建立網路連線至伺服器,從所述伺服器下載資源管理模組,並且將所述資源管理模組儲存至所述儲存單元140中。所述資源管理模組為一種程式碼模組。在本實施例中,處理器110用以存取且執行所述作業系統、瀏覽器應用程式於主記憶體130中,以運行對應所述作業系統、瀏覽器應用程式的功能。此外,所述處理器110更用以存取且執行所述資源管理模組於所述主記憶體130中,以實現本實施例所提供的資源管理方法,其中所述資源管理模組更被載入至執行中的所述瀏覽器應用程式中。以下利用多個圖式來說明。In addition, the
圖1B是根據本發明的一實施例所繪示的瀏覽器應用程式與資源健康管理模組的方塊示意圖。FIG. 1B is a block diagram of a browser application and a resource health management module according to an embodiment of the invention.
請先參照圖1B,再本實施例中,瀏覽器應用程式20包括多個程式碼模組,如,超文本標記語言(HyperText Markup Language,HTML)元素模組210(亦稱,HTML元素模組)、資源計時(Performance Resource Timing)模組220與資源計時應用編程介面(Performance Resource Timing API)230、瀏覽器資料庫250。在圖1B中,所述瀏覽器應用程式20已經載入且運行資源健康管理模組240。Please refer to FIG. 1B. In this embodiment, the
所述HTML元素模組210用以管理且執行多種HTML元素(如,圖片元素 “<img />”、段落元素 “<p> </p>”等等…)的規範與功能。所述多種HTML元素的具體細節並非本實施例所專注的技術方案,不贅述於此。The HTML
資源計時模組220用以產生且記錄對應所運行的HTML元素的程序的資源計時資料(亦稱,資源計時物件)。The
資源計時應用編程介面(Performance Resource Timing API)230為全球資訊網協會(World Wide Web Consortium,W3C)所規範的面向網頁應用程式的介面,可實施於現代的瀏覽器應用程式(如,Chrome、FireFox、Edge等..)中。可透過所述資源計時應用編程介面230來查詢瀏覽器應用程式已經處理/加載的資源的資源計時資料。The Performance Resource Timing API 230 is a web application-oriented interface specified by the World Wide Web Consortium (W3C). It can be implemented in modern browser applications (such as Chrome, FireFox). , Edge, etc...). The resource timing data of the resources processed/loaded by the browser application can be queried through the resource timing
瀏覽器資料庫250用以記錄瀏覽器應用程式的管理資訊(如,對應所載入目標資源的資源計時資料或健康狀態)或記錄檔(Log)。The
另一方面,資源健康管理模組240包括HTML圖片元素實例產生模組241、onLoad事件傾聽模組242、onError事件傾聽模組243、資源健康判斷模組244、健康資源管理模組246、不健康資源管理模組247。以下會進一步利用圖2、圖3來說明資源健康管理模組240及資源健康管理模組240各部件的互動。應注意的是,資源健康管理模組240的各部件的運作亦可視為資源健康管理模組240的整體運作。On the other hand, the resource
圖2是根據本發明的一實施例所繪示的資源健康管理方法的流程圖。Fig. 2 is a flowchart of a resource health management method according to an embodiment of the present invention.
請參照圖2,在步驟S21中,HTML圖片元素實例產生模組241根據一目標資源位址產生對應一目標資源的圖片元素實例,並且根據所述圖片元素實例來經由網路連線載入所述目標資源。所述目標資源位址可預先被設定於HTML圖片元素實例產生模組241中或是瀏覽器資料庫250中。所述目標資源位址例如是所述資源的網路位址,並且所述瀏覽器應用程式20可根據目標資源位址下載所述目標資源。目前電子裝置10所連接之網路的網域可不相同於所述目標資源的網域;瀏覽器應用程式20所使用的通訊協定可不相同於所述目標資源位址的通訊協定。在此,所述通訊協定包括超文本傳輸安全協定(Hypertext Transfer Protocol Secure,HTTPS)與超文本傳輸協定(HyperText Transfer Protocol,HTTP)。Referring to FIG. 2, in step S21, the HTML picture element
更具體來說,HTML圖片元素實例產生模組241可在辨識目標資源位址後,經由HTML元素模組,使用HTML圖片元素(即,“<img />”)來包裝所述目標資源位址,以成為包含目標資源位址的一個HTML圖片元素實例(Embodiment or Instance)。接著,瀏覽器應用程式20(如,HTML元素模組210)可根據所述HTML圖片元素實例於對應的目標資源位址去加載所述目標資源,並且回傳對應的結果給HTML圖片元素實例產生模組241。所述結果包括onLoad事件或onError事件。More specifically, the HTML picture element
接著,在步驟S22中,資源健康管理模組240判斷是否發生對應所述目標資源的onLoad事件或onError事件。Next, in step S22, the resource
具體來說,資源健康管理模組240的onLoad事件傾聽模組242用以傾聽經由加載所述目標資源的程序而發生的onLoad事件;資源健康管理模組240的onError事件傾聽模組243用以傾聽經由加載所述目標資源的程序而發生的onError事件。Specifically, the onLoad
換言之,若經由加載所述目標資源的程序發生了onLoad事件,onLoad事件傾聽模組242可傾聽到所述onLoad事件,並且呼叫資源健康判斷模組244,以使資源健康判斷模組244判定發生所述onLoad事件;若經由加載所述目標資源的程序發生了onError事件,onError事件傾聽模組243可傾聽到所述onError事件,並且呼叫資源健康判斷模組244,以使資源健康判斷模組244判定發生所述onError事件。In other words, if an onLoad event occurs through the program that loads the target resource, the onLoad
反應於判定發生所述onLoad事件,執行步驟S26;反應於判定發生所述onError事件,執行步驟S23。In response to determining that the onLoad event occurs, step S26 is executed; in response to determining that the onError event occurs, step S23 is executed.
在本實施例中,若所述目標資源為圖片檔案,則在預定時間內下載所述圖片檔案後,所述瀏覽器應用程式20會回傳用以表示onLoad事件的結果給資源健康管理模組240。此外,在下列條件下,所述瀏覽器應用程式20會回傳用以表示onError事件的結果給資源健康管理模組240:(1) 所述目標資源並非圖片檔案;(2) 無法在所述預定時間內下載所述目標資源;(3)所述目標資源不存在。In this embodiment, if the target resource is a picture file, after downloading the picture file within a predetermined time, the
應注意的是,有關onLoad事件與onError事件的發生條件為本領域人員熟知之技術,不贅述於此。It should be noted that the occurrence conditions of the onLoad event and the onError event are technologies well known to those skilled in the art and will not be repeated here.
在步驟S23中,資源健康判斷模組244經由資源計時應用編程介面230查找所述目標資源的資源計時資料。具體來說,為了更明確地辨識發生onError事件的條件為上述三個條件的其中之一,資源健康判斷模組244會發送對應所述目標資源的查詢請求給資源計時應用編程介面230,以嘗試查詢對應所述目標資源的資源計時資料。資源計時應用編程介面230接收到所述查詢請求後,資源計時應用編程介面230會利用資源計時模組220來查找是否存在有對應所述目標資源的資源計時資料。In step S23, the resource
此外,資源健康判斷模組244更可經由資源計時應用編程介面230來辨識所述目標資源的所述資源計時資料的多個屬性所對應的多個值。In addition, the resource
圖4是根據本發明的一實施例所繪示的資源計時應用編程介面的多個屬性的示意圖。FIG. 4 is a schematic diagram of multiple attributes of a resource timing application programming interface according to an embodiment of the present invention.
請參照圖4,在本實施例中,經由W3C所規範的所述資源計時應用編程介面230的多個屬性如元件C400所示。所述多個屬性的多個值用以記錄在加載所述目標資源的過程中的多個時間點。舉例來說,當利用包含所述目標資源的HTML圖片元素實例來加載所述目標資源後,資源計時模組220可產生對應所述目標資源的資源計時資料245(亦稱,資源計時物件)。所述資源計時資料可包括所述目標資源位址、請求起始時間以及回傳結束時間等資料。此時,所述資源計時應用編程介面230可將所查找到的所述資源計時資料245回傳給資源健康判斷模組244,以回應所述資源健康判斷模組244的查詢請求。Referring to FIG. 4, in this embodiment, the multiple attributes of the resource timing
另一方面,當所述目標資源位址並不存在所述目標資源(如,HTTP狀態碼為4XX)或所述目標資源發生錯誤(如,HTTP狀態碼為5XX),資源計時模組220便不會產生對應所述目標資源的資源計時資料,並且所述資源計時應用編程介面230不會回傳所述資源計時資料245(例如,Google Chrome瀏覽器)。On the other hand, when the target resource does not exist at the target resource address (for example, the HTTP status code is 4XX) or the target resource has an error (for example, the HTTP status code is 5XX), the
然而,在另一實施例中,所述目標資源位址並不存在所述目標資源(如,HTTP狀態碼為4XX)或所述目標資源發生錯誤(如,HTTP狀態碼為5XX),資源計時模組220仍然會產生對應所述目標資源的資源計時資料,並且所述資源計時應用編程介面230可回傳所述資源計時資料245(例如,FireFox瀏覽器與Edge瀏覽器)。但,在此另一實施例中,對應HTTP狀態碼為4XX或所HTTP狀態碼為5XX的資源計時資料的目標屬性的值並非正常值(如,所述目標屬性的值為空(NULL))。However, in another embodiment, the target resource does not exist at the target resource address (for example, the HTTP status code is 4XX) or an error occurs in the target resource (for example, the HTTP status code is 5XX), resource timing The
在步驟S24中,資源健康管理模組240根據所述目標資源的所述資源計時資料判斷所述目標資源為健康或不健康。以下利用圖3來說明。In step S24, the resource
圖3是根據本發明的一實施例所繪示的圖2的步驟S24的流程圖。請參照圖3,在步驟S241中,資源健康管理模組240判斷所述目標資源的所述資源計時資料是否存在。反應於判定所述目標資源的所述資源計時資料存在(S241à是),執行步驟S242;反應於判定所述目標資源的所述資源計時資料不存在(S241à否),執行步驟S244。FIG. 3 is a flowchart of step S24 in FIG. 2 according to an embodiment of the present invention. Referring to FIG. 3, in step S241, the resource
如上述,若判定存在所述資源計時資料,資源健康管理模組240會判斷所述目標資源的所述資源計時資料中對應目標屬性的值是否等於正常值(是否為正常值)。其中所述資源計時資料的所述目標屬性包括“nextHopProtocol”屬性或“ResponseCode”屬性。此外,對應所述“nextHopProtocol”屬性的正常值例如是“h2” 或是“http/1.1”等等;對應所述“ResponseCode”屬性的正常值例如是“2XX”(X為正整數或零)。即,對應所述“ResponseCode”屬性的正常值可具有一個範圍,如,“200~299”。例如,假設對應所述“nextHopProtocol”屬性的值為空,資源健康管理模組240會判定對應所述“nextHopProtocol”屬性的值不等於對應的正常值,並且接續至步驟S244,資源健康管理模組240會判定所述目標資源為不健康(Not healthy)。又例如,在所述目標資源並非圖片檔案而發生onError事件,但對應的資源計時資料具有為正常值的所述“nextHopProtocol”屬性的情況下,資源健康管理模組240會判定所述目標資源為健康(S243)。As described above, if it is determined that the resource timing data exists, the resource
又例如,假設對應所述“ResponseCode”屬性的值為“2XX”,資源健康管理模組240會判定對應所述“ResponseCode”屬性的值為正常值,並且接續至步驟S243,資源健康管理模組240會判定所述目標資源為健康(healthy)。For another example, assuming that the value corresponding to the "ResponseCode" attribute is "2XX", the resource
此外,若判定不存在所述資源計時資料,資源健康管理模組240可直接判定所述目標資源為不健康(步驟S244)。In addition, if it is determined that the resource timing data does not exist, the resource
請再回到圖2,在本實施例中,反應於判定所述目標資源為健康(S24à健康),執行步驟S26;反應於判定所述目標資源為不健康(S24à不健康),執行步驟S25。Please return to FIG. 2. In this embodiment, in response to determining that the target resource is healthy (S24→healthy), step S26 is performed; in response to determining that the target resource is unhealthy (S24→unhealthy), step S25 is performed.
在步驟S25中,資源健康管理模組240記錄所述目標資源為不健康狀態。具體來說,反應於判定所述目標資源為不健康,資源健康判斷模組244會呼叫不健康資源管理模組246,並且不健康資源管理模組246可記錄所述目標資源為不健康狀態。此外,所述不健康資源管理模組246更可記錄所述目標資源位址、當前的系統時間、用戶地理位置等其他適合的資訊,以使資源健康管理模組240或瀏覽器應用程式20可進行對應的後續的處理。例如,瀏覽器應用程式20或不健康資源管理模組246可回報一錯誤訊息,以表示所述目標資源為不健康狀態。此外,在一實施例中,資源健康管理模組240更可根據被辨識為不健康狀態的目標資源的位址與用戶地理位置,來統計各個用戶地理位置所使用的服務的穩定性。In step S25, the resource
此外,在步驟S26中,資源健康管理模組240記錄所述目標資源為健康狀態。更具體來說,反應於判定所述目標資源為健康,資源健康判斷模組244會呼叫健康資源管理模組245,並且健康資源管理模組245可記錄所述目標資源為健康狀態。此外,所述健康資源管理模組246更可記錄所述目標資源位址、當前的系統時間等其他適合的資訊。特別是,所述健康資源管理模組246可利用為健康狀態的所述目標資源的所述資源計時資料來計算用以下載所述目標資源的延遲時間。例如,所述健康資源管理模組246可利用為健康狀態的所述目標資源的所述資源計時資料中的請求起始時間以及回傳結束時間來計算所述請求起始時間以及所述回傳結束時間之間的差值,以作為所述延遲時間。In addition, in step S26, the resource
值得一提的是,如上述,在所述目標資源並非圖片檔案而發生onError事件,一般的傳統作法會直接回應onError事件發生,而導致無法進一步地根據所述目標資源的資源計時資料來計算延遲時間。但,本發明的實施例,可進一步去根據判斷已存在的資源計時資料中的目標屬性是否為(或等於)正常值來判斷所述目標資源是否為健康,進而可利用為健康狀態的目標資源的資源計時資料來計算延遲時間。如此一來,本發明的實施例可明顯地改善利用包含目標資源位址的HTML圖片元素實例來獲得延遲時間所導致的問題,同時又可保留HTML圖片元素的跨網域及跨通訊協定的特性,進而加強了對於目標資源的健康狀態與延遲時間的判斷效率,而增進了整體電子裝置的工作效率。It is worth mentioning that, as mentioned above, when the onError event occurs when the target resource is not a picture file, the general traditional method will directly respond to the occurrence of the onError event, which makes it impossible to further calculate the delay based on the resource timing data of the target resource. time. However, the embodiments of the present invention can further determine whether the target resource is healthy according to whether the target attribute in the existing resource timing data is (or equal to) a normal value, and then can be used as a healthy target resource The resource timing data is used to calculate the delay time. In this way, the embodiments of the present invention can significantly improve the problem caused by the delay time obtained by using the HTML picture element instance containing the target resource address, while retaining the cross-domain and cross-communication characteristics of the HTML picture element. , Thereby enhancing the efficiency of judging the health status and delay time of the target resource, and improving the work efficiency of the overall electronic device.
綜上所述,本發明的實施例所提供的電子裝置與資源健康管理方法,可經由跨網域及跨通訊協定的對應目標資源的圖片元素實例來載入所述目標資源,並且對應所載入的所述目標事件的onLoad事件、onError事件及資源計時資料來判斷所述目標資源是否健康,以對健康或不健康的所述目標資源進行對應的後續處理,進而可拓展且有效率地處理跨網域與跨通訊協定的所述目標資源的健康狀態的判斷。In summary, the electronic device and resource health management method provided by the embodiments of the present invention can load the target resource through the image element instance corresponding to the target resource across network domains and cross communication protocols, and correspond to the loaded target resource. The input onLoad event, onError event and resource timing data of the target event are used to determine whether the target resource is healthy, so as to perform corresponding follow-up processing on the healthy or unhealthy target resource, which can be expanded and efficiently processed across Judgment of the health status of the target resource between the network domain and the cross communication protocol.
雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。Although the present invention has been disclosed in the above embodiments, it is not intended to limit the present invention. Anyone with ordinary knowledge in the technical field can make some changes and modifications without departing from the spirit and scope of the present invention. The scope of protection of the present invention shall be determined by the scope of the attached patent application.
10:電子裝置 110:處理器 120:輸入/輸出單元 130:主記憶體 140:儲存單元 150:通訊單元 20:瀏覽器應用程式 210:HTML元素模組 220:資源計時模組 230:資源計時應用編程介面 240:資源健康管理模組 241:HTML圖片元素實例產生模組 242:onLoad事件傾聽模組 243:onError事件傾聽模組 244:資源健康判斷模組 245:健康資源管理模組 246:不健康資源管理模組 250:瀏覽器資料庫 S21、S22、S23、S24、S25、S26:資源健康管理方法的流程步驟 S241、S242、S243、S244:步驟S24的流程步驟 C400:資源計時應用編程介面的多種屬性的示例性程式碼 10: Electronic device 110: Processor 120: input/output unit 130: main memory 140: storage unit 150: Communication unit 20: Browser application 210: HTML element module 220: Resource Timing Module 230: Resource Timing Application Programming Interface 240: Resource Health Management Module 241: HTML picture element instance generation module 242: onLoad event listening module 243: onError event listening module 244: Resource Health Judgment Module 245: Health Resource Management Module 246: Unhealthy Resource Management Module 250: Browser database S21, S22, S23, S24, S25, S26: Process steps of resource health management methods S241, S242, S243, S244: the flow steps of step S24 C400: Exemplary code for various attributes of resource timing application programming interface
圖1A是根據本發明的一實施例所繪示的電子裝置的方塊示意圖。 圖1B是根據本發明的一實施例所繪示的瀏覽器應用程式與資源健康管理模組的方塊示意圖。 圖2是根據本發明的一實施例所繪示的資源健康管理方法的流程圖。 圖3是根據本發明的一實施例所繪示的圖2的步驟S24的流程圖。 圖4是根據本發明的一實施例所繪示的資源計時應用編程介面的多個屬性的示意圖。 FIG. 1A is a schematic block diagram of an electronic device according to an embodiment of the invention. FIG. 1B is a block diagram of a browser application and a resource health management module according to an embodiment of the invention. Fig. 2 is a flowchart of a resource health management method according to an embodiment of the present invention. FIG. 3 is a flowchart of step S24 in FIG. 2 according to an embodiment of the present invention. FIG. 4 is a schematic diagram of multiple attributes of a resource timing application programming interface according to an embodiment of the present invention.
S21、S22、S23、S24、S25、S26:資源健康管理方法的流程步驟S21, S22, S23, S24, S25, S26: Process steps of resource health management methods
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW108105854A TWI704783B (en) | 2019-02-21 | 2019-02-21 | Electronic device and resource health management method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW108105854A TWI704783B (en) | 2019-02-21 | 2019-02-21 | Electronic device and resource health management method |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202032947A TW202032947A (en) | 2020-09-01 |
TWI704783B true TWI704783B (en) | 2020-09-11 |
Family
ID=73643769
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW108105854A TWI704783B (en) | 2019-02-21 | 2019-02-21 | Electronic device and resource health management method |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI704783B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6438592B1 (en) * | 1998-02-25 | 2002-08-20 | Michael G. Killian | Systems for monitoring and improving performance on the world wide web |
-
2019
- 2019-02-21 TW TW108105854A patent/TWI704783B/en active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6438592B1 (en) * | 1998-02-25 | 2002-08-20 | Michael G. Killian | Systems for monitoring and improving performance on the world wide web |
Also Published As
Publication number | Publication date |
---|---|
TW202032947A (en) | 2020-09-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017028697A1 (en) | Method and device for growing or shrinking computer cluster | |
JP6876806B2 (en) | Blockchain Consensus Formation Methods and Devices | |
CN108664613B (en) | Data query method and device, computer equipment and storage medium | |
WO2019029457A1 (en) | Method and apparatus for updating application program on client, and electronic device | |
TWI622933B (en) | Client update method and device | |
CN110888889B (en) | Data information updating method, device and equipment | |
TW201711432A (en) | Method and equipment making health check of server characterized in that the health check times are reduced and the burden on the server caused by the health check is relieved | |
US10503613B1 (en) | Efficient serving of resources during server unavailability | |
JP5934445B2 (en) | Adaptive service timeout | |
US10158543B2 (en) | Method of estimating round-trip time (RTT) in content-centric network (CCN) | |
EP3817333B1 (en) | Method and system for processing requests in a consortium blockchain | |
US10831565B2 (en) | Fault tolerant adapter system to consume database as a service | |
CN110162270B (en) | Data storage method, storage node and medium based on distributed storage system | |
CN104239156A (en) | External service call method and system | |
CN111159219B (en) | Data management method, device, server and storage medium | |
CN108089972B (en) | Interface test method and device | |
CN109901991B (en) | Method and device for analyzing abnormal call and electronic equipment | |
WO2016197853A1 (en) | Complexity-based service processing method and apparatus | |
CN108920326B (en) | Method and device for determining time-consuming abnormity of system and electronic equipment | |
TWI704783B (en) | Electronic device and resource health management method | |
CN110955460B (en) | Service process starting method and device, electronic equipment and storage medium | |
US20230327965A1 (en) | Computer network architecture mapping using metadata | |
CN103885877A (en) | Method and device for generating simulation browser testing script of HTTP | |
WO2023134247A1 (en) | Container management method and container management system | |
CN110930253A (en) | Intelligent contract internal main key generation method and device, computer equipment and storage medium |