近两年来,我们一直在开发企业应用程序。基于微服务体系结构,我们有九个服务及其各自的数据库和一个在NGINX上调用/连接微服务的角度前端。在我们的开发过程中,我们在Hetzner云服务器上通过内部网络使用4GB RAM和2个CPU实现了这些服务及其数据库,而且一切都是无缝的。我们正在上传所有的图像,pdf和视频的AWS S3,这是一帆风顺的。所有大小的视频都被上传和播放,没有任何问题。
我们喜欢赫茨纳,并决定和他们一起去制作。我们使用了第一个服务器并在其上安装了proxmox,并部署了LXC容器和我们的服务。我在这里又做了一次测试,没有发现问题。
然后,我们决定使用另一台服务器,部署proxmox,并对它们进行集群。当我们雇用了一个在两个节点的容器之间配置桥接网络的网络人员时,问题就开始了。每个容器都很好地传递对方,而telnet也通过内部网络进行连接。这座桥上的MTU是1400。
主要问题-我们不能再从这个网络上传超过2MB的视频到S3了
其他问题
com.amazonaws.services.s3.model.AmazonS3Exception:您与服务器的套接字连接没有在超时期间被读取或写入。空闲连接将被关闭。(服务: xGGCQhESxh/Mo6ddwtGYShLIeCJYbgCRT8oGleQu/IfguEfbZpTQXG/AIzgLnG2F5YuCqk7vVE8=),S3;状态代码: 400;错误代码: RequestTimeout;请求ID: 7J2EHKVDWQP3367G;S3扩展请求ID: S3 S3扩展请求ID: xGGCQhESxh/Mo6ddwtGYShLIeCJYbgCRT8oGleQu/IfguEfbZpTQXG/AIzgLnG2F5YuCqk7vVE8=
(我们增加了所有已知的超时,无论是nginx还是tomcat)
其他要点要注意-我们允许视频高达100 mb上传,因此已知的限制在nginx和tomcat配置。
Nginx,client_max_body_size 100 m;tomcat ”
在过去的15天里,我们停止了所有的防火墙,操作系统上的ufw,proxmox防火墙,甚至数据中心防火墙。
这是我们的nginx.conf
http {
proxy_http_version 1.1;
proxy_set_header Connection "";
##
client_body_buffer_size 16K;
client_header_buffer_size 1k;
client_max_body_size 100m;
client_header_timeout 100s;
client_body_timeout 100s;
large_client_header_buffers 4 16k;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 300;
send_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;这些是我们的主要测试/调试试验。
**1. Testing with a small video (of size 273 Kb)**
a. Nginx log- clean, nothing related to operations
b. Tomcat log-
Start- CoursesServiceImpl - addCourse - Used Memory:73
add course 703
image file not null org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile@15476ca3
image save to s3 bucket
image folder name images
buckets3 lmsdev-cloudfront/images
image s3 bucket for call
imageUrl https://lmsdev-cloudfront.s3.amazonaws.com/images/703_4_istockphoto-1097843576-612x612.jpg
video file not null org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile@13419d27
video save to s3 bucket
video folder name videos
input Stream java.io.ByteArrayInputStream@4da82ff
buckets3 lmsdev-cloudfront/videos
video s3 bucket for call
video url https://lmsdev-cloudfront.s3.amazonaws.com/videos/703_4_giphy360p.mp4
Before Finally - CoursesServiceImpl - addCourse - Used Memory:126
After Finally- CoursesServiceImpl - addCourse - Used Memory:49
c. S3 bucket
[S3 bucket][1]
[1]: https://i.stack.imgur.com/T7daW.png
3. Testing with video 2 mb (fractionally less)
a. Progress bar keeps running about 5 minutes, then
b. Nginx logs-
2022/09/10 16:15:34 [error] 3698306#3698306: *24091 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 223.235.101.169, server: login.pathnam.education, request: "POST /courses/courses/course HTTP/1.1", upstream: "http://10.10.10.10:8080//courses/course", host: "login.pathnam.education", referrer: "https://login.pathnam.education/"
c. Tomcat logs-
Start- CoursesServiceImpl - addCourse - Used Memory:79
add course 704
image file not null org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile@352d57e3
image save to s3 bucket
image folder name images
buckets3 lmsdev-cloudfront/images
image s3 bucket for call
imageUrl https://lmsdev-cloudfront.s3.amazonaws.com/images/704_4_m_Maldives_dest_landscape_l_755_1487.webp
video file not null org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile@45bdb178
video save to s3 bucket
video folder name videos
input Stream java.io.ByteArrayInputStream@3a85dab9
And after few minutes
com.amazonaws.SdkClientException: Unable to execute HTTP request: Connection timed out (Write failed)
d. S3 Bucket – No entry 现在试着从我们的测试服务器上传相同的视频,然后立即上传到S3桶中。
阅读所有有类似问题的文章,大多与php.ini配置相关,因此与我们无关。
发布于 2022-09-11 06:20:35
我现在已经解决了这个问题,LXC容器中的MTU设置与虚拟交换机中的配置不同。Proxmox不允许在创建LXC容器时设置MTU (您希望使用桥MTU ),您可能会忽略这一点。
转到容器的conf文件;在我的例子中是100。
nano /etc/pve/lxc/100.conf查找并编辑这一行
net0: name=eno1,bridge=vmbr4002,firewall=1,hwaddr=0A:14:98:05:8C:C5,ip=192.168.0.2/24,type=veth若要添加mtu值,请按照最后一个开关:
name=eno1,bridge=vmbr4002,firewall=1,hwaddr=0A:14:98:05:8C:C5,ip=192.168.0.2/24,type=veth,mtu=1400 (my value at vswitch)重新启动容器以进行永久更改。
对我来说都很有魅力。希望它能帮助也使用Proxmox接口的人创建容器,从而错过了通过CLI (建议对Proxmox的增强)进行配置的功能。
https://stackoverflow.com/questions/73674762
复制相似问题