Sign in to follow this  

file access permission

This topic is 3465 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have an application that retrieves files from a server. However whether the files should be accessible on the server or not depends on some database entries. My prolem is that if my application requests 10 files then every individual request has to look in the database to find out if the server should send or not. Usually the application wants one group of files all of which are send or not sent, so I have tons of useless database queries. I see two solutions none of which I like. 1.) group files into one file and then ungroup them client side (lots of work and unconvenient in my case). 2.) Use session data? What would you guys say the best approach is. -CProgrammer

Share this post


Link to post
Share on other sites
Hi,

If you are using one of the current decent relational database management systems (like SQL Server or PostgreSQL) I doubt that the DB queries will kill your app. Of course this highly depends on your situation (average size of the file, connection to client, performance of the server etc.).

Anyway, the first thing you should do is to build a prototype and measure its performance to find out where the bottlenecks are.

Some general thoughts:
1) Doing a few "chunky" requests is generally preferable to a lot of "small" requests, especially when working over the internet. If you can bundle files and/or requests, do it!
2) Try to deliver files back-to-back. Don't do this:

recv request A => send response A => recv request B => send response B

But rather do this:


Thread 1: recv request A, recv request B, recv request C...
Thread 2: send response A, send response B, send response C...


3) If some files are requested frequently, cache their information. After all, the fastest queries are those that are not executed (but clear the cache entry in case the database entry changes - e.g. sql server cache dependencies might come in handy)

4) It might be worthwhile to have the database on a different physical disk than the actual files.

Regards,
Andre

Share this post


Link to post
Share on other sites
Thanks that was some helpfull insight.
Ive been pondering how I could group files to reduce the amount of transfers as well. However, Im using flash as one of the client apps and a lot of the files being sent are jpegs and text. Now if I combine requests thn Id have to implement my own jpeg decompression since I cant find actionscript functionality that will decompress jpegs from raw binary data. I thought of at least grouping the jpegs, however I fear having a large jpeg which I then have to split back into smaller pictures client size may in fact be slower than multile requests.
I will definately do caching.

-CProgrammer

Share this post


Link to post
Share on other sites

This topic is 3465 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this