Hi Paul,

 

If you are using version 2.0, I would suggest using one of the pluggable HTTP 
connectors (“org.restlet.ext.net” or “org.restlet.ext.httpclient”) to get 
production level performances. The internal/default connector is only intended 
for development/test purpose or small loads). In version 2.1, we are radically 
improving this connector though.

 

Let us know if this helps.

 

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~  <http://www.restlet.org/> 
http://www.restlet.o​rg
Noelios Technologies ~  <http://www.noelios.com/> http://www.noelios.com

 

 

De : Paul Vincent Craven [mailto:p...@cravenfamily.com] 
Envoyé : lundi 14 février 2011 04:26
À : discuss@restlet.tigris.org
Objet : Restlet speed

 

Restlet does not seem to run as fast as I would expect. I was hoping someone 
could point me how to get it running faster.

Looking at the examples, I've created a simple server:

import org.restlet.Server;
import org.restlet.data.Protocol;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class SimpleServer extends ServerResource {  
  
    public static void main(String[] args) throws Exception {  
        // Create the HTTP server and listen on port 8182  
        new Server(Protocol.HTTP, 8182, SimpleServer.class).start();  
    }  
  
    @Get  
    public String toString() {  
        return "hello, world";  
    }  
  
}  

I also have created a simple client:

import java.io.IOException;

import org.restlet.resource.ClientResource;

public class SimpleClient {
  public static void main(String [] args) throws IOException {
    // Create the client resource  
    ClientResource resource = new ClientResource("http://localhost:8182";);  
      
    // Write the response entity on the console  
    long startTime = System.nanoTime();

    // If getMethod 1 is used, I get 3.12 seconds.
    // Setting getMethod 2 results in 2.30 seconds.
    int getMethod = 2;
    for( int i=0; i < 10; i++) {
        if( getMethod == 1 )
            resource.get().write(System.out);
        else
            new ClientResource("http://localhost:8182";).get().write(System.out);
    }

    long endTime = System.nanoTime();
    
    System.out.println( (endTime-startTime) / 1000000000.0);
  }
}

If both are running on the same system, I get can process 10 requests in 2.3 or 
3.1 seconds depending on the method used. I'm not sure why creating a new 
client resource is faster than reusing the old one. At any rate, I was hoping 
to run at least 100 in one second. Any thoughts on why this is slow?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2703984
  • Restlet speed Paul Vincent Craven
    • RE: Restlet speed Jerome Louvel

Reply via email to