Blog Resume site ⇢

  • Searchable storage with document upload and download

    Coldfusion can index documents and PDF books using Verity/Solr, natively work with images using CFImage tag and functions, and even work with MP3 tags with some Java magic. This makes Coldfusion great tool for creating searchable file storage - say, for your workgroup fileserver.


    Getting metadata and organizing database is pretty straightforward task. Problem came from it wasn't expected - downloading large files failed every and each time.


    File download using CFContent tag is a one-liner:

    <cfcontent file="c:/somefile.avi" />

    or, to make download prettier and hide original file name:

    <cfheader name="Content-Disposition" value="attachment; filename="someothername.avi" />
    <cfcontent file="c:/somefile.avi" />

    It appeared, however, that this small piece of code is very resource-hungry. First I downloaded couple of 100MB audio files. They had downloaded without any problems. Then I tried to load 1GB video file and all I saw was "Error 500 - Service Unavailable". Coldfusion was taking about 450MB of RAM and there was no other connections. Look at memory graph:

    CFContent Download Error 500

    After Coldfusion service restart, it was same story: large file was not coming through:

    CFContent Error 500

    To help Coldfusion a little, I raised Maximum JVM Heap Size (MB) value in CF Administrator from default 512MB to 768MB. Not helped.

    CFContent JVM Heap size Error 500

    This tried on Coldfusion (first official release) on Windows Vista machine with 2 processor cores and 2GB of RAM. Tested both Coldfusion J2EE installation on Glassfish server and on clean 'out-of-the-box' Coldfusion install (JRun). Tested also on IIS and Apache as web-server. Results were similar on every test.

    In conclusion

    I didn't succeed using CFContent to download 1GB+ files and looking for alternative. I reluctant to say this, but Railo 3.1 installation on Tomcat 6 easily allowed 1GB file to download - just memory consumtion rose from 37MB to 42MB...