13 May 20:24
Re[2]: Long time processing in the DwrServlet.service()
From: Dmitry Kudrenko <dmitry@...>
Subject: Re[2]: Long time processing in the DwrServlet.service()
Newsgroups: gmane.comp.java.dwr.user
Date: 2008-05-13 18:24:25 GMT
Expires: This article expires on 2008-05-27
Subject: Re[2]: Long time processing in the DwrServlet.service()
Newsgroups: gmane.comp.java.dwr.user
Date: 2008-05-13 18:24:25 GMT
Expires: This article expires on 2008-05-27
Greetings, Mike
>> ..., I have not chance to do
>> it easily. And it is why I ask you for ideas (potential solutions)
>> about reason why/where DwrServlet keeps (can keep) request for a long
>> time. And have not chance to debug it because of it is hard to
>> reproduce this issue locally (with good network connection).
MW> Ok, but be aware that you will get less help with an unknown
MW> environment. It could be helpful if you deployed some of the DWR demo
MW> apps on your custom environment, to see if you get the same problem
MW> there (that would rule out one unknown variable = your application).
Yes, I know that and really don't wait for the ready solution. And
thank you a lot for your help and work you did/doing for DWR community.
Certainly, I will try to investigate the problem with standard JEE
way. I want to add Filter with timer to my test application to
calculate all request processing times.
MW> You need to provide a lot more information about your scenario:
MW> - DWR version?
Oops. Forgot to write. dwr-2.0.3
MW> - Which request are you talking about? (Originating from a call on
MW> a JavaScript proxy object or from a DWR Reverse Ajax poll?)
I wanted to say request to the simple method in my Java class which is mapped to the
javascript.
MW> - Describe more about the call that you are timing, sequence of
MW> operations, normal behaviour and expected times.
Server side:
I create DwrServlet instance and configure it using DwrConfig which is
implementation of ServletConfig
DwrServlet dwrServlet = new DwrServlet();
dwrServlet.init(new DwrConfig());
All requests mapped to DWR are processed by the following method:
protected void process(Request request, Response response) {
// convert simple request/response to HttpServletRequest/Response
HttpServletRequest req = new SimpleHttpServletRequest(request);
HttpServletResponse res = new SimpleHttpServletResponse(response);
long timePoint = new Date().getTime();
try {
dwrServlret.service(req, res);
} catch (Exception e) {
log.error("Error", e);
} finally {
long duration = new Date().getTime() - timePoint;
StatisticManager.addValue(request.getPath(), duration);
}
}
Statistic manager uses Map<String,
org.apache.commons.math.stat.descriptive.SummaryStatistics> to store
statistic information filtered by statistic name. In our case it is
request path.
I have simple Java class (called TalkerBean) which is mapped using dwr.xml to
javascript="Client" in a "script" scope.
class TalkerBean {
...
public void send(String msg) {
long timePoint = new Date().getTime();
try {
// do something;
} finally {
long duration = new Date().getTime() - timePoint;
StatisticManager.addValue("Send method", duration);
}
}
...
}
Client side:
//call send method
Client.send(msg, options);
There are several other methods in Client. But the method "send" called
in the same time when Reverse Ajax requests started too.
All code is adapted for the example, so can have mistakes/mistyping...
And after some time of using the system I can see that the maximum
time of the "duration" = 60 sec. And it is the same as maximum
connection time of Reverse Ajax requests.
Unfortunately, I can't redeploy the system often to add logs
because of it is in use. It is why I want to add all necessary logs
before releasing new version one time to have enough information for
fixing this problem.
Have you an idea what should be checked?.. Thank you a lot for your
help.
MW> - Can you snoop and provide a HTTP log from when the problem appears?
I don't have time stamp when it occurred. But I didn't find any suspicious
logs.
MW> Also think about this:
MW> - DWR's Reverse Ajax request is designed to "hang" in the server
MW> for one minute when in Full Streaming Mode. Is this what you are
MW> seeing?
Certainly. but in the result I can see the following statistic:
Name Num Min Max Ave Disp
--------------------------------------------------------------------------------
...
Send method 74635 0 22 2 2
/dwr/call/plaincall/Client.send.dwr 74740 0 59999 268 3352
/dwr/call/plainpoll/ReverseAjax.dwr 30600 502 60000 2009 7070
...
Interesting note: /dwr/call/plaincall/Client.send.dwr request started
more times than "Send method". But I didn't find Error message in the log.
MW> - Can you try the app with Reverse Ajax disabled, or try other
MW> Reverse Ajax modes (Early Closing, Polling)?
It seems the problem doesn't occurred when Reverse Ajax is disabled.
Better to say: "I didn't see this situation without 'Reverse Ajax'"
And it seems to be quite random and I can't be sure that it is so. But
looks like this.
MW> - Could you be hitting the Two Connections Limit?
Certainly I could, but it is client side issue, but we have long time
processing request in server side. Am I right?
>> MW> BTW: What is your impression of Simple framework? (There
>> doesn't seem
>> MW> to have been much activity the last years.)
>>
>> Simple framework was an engine of the original application I started
>> to support/rebuild several months ago. So, Simple framework was
>> inherited from previous developers. But, as for me, it is a good
>> solutions for project where you have a lot of _small_ requests to
>> server. For example, JBoss creates separate thread for every
>> connection and it is rather expensive operation if you have a lot of
>> small AJAX requests from 1000 and more clients.
MW> Yes, that makes sense. Although, JBOSS bundles Tomcat and Tomcat 6
MW> supports non-blocking I/O which gets rid of the thread-per-connection
MW> problem.
Certainly I agree with you. JEE technologies went forward and it is
excellent. I just told you my impression based on project I have. But I
can't suggest it for new applications when you can choose platform
based on modern/actual frameworks.
And Simple framework API is really simple and can be a good choice
for some kind of projects. Your application can be easy
installed/downloaded/redeployed just using simple-core-3.0.jar (176Kb)
in it. This small library gives possibility to create your own light
application server quickly.
>> Simple framework provides the article with comparisons of Simple's
>> vs Apache and Resin.
>> http://www.simpleframework.org/performance/comparison.php
MW> Yes, I saw this article but all the software versions are quite
MW> outdated so it would be interesting to see a comparison with modern
MW> versions like Apache 2.2 Event MPM, Tomcat 6 NIO, etc.
Yes, the article is outdated and the simple-core library is outdated
too. The latest release was 2 years ago :(. Maybe they have a reason
to stop active developing.
Thanks again.
--
--
Best regards,
Dmitry Kudrenko
ARDAS group (http://www.ardas.dp.ua)
RSS Feed