GWT:how to measure client performance & info sent to server in case of dealling with hudge data to be showed correctly in the client side dynamically
i m using rpc using event-source, i need to push huge data to the client side and measure the performance and send back the information to the server side for adjusting the delay time(of event source rpc) according to the measured info. How to measure the client performance. How to make buffer in client side so that in client side it can smoothly show the data (eg. array values in graph (x,y) (x1,y1)开发者_如何学JAVA..) and hold some data in its buffer.
What you are basically doing is measuring the network delay and delay of rendering the received data to display. So basically you have two variables here and you have to measure each of them. This is what I'd do:
- Client requests data.
- Server replies with data and adds a server timestamp to it.
- When client finishes receiving data it creates it's own client timestamp with
new Date().getTime()
. - Than client starts rendering received data to the screen.
- When done it creates a new timestamp and subtracts previous client timestamp: it gets the rendering time.
- The immediately sends another request to server (not a normal data request, but special measuring-only request) and adds rendering time and server timestamp to it. Server gets the data: previous server timestamp and client rendering delay.
Now it can calculate the network delay (current server timestamp - starting server timestamp - rendering delay)/2.
The adjustment delay that you are looking for is network delay + rendering delay.
I guess you are optimizing your code at development phase. In that case, you should use browser tools to measure RPC calls, HTML parsing and CSS rendering like Speed Tracer.
If your issue appears randomly depending of the data loaded on your production system, you have to instrument JavaScript code manually or thanks to the gwt-measure toolkit or dynatrace AJAX.
精彩评论