Reputation: 255
I am trying to upload a simple .png image with gunicorn, nginx, flask, and MySQL, but a 5 mb image takes 10 seconds to upload? I am running a ec2 micro instance, but the CPU usage is less than 30% while uploading.
my flask code # post name uses unique ID for each image post_name = str(postID) + '_post.png' destination = os.path.join(target, post_name)
c.execute('UPDATE posts set filename=%s, filetype="picture"
where postID=%s',
(destination, postID))
file.save(destination)
my nginx config
location / {
include proxy_params;
client_max_body_size 250M;
proxy_pass http://127.0.0.1:8000;
root /home/ubuntu ;
client_body_buffer_size 8M;
}
Upvotes: 0
Views: 523
Reputation: 24966
Before declaring upload to be slow, test somewhere else. EC2 bandwidth depends on instance size, and t2.micro doesn't have much. See https://cloudonaut.io/ec2-network-performance-cheat-sheet/
Upvotes: 1