使用HTTPS在本地主机上上传文件时,Tomcat速度非常慢

时间:2018-11-08 08:26:40

标签: performance tomcat https localhost

使用HTTPS在本地主机上上传文件时,Tomcat速度非常慢

Host1:
  IP: 192.168.9.13
  VIP: 192.168.9.12
  Service: nginx+keepalived,tomcat
Host2:
  IP: 192.168.9.14
  Service: nginx+keepalived,tomcat
Tomcat:
  Http Port: 8080
  Https Port: 8124
Nginx:
  Https Port: 8443

nginx上游使用ip_hash

当nginx和tomcat是同一主机时,这非常慢,就像这样:

Client-----(https)----->Nginx-----(https)----->Tomcat
                    192.168.9.13            192.168.9.13

因此,跳过nginx以测试上传文件

主机1 192.168.9.13:

HTTP request:
$ time curl -X POST http://192.168.9.13:8080/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 9035cf1720554bb7a912fb208ebc4c1c"
real    0m0.430s
user    0m0.007s
sys     0m0.028s

$ time curl -X POST http://192.168.9.14:8080/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 25f3ad9323744c7aab00f53950369f0c"
real    0m0.430s
user    0m0.013s
sys     0m0.023s

HTTPS request
$ time curl -k -X POST http://192.168.9.13:8124/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 9035cf1720554bb7a912fb208ebc4c1c"
real    4m18.691s
user    0m0.285s
sys     0m0.067s

$ time curl -k -X POST http://192.168.9.14:8124/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 25f3ad9323744c7aab00f53950369f0c"
real    0m0.430s
user    0m0.011s
sys     0m0.022s

主机2 192.168.9.14:

HTTP request:
$ time curl -X POST http://192.168.9.13:8080/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 9035cf1720554bb7a912fb208ebc4c1c"
real    0m0.430s
user    0m0.009s
sys     0m0.027s

$ time curl -X POST http://192.168.9.14:8080/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 25f3ad9323744c7aab00f53950369f0c"
real    0m0.430s
user    0m0.013s
sys     0m0.025s

HTTPS request
$ time curl -k -X POST http://192.168.9.13:8124/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 9035cf1720554bb7a912fb208ebc4c1c"
real    0m0.430s
user    0m0.010s
sys     0m0.027s

$ time curl -k -X POST http://192.168.9.14:8124/secwechat/admin/app/upload -F "apk=@/home/temp/QQ_7.6.3.apk" -H "token: 25f3ad9323744c7aab00f53950369f0c"
real    4m32.329s
user    0m0.290s
sys     0m0.081s

根据结果,当Clientproxy是与tomcat服务器相同的主机,并且tomcat使用SSL时,文件上传非常慢。

我该如何解决这个问题?

0 个答案:

没有答案