| | | | |

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 .


Similar Posts

  • | |

    Read RSS feeds using JSP

    <%@page contentType=”text/html”%> <%@page pageEncoding=”UTF-8″%> <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <%@page import=”java.net.URL”%> <%@page import=”javax.xml.parsers.DocumentBuilder”%> <%@page import=”javax.xml.parsers.DocumentBuilderFactory”%> <%@page import=” org.w3c.dom.CharacterData”%> <%@page import=” org.w3c.dom.Document”%> <%@page import=”org.w3c.dom.Element”%> <%@page import=”org.w3c.dom.Node”%> <%@page import=”org.w3c.dom.NodeList”%> <%@page import=”java.lang.*”%> <% String desc=null; try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); URL u = new URL(“http://feed43.com/eenadu.xml”);   // feed address Document doc = builder.parse(u.openStream()); String title;…

  • Java 11 Features & Changes

    Dynamic class-file constants Epsilon: a no-op garbage collector Local-variable syntax for lambda parameters Low-overhead heap profiling HTTP client (standard) Transport layer security (TLS) 1.3 Flight recorder ZGC: a scalable low latency garbage collector (experimental) JavaFX, Java EE and COBRA modules have been removed from JDK Deprecated the noshron javascript engine Unicode 10.0.0 support A number…

  • Java 10 Features

    Local variable type interface Experimental Java bases JIT compiler Application class -data sharing Time base release versioning Parallel full GC for G1 Garbage collector interface Additional unicode langugae-TAG extensions Root certificates Thread local hand shakes Heap allocation on alternative memory devices Remove the native header generation tool – javah Consolidate the JDK forest into a…

Leave a Reply

Your email address will not be published. Required fields are marked *