Search code examples
javatomcatservletsfile-uploadnio

Asynchronous File Upload Servlet


Is it recommended to use asynchronous or NIO servlet for file upload? If so, a good sample code to start will do a great help for me.

I'd like to know which version of Tomcat supports Async / NIO servlet too.


Solution

  • No...

    ...use the standard blocking IO stuff.

    NIO does not automagically translate to 'faster' than old school blocking IO. In fact, many people have reported degraded performance with asynchronous NIO implementations for years, on top of the code being considerably more complex to code, understand, maintain and debug.

    If that doesn't scare you off, remember two important engineering concepts: