FileCache blocks stream?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FileCache blocks stream?

awallat
Hello there,

I created a simple HttpServer which serves static content. On a local (windows) machine everything is working fine. On a remote linux system (Ubuntu 11.04) however the page takes 30 seconds to load. Those pending requests are different every time, like javascript files, images or ajax-calls. It seems that there's a timeout after 30 seconds when the last resources are finally returned and the webpage is presented correctly.

When the server is started the very first time, then the first time the page is called, everything is quick. The second time (and the following) however have this long delay. The log shows several lines of:

org.glassfish.grizzly.http.server.StaticHttpHandlerBase$NonBlockingDownloadHandler onWritePossible 
FINE: [onWritePossible]
... 

for the first request and:

org.glassfish.grizzly.nio.transport.TCPNIOTransport read
FINE: TCPNIOConnection (TCPNIOConnection{localSocketAddress={/***.***.***.***:9997}, peerSocketAddress={/5.10.178.19:63246}}) (allocated) read 562 bytes 
... 
org.glassfish.grizzly.nio.DefaultSelectionKeyHandler onKeyRegistered 
FINE: KEY IS REGISTERED: sun.nio.ch.SelectionKeyImpl@1c0c1b7

for the second request, which blocks 30s and then goes on.

When I disable the file-cache however, then there's no 30s wait! 

for (NetworkListener l : server.getListeners()) {
    l.getFileCache().setEnabled(false);
}

Is this behaviour normal and do I have to configure my server differently or is this a bug?

Thanks in advance!
André
Reply | Threaded
Open this post in threaded view
|

Re: FileCache blocks stream?

oleksiys
Administrator
Hello Andre,

looks like a bug, can you pls. file an issue [1] and provide more details on Grizzly and JDK versions you're using, how big the static resource files are?
Can you pls. also attach a full logs of successful and unsuccessful attempts?

Thank you.

WBR,
Alexey.

[1] https://java.net/jira/browse/GRIZZLY

On 02.09.13 08:38, André Wallat wrote:
Hello there,

I created a simple HttpServer which serves static content. On a local (windows) machine everything is working fine. On a remote linux system (Ubuntu 11.04) however the page takes 30 seconds to load. Those pending requests are different every time, like javascript files, images or ajax-calls. It seems that there's a timeout after 30 seconds when the last resources are finally returned and the webpage is presented correctly.

When the server is started the very first time, then the first time the page is called, everything is quick. The second time (and the following) however have this long delay. The log shows several lines of:

org.glassfish.grizzly.http.server.StaticHttpHandlerBase$NonBlockingDownloadHandler onWritePossible 
FINE: [onWritePossible]
... 

for the first request and:

org.glassfish.grizzly.nio.transport.TCPNIOTransport read
FINE: TCPNIOConnection (TCPNIOConnection{localSocketAddress={/***.***.***.***:9997}, peerSocketAddress={/5.10.178.19:63246}}) (allocated) read 562 bytes 
... 
org.glassfish.grizzly.nio.DefaultSelectionKeyHandler onKeyRegistered 
FINE: KEY IS REGISTERED: sun.nio.ch.SelectionKeyImpl@1c0c1b7

for the second request, which blocks 30s and then goes on.

When I disable the file-cache however, then there's no 30s wait! 

for (NetworkListener l : server.getListeners()) {
    l.getFileCache().setEnabled(false);
}

Is this behaviour normal and do I have to configure my server differently or is this a bug?

Thanks in advance!
André