Hi! 

(Please accept my apologies if this gets posted twice... I was having 
confusions joining the mailing list.)

I've got a strange behavior using Restlet, and its built-in server, in, I 
think, the most obvious and straightforward way. I've reduced my test case to a 
pretty simple one, shown below.

The symptoms are: 
• If I serve small strings, all is well. 
• If I serve some big ones (100k or so, or bigger) then after 6 or maybe 7 
requests, it gets "gummed up", and maybe finishes 30 seconds later, or 60 or 
90. In bursts like that. (This, from Safari and Chrome on a Mac.) 
• Works flawlessly on localhost, symptoms manifest on a remote client. 

Here's a movie showing the behavior: 
http://dvb.omino.com/misc/2011/restlet/RestletBigData_sm.m4v

Tar file with "ant run" target, pretty easy. 
http://dvb.omino.com/misc/2011/restlet/RestletServingBigData.tgz

Any guidance or tips appreciated! I tried adding random sleep()s, using a 
ByteChannel, doing a deferred commit() from one thread, things like that, but 
the behavior is pretty consistent. 

(We need to serve a few static files in addition to the more "active" parts of 
our server doing REST and other queries.) 

Many thanks for Restlet, and any tips or guidance to serving >7 bit resources 
in a row. :-) 

--> David Van Brink 

-------------------- 
public class RestletBigData101 extends ServerResource { 

    public static void main(String[] args) throws Exception {   
        // Create the HTTP server and listen on port 8182   
        new Server(Protocol.HTTP, 8182, RestletBigData101.class).start();   
    }   
  
    @Get   
    public String handler() 
    {   
    Request r = this.getRequest(); 
        String path = r.getOriginalRef().getPath(); 
        String result; 
        if(path.equals("/grabber.html") || path.equals("/")) 
        { 
        result = Utils101.readResource(this.getClass(), "./grabber.html"); 
        this.getResponse().setEntity(result, MediaType.TEXT_HTML); 
        } 
        else 
        { 
                        int bigLength = Utils101.random(1000,1000000); 
                        result = bigLength + " bytes: " + Utils101.repeat("x", 
bigLength) + "hello, world " + path; 
        } 
        return result; 
    } 
} 
--------------------

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

Reply via email to