Introduction

ZK was among the first Ajax frameworks to introduce a performance meter utility for monitoring Ajax applications. A performance test provides us with the knowledge of whether the application meets the performance criteria, such as server response time, or the rendering time on browsers, which helps us in determining a web application's reliability and scalability. In this Small talk, an implementation of ZK's Performance Meter interface is illustrated.

ZK's Performance Meter Interface

The PerformanceMeter interface provides timestamped information in different stages of a request. The figure below shows the stages in a request.

The interface defines five functions. Using these functions, we could get a timestamp in each stage of request cycle.

Figure: This is a graphical representation of a complete ZK request cycle.

Note: Each request has a unique id called requestId, which distinguishes one request from another.

Define time period by request stages

Server Execution time: T3 - T2

Client Execution time: T5 - T4

Network Latency time: (T4 - T3) + (T2 - T1)

Note

About request time period: when we make a connection to a page for the first time, only Server Execution time is available. The Client Execution time period is saved on the client side, which will not be made available on the server side until the data is sent to the server along with the next request.

Statistics record store on session use attribute name org.zkoss.zkdemo.monitor.PerformanceCtrl.METER_STATUS and org.zkoss.zkdemo.monitor.RequestMonitor.REQUEST