Re: Constructing an SQL string in Java
only 150 MB? Hell by the end of the day I'm using well over 200MB. In version 6.0 I reached 400MB in an 8 hour working day (i think it was an unaddressed memory leak).
Here is what you can do to try and pinpoint where the bottleneck is. Try timing different pieces of your code. Look into timers in java. There is a lot of stuff out on the web about it. I had done this but I deleted all that code... I know I should have kept it for a time like this...but it got tossed with an older broken version of a project I was working on....
Ok, I just went out and dug this up for you...
beginning = System.currentTimeMillis();
//YOUR CODE TO BE TIMED GOES IN HERE
ending = System.currentTimeMillis();
interval = ending - beginning;
Set up a new bean. Call it something like, timingBean or something. Just make 1 setter and getter method to hold the value of interval. Then after you know interval you can do something like...
TimingBean myTimer = new TimingBean();
myTimer.setInteral(interval);
session.setAttribute("myTimer",myTimer);
getServletContext().getRequestDispatcher("Timing.j sp").forward(request,response);
Then Timing.jsp would look like this...
You will need to comment out the redirect to your Results.jsp page...
Just wrap the beginning and ending timer around different parts of the code to figure out what is taking it so long.
only 150 MB? Hell by the end of the day I'm using well over 200MB. In version 6.0 I reached 400MB in an 8 hour working day (i think it was an unaddressed memory leak).
Here is what you can do to try and pinpoint where the bottleneck is. Try timing different pieces of your code. Look into timers in java. There is a lot of stuff out on the web about it. I had done this but I deleted all that code... I know I should have kept it for a time like this...but it got tossed with an older broken version of a project I was working on....
Ok, I just went out and dug this up for you...
beginning = System.currentTimeMillis();
//YOUR CODE TO BE TIMED GOES IN HERE
ending = System.currentTimeMillis();
interval = ending - beginning;
Set up a new bean. Call it something like, timingBean or something. Just make 1 setter and getter method to hold the value of interval. Then after you know interval you can do something like...
TimingBean myTimer = new TimingBean();
myTimer.setInteral(interval);
session.setAttribute("myTimer",myTimer);
getServletContext().getRequestDispatcher("Timing.j sp").forward(request,response);
Then Timing.jsp would look like this...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<html>
<head>
<link rel="stylesheet" href="theme/Master.css" type="text/css">
<title>Timing</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR"
content="IBM Websphere Development Studio Client for iSeries">
</head>
<body>
${myTimer.getInteravl}
</body>
</html>
Just wrap the beginning and ending timer around different parts of the code to figure out what is taking it so long.



Comment