Hi Jan,

Can you see with YourKit where the app is actually choking? Is it a specific
thread and method?

Also, have you tried with Restlet 1.1? We have greatly improved the thread
safety of the code and it 'might' help in your case.

Finally, if you could package a reproducible test environment (loader +
restlet app) we could try to reproduce.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de Jan
Envoye : mardi 30 septembre 2008 20:52
A : [email protected]
Objet : Spiky response time problem again

Hello,

I notice there is similar problem just posted today. However, it doesn't
seem to
have answer yet. Please let me try again...

My restlet application experiences uneven response time and for a while, the
requests would choked then a big load got processed. In order to isolate the
problem, I took away the logic inside the Resource. Now my Resource is as
simple
as parsing a JSON payload then set the response to successfully accepted.

@Override
public void post(Representation entity) {                       
  if (entity == null) {
    this.getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
  } else {
    try {
      Form form = new Form(entity);
      String payloadText = form.getFirstValue(PAYLOAD);
      if (StringUtils.hasText(payloadText)) {
        JSONObject payload = new JSONObject(payloadText);
        this.getResponse().setStatus(Status.SUCCESS_ACCEPTED);
      } else {
        this.getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
      }
    } catch (JSONException je) {
        this.getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
    } catch (Exception e) {
        
this.getResponse().setStatus(Status.SERVER_ERROR_SERVICE_UNAVAILABLE);
    }
  }
}

My client sends 10 post request per second evenly.
final ScheduledFuture<?> testHandle = scheduler.scheduleAtFixedRate(tester,
5000, 100, java.util.concurrent.TimeUnit.MILLISECONDS);

Periodically there were some requests taking very long. Here are some
examples,
the number is in milliseconds.

A long request took 45008
A long request took 93003
A long request took 93001
A long request took 189002
A long request took 45001
....

The application is at java version "1.5.0_15", Restlet 1.0.9, Tomcat 6.0.16,
Windows XP dual core.

JAVA_OPTS=-server -showversion -Xms1g -Xmx1g -Xss512k -XX:+UseParallelGC
-XX:+UseParallelOldGC -XX:ParallelGCThreads=4
-Djava.net.preferIPV4Stack=true
-Dfile.encoding=UTF-8

I am not convinced GC is the reason. Because I have YourKit on the
application,
I don't see that every time when the request chokes, the GC is running.
Please
let me know what else I should looking for at YourKit.

Thank you very much.

Reply via email to