lishunli / nutz

Automatically exported from code.google.com/p/nutz
0 stars 0 forks source link

关于upload File时候的性能问题 #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题:nutz在解析multipart 
的请求时,解析请求,存储file到临时文件夹的效率有
待提升。

检验方法:
运行,org.nutz.mvc.upload.UploadingTest 观察处理文件时间的变化。

Original issue reported on code.google.com by amosl...@gmail.com on 31 Mar 2010 at 6:58

GoogleCodeExporter commented 9 years ago
把这Test跑起来可真费事啊

Original comment by wendal1985@gmail.com on 31 Mar 2010 at 8:43

GoogleCodeExporter commented 9 years ago
测了一下,的确比较慢.
开头用了一个50M的文件,结果一直在跑,还以为死循环了.
然后改为一个2m的文件, 耗时十几秒吧.

晚上再详细测测.

Original comment by wendal1985@gmail.com on 31 Mar 2010 at 8:55

GoogleCodeExporter commented 9 years ago
r997 修改测试代码后, 性能问题可以说是不存在的了.

Original comment by wendal1985@gmail.com on 31 Mar 2010 at 2:39

GoogleCodeExporter commented 9 years ago
对于 Uploading, 应该支持在 Mvc 中配置 BufferedStream 的缓冲大小
即,在 UploadAdaptor 的构造函数中,添加一个缓冲区大小

Original comment by zozoh...@gmail.com on 31 Mar 2010 at 3:54

GoogleCodeExporter commented 9 years ago
采用了 FastUploading, 成块读取和写入字节,速度提高了将近 
1倍

fixed in r1073,r1074

Original comment by zozoh...@gmail.com on 15 Apr 2010 at 11:48

GoogleCodeExporter commented 9 years ago
好迅速哦,我去review一下先,^_^

Original comment by wendal1985@gmail.com on 15 Apr 2010 at 12:44

GoogleCodeExporter commented 9 years ago
使用缓存8M,
FastUpload:
Begin...
.

 >      0% :          0 / 1141293731
 >      2% :   24576000 / 1141293731
 >      4% :   49152000 / 1141293731
 >      5% :   65536000 / 1141293731
 >      9% :  106496000 / 1141293731
 >     11% :  131072000 / 1141293731
......
 >     85% :  974848000 / 1141293731
 >     87% :  999424000 / 1141293731
 >     89% : 1024000000 / 1141293731
 >     91% : 1048576000 / 1141293731
 >     94% : 1073152000 / 1141293731
 >     96% : 1097728000 / 1141293731
 >     98% : 1122304000 / 1141293731
...Done!

 >    100%
Total: 95907ms : [2010-04-15 20:58:47.546]=>[2010-04-15 21:00:23.453]

SimpleUpload,依旧需要180s左右.

的确是显著提高!!

Original comment by wendal1985@gmail.com on 15 Apr 2010 at 1:06

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 13 May 2010 at 11:10

GoogleCodeExporter commented 9 years ago
Verified in 1.a.28

Original comment by wendal1985@gmail.com on 15 May 2010 at 8:29