Discussions

Performance and scalability: File I/O issues

  1. File I/O issues (1 messages)

    Howdy--

    I've a general question for everyone. Are there any traps/performance issues to watch out for when performing file I/O? We plan on caching generated PNG images on the file system for use in JSPs. Would it be better to generate them ahead of time at intervals or on demand? I'm really new at all this. Thanks for your input.

    --Jim

    Threaded Messages (1)

  2. File I/O issues[ Go to top ]


    There are plenty of traps with anything native. :)

    In this case, I think it really depends on your application. I've written apps which generate files and then cache them on the file system afterwards, and it works perfectly fine.

    The main reason to do it ahead-of-time rather than on-demand, as long as you're caching, is that the first request will be noticeably slower. If that's a problem, generate them ahead of time.

    Also, keep in mind that depending on the size and quantity of the files, it may make sense to cache the file contents in RAM. (This may burden your server, but opening a file is significantly slower, not only because it requires disk access, but because it requires native method calls.)

    Regards,
    Ben Flaumenhaft
    Principal, Sidelight Consulting
    http://www.sidelight.com