Hi,

For quite some time I've had the problem that whenever I try to
benchmark the server's performance with ApacheBench with the new,
internal connector of Restlet 2.1 (currently testing with 2.1-RC2) I
get a timeout. Here is a minimal program I used for testing:

import org.restlet.Component;
import org.restlet.data.MediaType;
import org.restlet.data.Protocol;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class Main
{
  public static void main(String... args) throws Exception {
    Component comp = new Component();
    comp.getServers().add(Protocol.HTTP, 8182);
    comp.getDefaultHost().attach("/test", TestResource.class);
    comp.start();
  }
  
  public static class TestResource extends ServerResource
  {
    @Get
    public Representation getText() {
      return new StringRepresentation("test\n", MediaType.TEXT_PLAIN);
    }
  }
}

Calling "curl http://192.168.100.97:8182/test"; gives me the
expected result, but "ab -n 1 http://192.168.100.97:8182/test";
freezes for some time and finally gives up with the following error
message:

Benchmarking 192.168.100.97 (be patient)...apr_poll: The timeout specified has 
expired (70007)

However, the request does show up in Restlet's log:

2012-01-26      11:25:15        192.168.100.170 -       -       8182    GET     
/test   -       200     5       0       1       http://192.168.100.97:8182      
curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 
libidn/1.15 libssh2/1.2.6  -
2012-01-26      11:25:20        192.168.100.170 -       -       8182    GET     
/test   -       200     5       0       2       http://192.168.100.97:8182      
ApacheBench/2.3 -

I'm using Windows 7 x64. When I suspend the program during the
freeze in Eclipse, it shows the following stack trace of Restlet's
thread:

Thread [Restlet-2004273875] (Suspended) 
        WindowsSelectorImpl$SubSelector.poll0(long, int, int[], int[], int[], 
long) line: not available [native method] 
        WindowsSelectorImpl$SubSelector.poll() line: not available      
        
WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl$SubSelector) 
line: not available 
        WindowsSelectorImpl.doSelect(long) line: not available  
        WindowsSelectorImpl(SelectorImpl).lockAndDoSelect(long) line: not 
available     
        WindowsSelectorImpl(SelectorImpl).select(long) line: not available      
        ServerConnectionController(ConnectionController).selectKeys(long) line: 
259     
        ServerConnectionController(ConnectionController).doRun(long) line: 150  
        ServerConnectionController(Controller).run() line: 155  
        Executors$RunnableAdapter<T>.call() line: not available 
        FutureTask$Sync.innerRun() line: not available  
        FutureTask<V>.run() line: not available 
        ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
        ThreadPoolExecutor$Worker.run() line: not available     
        Thread.run() line: not available        

Sebastian

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2925022

Reply via email to