How to download large files?

#1
Hello, i have installed the OpenLiteSpeed Django droplet from digitalocean.

All my files live on a aws bucket.
Now I'm trying to download 2 different files from one django view (first_file = 60mb, second_file = 800mb) with this code:

----------------------------------------------------------------------------------------------------------------
def download_file(file_name, path_to_file, file_size):

chunk_size = 8192
response = StreamingHttpResponse(FileWrapper(path_to_file.open(file_name, 'rb'), chunk_size),
content_type=mimetypes.guess_type(file_name)[0])
response['Content-Length'] = file_size
response['Content-Disposition'] = "attachment; filename=%s" % file_name
response['X-LiteSpeed-Location'] = path_to_file

return response

----------------------------------------------------------------------------------------------------------------

However on my local machine the downloads seem to work as expected but when I try to download these files from my server using Openlightspeed,
then only the first_file (60mb) is downloaded correctly and for the second_file (800mb) I'm receiving a 503 Service unavailable

I've tried changing php.ini and http_config.conf back and forth with no success.

I am grateful for any help
Thanks in advance!
 

Attachments

Last edited:

Cold-Egg

Administrator
#2
Hi,

Do you know how long it takes to show the 503 error when downloading the 800mb file?
Maybe you can try to increase wsgiDefaults values, e.g. env, initTimeout, and extMaxIdleTime, from the httpd_config.conf.
 
#3
Hi, thanks for your reply, it takes about 10 seconds for the error to appear

I've tried to change the wsgiDefaults but it seems to have no effect:

Code:
wsgiDefaults  {
  maxConns                5
  env                     LSAPI_MAX_IDLE=300     // default 60
  initTimeout             300                    // default 60
  retryTimeout            2                        // default 0
  pcKeepAliveTimeout      300                    // default 60
  respBuffer              0                      
  backlog                 50
  runOnStartUp            3
  extMaxIdleTime          10000                    // default 300
  priority                3
  memSoftLimit            10235M                // default 2047M
  memHardLimit            10235M                // default 2047M
  procSoftLimit           1000                    // default 500
  procHardLimit           1200                    // default 600
}

this is what I get back from httpie:

Code:
HTTP/1.1 503 Service Unavailable
alt-svc: h3-34=":443"; ma=2592000, h3-29=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, quic=":443"; ma=2592000; v="43,46"
cache-control: private, no-cache, max-age=0
connection: close
content-length: 717
content-type: text/html
date: Tue, 20 Apr 2021 06:56:31 GMT
pragma: no-cache
server: LiteSpeed
 
Top