Quote:
Originally Posted by RikiB
Ok, so what I discovered is the reason its fast with a dlm is because of the "allow_http_ranges " is enabled. If I disable this, the speed go dramatically down.
Now, if I link directly to the external file I want, the speed is 800k/s super fast.
If I stream an external link through ldlm the speed is slow and variable (50k-130k).
Why would streaming (force_redirect=0) a file through ldlm cause the speed to go down so much? Also, why would using http ranges make the speed faster (yet in some cases a tad unstable)?
Is there any way I can fix this? I use a shared server, perhaps tweaking the php.ini file? Does the speed of the server ldlm lives on limit the speed files are streamed through ldlm?
Please help me understand my situation so I can make a smart decision on how to make ldlm work.
Thanks again!
Riki
|
Here's the story:
- When you use LDM in its default configuration (force_redirect=0), LDM reads the file and retransmits it to the user. If the cURL library is available to PHP on your server and the download has been specified using a full url, the transfer runs as efficiently as is possible. If you do not have cURL or if the file is on the server and specified using a local filename (i.e. no http: at the front), the file is read and transmitted in blocks (by default 32Kbytes in size; 256K bytes on Windows servers). In that situation, it is possible that transfers of large files will proceed faster with a larger block size, at cost of larger memory requirement. We need to do some tests.
- Download managers gain their speed improvement by making multiple connections to LDM, to request different sections of the file. Within the limits of server capacity, these sections are transmitted in parallel, and the download manager then reconstructs the whole file. This process speeds things up for the user but increases load on the server, and can quickly kill a shared server. If you disable allow_http_ranges, then download managers are not allowed to make multiple requests. The file gets transferred sequentially.
- If you set force_redirect to 1, then LDM does not intervene in the handling of the transfer. The speed of the transfer depends entirely on the construction of the web server. One side effect is that inquisitive users can find out where the file is stored, and bypass your security.
Transfer efficiency and speed (and also server load) depend critically on certain factors. If the file is physically stored on a different server, there is a *large* overhead involved in fetching the file and retransmitting it. Transfer of remote files will *always* be much faster if force_redirect is set to 1, at the costs of reduced security, because the transfer is being handled directly (and solely) by the server on which the file is stored.
Here's the catch: If you set up a local file using its full url (i.e. http: // yoursite / yourdir / yourfile.typ) instead of using the local filename ( / yourdir / yourfile.typ), LDM has to assume that the file is remote. This is because web servers may have been set up with redirections, mod_rewrite, etc.) So transfers of local files specified with full urls are much slower (and also more expensive in server load) than when specified as local files.
So the broad answer to your question is 'yes, you can certainly tweak LDM to work faster', but you may end up putting a very large load on the server if you try to squeeze every drop of speed by allowing too many simultaneous transfers. Other sites have had to limit their use of LDM for transferring large files because they have put too much load on the server.
My recommendation is:
- specify local files using local file names, not full urls
- do not offer downloads of large files hosted on other servers
- make sure the curl library is available