File upload performance RRS feed

  • Question

  • Hi All,


    I have to design a system in in which user has to upload an image on one webage(WP1) and would be able to search images in other webpage(WP2).WP2 page will have a feature of viewing the thumbnail view of the images which pass the serach result and then user would be able to click and view full size image.


    This system need to be very much performance efficient.

    I have two approaches in mind to implement WP1:

    1.Run two thread asynchronosly, one to upload the full image and other to reduce the size of image and then upload it for thumbnail for the full size image to the database.

    2.I upload the full size image to the database.Then fire a trigger at database level which will take the full size image, make it of small size for thumbnail view and store it in the database along with the full size image.


    1st approach will be having more database connections and also use more bandwidth while 2nd approach will up the database utilisation in terms of CPU and memory.


    Please let me know as which would be the above is the best approach from the performance point of view.I am sure, you all can also suggest alternative faster approaches for this, you are more than welcome.


    Ways by which this can be optimised is by changing httpupload protocol to ftp or some other protocol, might be the imagestream can be optimised.


    Please suggest






    Friday, August 15, 2008 10:44 AM

All replies

  • The first option may not meet your non-functional performance requirement.  It is dependant on the hardware the client is running on.


    Starting two threads will only improve performance if the client has a machine with two processors.  The most performance efficient way of running threads is one per processor.


    On single processor machines starting more threads will decrease overall performance due to the overhead of multiple threads.  In this scenario threads only increase the percieved performance with time slicing.

    Friday, August 15, 2008 12:06 PM
  • I have noticed some programs downloading or uploading many files at the same time. At least it queues the files. Also I don't think that uploading takes 100% of processor capacity, so you could create the thumbnail while the file is going up.

    Nowadays there start to be more double processor machines than there used to be. And desktop / laptop computers are more powerful than earlier, so they could do their share of server work too (create the thumbnails). If the thumbnails are small, they go fast to the server. But if there are lots of users, then bandwidth might need to be saved.
    Friday, August 15, 2008 12:41 PM
  • I would simply upload the file to a web folder. Use a systemfilewatcher to detect a new file added, make the thumbnail. If you need to store it to a database, do so at the end of the session. This should be the fastest method.



    Friday, August 15, 2008 12:46 PM
  • I agreee.  An improved option 2. 


    Using threads is not an optimal way to meet performance requirements for the reason I stated in my previous post.


    Unless the clients are in a corporate, or some other controlled environment you cannot guarentee the hardware they are running on.  The context was a web application and I wanted to make the architecture as accessible as possible. 


    Thus, I didn't want to assume dual core processors or the ability to specify minimum hardware constraints.


    Friday, August 15, 2008 1:33 PM