Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • ensure that the cache settings for the DefaultServlet in webdefault.xml are set correctly for your environment. By default, the max size of any one file that Jetty will attempt to cache is around 10Mb, so if you are serving larger files, you should increase this value, and possibly the values of the max number of cached files and the max size of the cache as a whole. The default cache settings in webdefault.xml are:
    Code Block
    xml
    xml
    <init-param>
          <param-name>maxCacheSize</param-name>
          <param-value>256000000</param-value>
    </init-param>
    <init-param>
          <param-name>maxCachedFileSize</param-name>
          <param-value>10000000</param-value>
    </init-param>
    <init-param>
          <param-name>maxCachedFiles</param-name>
          <param-value>1000</param-value>
    </init-param>
    
  • try modifying the size of the response content buffer. By default, this is set to 24k, but can be modified on the SelectChannelConnector:
    Code Block
    xml
    xml
    <New class="org.mortbay.jetty.nio.SelectChannelConnector">
      ...
      <Set name="responseBufferSize">1024</Set>
    </New>
    
    Our test results show - counter-intuitively - that a smaller buffer size may lead to faster download, with the optimum at 512 bytes (warning):

    Measured Speed

    Buffer Size

    4498.14 kb/s

    16k

    6312.14 kb/s

    8k

    6386.04 kb/s

    4k

    7654.37 kb/s

    2k

    9436.37 kb/s

    1k

    10198.95 kb/s

    512b

    9043.14 kb/s

    256

  • try using the blocking SocketConnector instead of the SelectChannelConnector, but be aware that this will not scale if you are also handling comet traffic.
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery