4 Replies Latest reply on Oct 15, 2008 10:08 PM by ericjava.eric.chiralsoftware.net

    Storing multimedia files

    gregtk

      Hi! I need advice how to storing multimedia files on the server. And use it in my web application like http://localhost:8080/myapp/image/test.jpeg. I have 3 ideas about it.
      1.Storing in database - I don't like that because I can't access that files via ftp or webdav.
      2.Storing in folder on server and access via servlet. But I think I inventing wheel
      3.Storing in web folder of Apache web server. That's good idea but it make deployment of my application very difficult.


      Has anyone know answer or can tell me advice?


        • 1. Re: Storing multimedia files
          www.supernovasoftware.com

          I prefer storing in the database because I do not have to code against the file system, operations are handled with transactions, and most of my binary content is generated and related to a specific entity in the system.

          • 2. Re: Storing multimedia files
            ericjava.eric.chiralsoftware.net

            This is one of those classic questions.  There is not one right answer to this.  Intuitively, it would seem like using a JDBC + JBoss to serve multimedia is slower than using plain old file system + Apache, so if you have a high load of stuff to serve, you would want FS + Apache.


            However... if the load really is that high, you'll want to be using a caching system on the front-end, so maybe at that point there is no speed advantage of using FS + Apache, because 99% of the hits will come out of the caching system.


            On top of this, there is the administration complexity of one vs. the other.  It is nice to have a bunch of media content in directories that you can look at, but in some ways it's even nicer to have all your media in a database that you can deal with with replication, DB backup tools, transactions, and all that stuff.


            I guess this is an optimization question and one of the facts of optimization is, don't do it until you can prove that you need to, and when that happens, make sure you understand exactly what the performance constraints are.

            • 3. Re: Storing multimedia files

              I think that storing them in a web-accessible folder is very common.  I'm not sure why that makes deployment very difficult - can you elaborate?

              • 4. Re: Storing multimedia files
                ericjava.eric.chiralsoftware.net

                One factor that makes it very difficult is that an EAR deployment doesn't have write-access to any of its own directories so there isn't even a clear way to do it in a normal deployment.  Therefore the images need to be somewhere else, this all needs to be coordinated and configured, the image files and the DB entries related to them must be kept in sync, etc.  It sure does make deployment into a pain.