Freelancer: samermassoud
Chia sẻ:
Báo cáo bài thi

check the region of S3 bucket & Django production

did you check the region of S3 bucket and the production Django deployment. from description i can assume that testing has same region as S3 bucket, but in production they are not the same


                                                                                                                        Bài tham dự cuộc thi #                                            2
                                         cho                                             Jango / Ubuntu expert needed
Bài tham dự #2

Bảng thông báo công khai

  • samermassoud
    samermassoud
    • cách đây 3 tháng

    I have giving this issue some time to check what can cause it on same region.
    there is a significant slowness when files goes large.
    it is not linear relation. S3 bucket acceleration can help a bit, but multi-threading in upload is the key snippet:

    from boto3.s3.transfer import TransferConfig
    config = TransferConfig(multipart_threshold=1024 * 25, max_concurrency=10, multipart_chunksize=1024 * 25, use_threads=True)

    • cách đây 3 tháng
    1. MesayTse
      Chủ cuộc thi
      • cách đây 3 tháng

      Thanks for your support. Since jango saves files in temporary folder if the size is greater than specified in settings (default 2,5 MB) in case of large files before sending to s3 the files get copied first in temp folder. That is taking longer time. One solution is increasing the default size (Using more memory). But i found another soulution by resizing the files with JavaScript and saving the binary data in hidden inputs. I avoided multipart transfer ( the images will not be requested only the hidden inputs) then in django i change the small files to images. The challange i need to delay the form submition so that converting the images get finished. I am not sure if it has a security risk. Thank you for your help, i will transfer the money so that you have a cup of coffee.

      • cách đây 3 tháng
  • MesayTse
    Chủ cuộc thi
    • cách đây 4 tháng

    Thanks for the input. Both are on the same location. I tried to impliment your suggession. I am getting a template not found error on loading the form. One additional info, I am using linode s3. I have also observed that there is a delay of approx 45 seconds between the time i hit summit button and the start of post method.

    • cách đây 4 tháng