2004-11-22 jrandom
* Update to the SAM bridge to reduce some unnecessary memory allocation. * New stat to keep track of slow jobs (ones that take more than a second to excute). This is published in the netDb as jobQueue.jobRunSlow
This commit is contained in:
@ -29,10 +29,12 @@
|
||||
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce")%>" />
|
||||
<input type="hidden" name="action" value="blah" />
|
||||
<textarea rows="20" cols="100" name="config"><jsp:getProperty name="advancedhelper" property="settings" /></textarea><br />
|
||||
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" /> <br />
|
||||
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" /><!-- <br />
|
||||
<b>Force restart:</b> <input type="checkbox" name="restart" value="force" /> <i>(specify this
|
||||
if the changes made above require the router to reset itself - e.g. you are updating TCP ports
|
||||
or hostnames, etc)</i>
|
||||
or hostnames, etc)</i>-->
|
||||
If you are changing any of the I2NP settings, you should go to the
|
||||
<a href="configservice.jsp">service config</a> page and do a graceful restart after saving.
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
@ -100,6 +100,14 @@ public abstract class SAMHandler implements Runnable {
|
||||
socketOS.flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If you're crazy enough to write to the raw socket, grab the write lock
|
||||
* with getWriteLock(), synchronize against it, and write to the getOut()
|
||||
*
|
||||
*/
|
||||
protected Object getWriteLock() { return socketWLock; }
|
||||
protected OutputStream getOut() { return socketOS; }
|
||||
|
||||
/**
|
||||
* Write a string to the handler's socket. This method must
|
||||
|
@ -14,6 +14,7 @@ import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.NoRouteToHostException;
|
||||
@ -765,15 +766,24 @@ public class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatag
|
||||
throw new NullPointerException("BUG! STREAM session is null!");
|
||||
}
|
||||
|
||||
ByteArrayOutputStream msg = new ByteArrayOutputStream();
|
||||
|
||||
String msgText = "STREAM RECEIVED ID=" + id +" SIZE=" + len + "\n";
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("sending to client: " + msgText);
|
||||
msg.write(msgText.getBytes("ISO-8859-1"));
|
||||
msg.write(data, 0, len);
|
||||
|
||||
writeBytes(msg.toByteArray());
|
||||
|
||||
byte prefix[] = msgText.getBytes("ISO-8859-1");
|
||||
|
||||
// dont waste so much memory
|
||||
//ByteArrayOutputStream msg = new ByteArrayOutputStream();
|
||||
//msg.write(msgText.getBytes("ISO-8859-1"));
|
||||
//msg.write(data, 0, len);
|
||||
// writeBytes(msg.toByteArray());
|
||||
Object writeLock = getWriteLock();
|
||||
OutputStream out = getOut();
|
||||
synchronized (writeLock) {
|
||||
out.write(prefix);
|
||||
out.write(data, 0, len);
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyStreamDisconnection(int id, String result, String msg) throws IOException {
|
||||
|
@ -1,4 +1,9 @@
|
||||
$Id: history.txt,v 1.79 2004/11/21 17:31:33 jrandom Exp $
|
||||
$Id: history.txt,v 1.80 2004/11/22 12:57:16 jrandom Exp $
|
||||
|
||||
2004-11-22 jrandom
|
||||
* Update to the SAM bridge to reduce some unnecessary memory allocation.
|
||||
* New stat to keep track of slow jobs (ones that take more than a second
|
||||
to excute). This is published in the netDb as jobQueue.jobRunSlow
|
||||
|
||||
2004-11-21 jrandom
|
||||
* Update the I2PTunnel web interface to include an option for the new
|
||||
|
@ -24,6 +24,7 @@ class JobQueueRunner implements Runnable {
|
||||
_lastJob = null;
|
||||
_log = _context.logManager().getLog(JobQueueRunner.class);
|
||||
_context.statManager().createRateStat("jobQueue.jobRun", "How long jobs take", "JobQueue", new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
_context.statManager().createRateStat("jobQueue.jobRunSlow", "How long jobs that take over a second take", "JobQueue", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
_context.statManager().createRateStat("jobQueue.jobLag", "How long jobs have to wait before running", "JobQueue", new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
_context.statManager().createRateStat("jobQueue.jobWait", "How long does a job sat on the job queue?", "JobQueue", new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
_context.statManager().createRateStat("jobQueue.jobRunnerInactive", "How long are runners inactive?", "JobQueue", new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
@ -96,13 +97,15 @@ class JobQueueRunner implements Runnable {
|
||||
_context.statManager().addRateData("jobQueue.jobLag", doStart - origStartAfter, 0);
|
||||
_context.statManager().addRateData("jobQueue.jobWait", enqueuedTime, enqueuedTime);
|
||||
|
||||
if (duration > 1000) {
|
||||
_context.statManager().addRateData("jobQueue.jobRunSlow", duration, duration);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Duration of " + duration + " (lag "+ (doStart-origStartAfter)
|
||||
+ ") on job " + _currentJob);
|
||||
}
|
||||
|
||||
_state = 14;
|
||||
|
||||
|
||||
if ( (duration > 1000) && (_log.shouldLog(Log.WARN)) )
|
||||
_log.warn("Duration of " + duration + " (lag "+ (doStart-origStartAfter)
|
||||
+ ") on job " + _currentJob);
|
||||
|
||||
if (diff > 100) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Updating statistics for the job took too long [" + diff + "ms]");
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.84 $ $Date: 2004/11/21 17:31:33 $";
|
||||
public final static String ID = "$Revision: 1.85 $ $Date: 2004/11/22 12:57:16 $";
|
||||
public final static String VERSION = "0.4.1.4";
|
||||
public final static long BUILD = 13;
|
||||
public final static long BUILD = 14;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -106,6 +106,7 @@ public class StatisticsManager implements Service {
|
||||
//includeRate("tcp.queueSize", stats);
|
||||
//includeRate("jobQueue.jobLag", stats, new long[] { 60*1000, 60*60*1000 });
|
||||
//includeRate("jobQueue.jobRun", stats, new long[] { 60*1000, 60*60*1000 });
|
||||
includeRate("jobQueue.jobRunSlow", stats, new long[] { 10*60*1000l, 60*60*1000l });
|
||||
includeRate("crypto.elGamal.encrypt", stats, new long[] { 60*60*1000 });
|
||||
//includeRate("crypto.garlic.decryptFail", stats, new long[] { 60*60*1000, 24*60*60*1000 });
|
||||
includeRate("tunnel.unknownTunnelTimeLeft", stats, new long[] { 60*60*1000 });
|
||||
|
Reference in New Issue
Block a user