CMK08 Posted October 13, 2008 Share Posted October 13, 2008 Hello there I am quite new to php and I am working on an application that will let users download several files at once. Basically, the user logs in, then they will see a list of the files available for them - it can be anything between 1 and 300 - they can check the ones that they want to download, they click the download button, a zip file containing the selected files is created and sent to the browser. I have doubts about how many people can be doing this at the same time. I don't have any exotic functions in my script. Simply a couple of arrays, the zip file is sent to the browser via header('Location: file.zip'). Right now I am just testing this part of the script, but I am really concerned that I will have problems for doing it this way once I start getting hundreds of clicks at the same time. Thanks! CMK08 Quote Link to comment Share on other sites More sharing options...
CroNiX Posted October 13, 2008 Share Posted October 13, 2008 I can only think of 2 possible problems: 1) if a lot of people are having files 'zipped' at the same time, that could really slow the server down. 2) if a lot of people are downloading their zip packages at the same time, that could really suck your bandwidth. Both really depend on your server and its net connection...But there probably isn't a better way to do it than you are. Quote Link to comment Share on other sites More sharing options...
Stooney Posted October 13, 2008 Share Posted October 13, 2008 You could create a queuing system. Only allow say 10 downloads per minute. Record each download in a table. When someone click the download link, check how many downloads have been started in the last 60 seconds. If that value is above 10, make them wait a minute, otherwise give them the download. Of course you will probably want to make sure there is a line and it's first come, first serve and not first to refresh. But that's a simple idea. Quote Link to comment Share on other sites More sharing options...
waynew Posted October 13, 2008 Share Posted October 13, 2008 As Cronix said, this will absolutely rape your bandwidth. Allow one download per user at any given time. Or split it up at least. :\ Quote Link to comment Share on other sites More sharing options...
CMK08 Posted October 24, 2008 Author Share Posted October 24, 2008 any suggestions on how I can allow only one download at a time? Is that php or server settings? My aplication is practically ready, I need to address this issue now. Queuing seems like a god idea but I have no idea or to start. thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.