Calculating Latenciy in java and database
calculating latencies , for a program , query or an service / project .,
after little research here i am deriving mechanism to calculate latencies,
first iam considering database : here my aim is calculate execution time for
a query.
>before executing the query run ‘set timing on’ comamnd in sql command line
>after this for every query execution we can find query execution time at the end of the
query result.
note: here i tested with Timesten database.,
> next thing calculating latency by Java.
here i am using simple logic is finding the difference between start and timings for
a execution of group of stetements / statement.
first iam reading the current system time in milliseconds before and after the execution of a particular task.
here is a sample code…
long start=System.currentTimeMillis();
/*
my service statements
*/
long end=System.currentTimeMillis();
long latencie = end-start;
System.out.println(“latency for service statements = “+latencie);
that’s it ! we have done with calculating latenciy .
