Performance Meters"
From Documentation
Line 25: | Line 25: | ||
== Request a ZUL == | == Request a ZUL == | ||
If load a zul 3 times: | If load a zul 3 times: | ||
− | <syntaxhighlight lang=' | + | <syntaxhighlight lang='properties'> |
# first load zul | # first load zul | ||
requestId1st - requestStartAtServer | requestId1st - requestStartAtServer | ||
Line 42: | Line 42: | ||
requestId3rd - requestCompleteAtServer | requestId3rd - requestCompleteAtServer | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | == Send AU Requests== | ||
+ | |||
+ | <syntaxhighlight lang='properties' highlight='4'> | ||
+ | # 1st au | ||
+ | requestId - requestReceiveAtClient | ||
+ | requestId - requestCompleteAtClient | ||
+ | requestId-0 - requestStartAtClient | ||
+ | requestId-0 - requestStartAtServer | ||
+ | requestId-0 - requestCompleteAtServer | ||
+ | |||
+ | # 2nd au | ||
+ | requestId-0 - requestReceiveAtClient | ||
+ | requestId-0 - requestCompleteAtClient | ||
+ | requestId-1 - requestStartAtClient | ||
+ | requestId-1 - requestStartAtServer | ||
+ | requestId-1 - requestCompleteAtServer | ||
+ | </syntaxhighlight> | ||
+ | * only when sending au request, zk calls <code>requestStartAtClient()</code> | ||
= Register as a Listener = | = Register as a Listener = |
Revision as of 07:18, 8 July 2022
PerformanceMeter is a collection of callbacks that the implementation could know when a request is sent, arrives or is is processed.
As shown above, T1-T5 identifies the following callbacks.
- T1: PerformanceMeter.requestStartAtClient (String, Execution, long)
- T2: PerformanceMeter.requestStartAtServer(String, Execution, long)
- T3: PerformanceMeter.requestCompleteAtServer(String, Execution, long)
- T4: PerformanceMeter.requestReceiveAtClient(String, Execution, long)
- T5: PerformanceMeter.requestCompleteAtClient(String, Execution, long)
Thus,
- Server Execution Time: T3 - T2
- Client Execution Time: T5 - T4
- Network Latency Time: (T4 - T3) + (T2 - T1)
How it works
Notice that, when we make a connection to load a page for the first time, only Server Execution Time is available. T4 and T5 will be saved on the client-side and sent back along with the next request.
If you print the request ID and the method name, when zk calls a performance monitor. You will see a different log between loading a zul and sending an AU request.
Request a ZUL
If load a zul 3 times:
# first load zul
requestId1st - requestStartAtServer
requestId1st - requestCompleteAtServer
# 2nd load zul
requestId1st - requestReceiveAtClient
requestId1st - requestCompleteAtClient
requestId2nd - requestStartAtServer
requestId2nd - requestCompleteAtServer
# 3rd load zul
requestId2nd - requestReceiveAtClient
requestId2nd - requestCompleteAtClient
requestId3rd - requestStartAtServer
requestId3rd - requestCompleteAtServer
Send AU Requests
# 1st au
requestId - requestReceiveAtClient
requestId - requestCompleteAtClient
requestId-0 - requestStartAtClient
requestId-0 - requestStartAtServer
requestId-0 - requestCompleteAtServer
# 2nd au
requestId-0 - requestReceiveAtClient
requestId-0 - requestCompleteAtClient
requestId-1 - requestStartAtClient
requestId-1 - requestStartAtServer
requestId-1 - requestCompleteAtServer
- only when sending au request, zk calls
requestStartAtClient()
Register as a Listener
Once implemented, you need to register it as a listener in WEB-INF/zk.xml
to make it work: (assume the class is called foo.MyMeter):
<listener>
<listener-class>foo.MyMeter</listener-class>
</listener>