Re: Measuring latency between tomcat instances [Off list-topic answer]

2004-01-22 Thread Antonio Fiol BonnĂ­n
Jeremy Nix wrote:

Okay, let me pose another (slightly differenc) question.  Say that
instance (A) and (B) are separate institutions, independent from each
other.  Same scenario as before.  How could instance (B) (the responding
instance) be able to measure latency in instance (A)?  The reason I ask
is related to an issue that has been reported to me, but I am unable to
understand how the latency was measured.
 

Is it HTTP or HTTPS? If HTTPS, things get more kludgy, but if it is 
HTTP, there is a fairly simple way:

1. start a network analyzer (such as Ethereal) on Tomcat B network.
2. Capture packets until you see a client request that needs a 
redirection (I'm pretty sure you have one in your app)
3. You will see some time later a client request for the redirected 
resource.
4. Measure the time since the last bit of the redirection until the 
first bit of the redirected request.
5. Divide by 2.

With HTTPS, you won't see anything useful on the network analyzer, 
unless you know very well the usage pattern. Ig the usage pattern is 
known and constant, you can do the same, by imagining what you see.

Or, you may even go down a bit more, and this works for both HTTP and 
HTTPS, and it may be even simpler (no need to have a redirection):

1. Start a network analyzer on TC B network
2. Capture packets until you see (it should not be a long time ;-) TCP 
packets like these:
Packet 1: A - B Flags: SYN
Packet 2: B - A Flags: SYN ACK
Packet 3: A - B Flags: ACK
3. Measure difference between packet 2 and packet 3.
4. Divide by 2.

Of course both procedures assume that network latency is symmetrical.

Hope that helps.

Antonio Fiol


smime.p7s
Description: S/MIME Cryptographic Signature


Measuring latency between tomcat instances

2004-01-21 Thread Jeremy Nix
We have an instance where tomcat instance (A) is communicating with
tomcat instance (B), where instance (B) is located at another site.
Instance (A) formulates a request to instance (B) and instance (B)
responds with some valid response.  Now, my question is, from a
standpoint of instance (B), is it possible to measure latency?  If so,
how?


_
Jeremy Nix
Southwest Financial Services, LTD.
[EMAIL PROTECTED]
(513) 621-6699 ext.1158


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Measuring latency between tomcat instances

2004-01-21 Thread Tim Funk
LOG4j might be nice kludge for this. On tomcat A, time the appropriate events 
 on how long it takes to do stuff on tomcat B.  Then log it in a specially 
formatted message. (mylogger.log(time:  + timeTaken) Then do the same on 
tomcat B. Its easier to do on tomcatB since you can use a Valve or servlet 
filter and stay out of the business logic.

I say LOG4J since it provides asynchronous loggers (Unless the performance on 
the non-asynchronous loggers are neglible in this case). But with LOG4j (or 
insert logging framework here) - you can use it to write to any log file or 
format you want. So your normal error messages can go to one file while these 
special messages can go to a differnet file/database/...

--

Or you can compare acces log entries since it does offer a %T option for time 
taken.

-Tim

Jeremy Nix wrote:

We have an instance where tomcat instance (A) is communicating with
tomcat instance (B), where instance (B) is located at another site.
Instance (A) formulates a request to instance (B) and instance (B)
responds with some valid response.  Now, my question is, from a
standpoint of instance (B), is it possible to measure latency?  If so,
how?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Measuring latency between tomcat instances

2004-01-21 Thread Jeremy Nix
Okay, let me pose another (slightly differenc) question.  Say that
instance (A) and (B) are separate institutions, independent from each
other.  Same scenario as before.  How could instance (B) (the responding
instance) be able to measure latency in instance (A)?  The reason I ask
is related to an issue that has been reported to me, but I am unable to
understand how the latency was measured.


_
Jeremy Nix
Southwest Financial Services, LTD.
[EMAIL PROTECTED]
(513) 621-6699 ext.1158



-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 21, 2004 8:26 AM
To: Tomcat Users List
Subject: Re: Measuring latency between tomcat instances


LOG4j might be nice kludge for this. On tomcat A, time the appropriate
events 
  on how long it takes to do stuff on tomcat B.  Then log it in a
specially 
formatted message. (mylogger.log(time:  + timeTaken) Then do the same
on 
tomcat B. Its easier to do on tomcatB since you can use a Valve or
servlet 
filter and stay out of the business logic.

I say LOG4J since it provides asynchronous loggers (Unless the
performance on 
the non-asynchronous loggers are neglible in this case). But with LOG4j
(or 
insert logging framework here) - you can use it to write to any log file
or 
format you want. So your normal error messages can go to one file while
these 
special messages can go to a differnet file/database/...

--

Or you can compare acces log entries since it does offer a %T option for
time 
taken.

-Tim

Jeremy Nix wrote:

 We have an instance where tomcat instance (A) is communicating with 
 tomcat instance (B), where instance (B) is located at another site. 
 Instance (A) formulates a request to instance (B) and instance (B) 
 responds with some valid response.  Now, my question is, from a 
 standpoint of instance (B), is it possible to measure latency?  If so,

 how?
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Measuring latency between tomcat instances

2004-01-21 Thread Philipp Taprogge
Hi!

Jeremy Nix wrote:
We have an instance where tomcat instance (A) is communicating with
tomcat instance (B), where instance (B) is located at another site.
Instance (A) formulates a request to instance (B) and instance (B)
responds with some valid response.  Now, my question is, from a
standpoint of instance (B), is it possible to measure latency?  If so,
how?
In order to measure latency between two systems (regardless of the 
application performing the measurement), you first need a way to 
synchronise the clocks at both sites. In most cases this brings a 
certain amount of tolerance you can't overcome. (For instance, 
synchronizing with an internet time server imposes a tolerance of a few 
miliseconds du to network packet delays).
Since you will only get accurate readings from withing the application 
(i.e. tomcat) you will then have to make sure that both OS'es system 
clocks are equally accurate. (For example System.currentTimeMillis() has 
a range of up to 50ms on Windows9x systems).
That said is it simple to write a small servlet that runs on A and makes 
a request to B including it's current time. A servlet on B then echos 
that request back to A and adds it's current time as well. Finally the 
servlet on A generates  some kind of user output containing the measured 
runtimes.

HTH

		Phil

--
And on the seventh day, He exited from append mode.
(Book of create(2), line 255)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Measuring latency between tomcat instances

2004-01-21 Thread Tim Funk
Instance B knows nothing about instance A. Instance B is only serving 
responses to instance A. Instance A might do a lot of work before and after 
it talks to instance B which might make instance B look bad even if that is 
the short part of a transaction.

The only gotcha is if client side javascript were introduced. The javascript 
might be doing calls back to A introducing a nasty piece to the puzzle.

-Tim

Jeremy Nix wrote:

Okay, let me pose another (slightly differenc) question.  Say that
instance (A) and (B) are separate institutions, independent from each
other.  Same scenario as before.  How could instance (B) (the responding
instance) be able to measure latency in instance (A)?  The reason I ask
is related to an issue that has been reported to me, but I am unable to
understand how the latency was measured.
_
Jeremy Nix
Southwest Financial Services, LTD.
[EMAIL PROTECTED]
(513) 621-6699 ext.1158


-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 21, 2004 8:26 AM
To: Tomcat Users List
Subject: Re: Measuring latency between tomcat instances

LOG4j might be nice kludge for this. On tomcat A, time the appropriate
events 
  on how long it takes to do stuff on tomcat B.  Then log it in a
specially 
formatted message. (mylogger.log(time:  + timeTaken) Then do the same
on 
tomcat B. Its easier to do on tomcatB since you can use a Valve or
servlet 
filter and stay out of the business logic.

I say LOG4J since it provides asynchronous loggers (Unless the
performance on 
the non-asynchronous loggers are neglible in this case). But with LOG4j
(or 
insert logging framework here) - you can use it to write to any log file
or 
format you want. So your normal error messages can go to one file while
these 
special messages can go to a differnet file/database/...

--

Or you can compare acces log entries since it does offer a %T option for
time 
taken.

-Tim

Jeremy Nix wrote:


We have an instance where tomcat instance (A) is communicating with 
tomcat instance (B), where instance (B) is located at another site. 
Instance (A) formulates a request to instance (B) and instance (B) 
responds with some valid response.  Now, my question is, from a 
standpoint of instance (B), is it possible to measure latency?  If so,


how?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]