English 中文(简体)
下载多卷档案和单一一卷大案卷,通过袖珍材料
原标题:Download multiple files vs single one big file&unzip via socket

I need my client to download 30Mb worth of files.

下面是设置。

  1. They are comprised of 3000 small files.
  2. They are downloaded through tcp bsd socket.
  3. They are stored in client s DB as they get downloaded.
  4. Server can store all necessary files in memory.(no file access on server side)

I ve not seen many cases where client downloads such large number of files which I suspect due to server side s file access.
I m also worried if multiplexer(select/epoll) will be overwhelmed by excessive network request handling.(Do I need to worry about this?)

With the above suspicions, I zipped up 3000 files to 30 files. (overall size doesn t change much because the files are already compressed files(png))

Test shows, 3000 files downloading is 25% faster than 30files downloading & unzipping.
I suspect it s because client device s is unable to download while unzipping & inserting into DB, I m testing on handheld devices.. iPhone..
(I ve threaded unzipping+DB operation separate from networking code, but DB operation seems to take over the whole system. I profiled a bit, and unzipping doesn t take long, DB insertion does. On server-side, files are zipped and placed in memory beforehand.)

Im计划转而下载3 000份档案,因为下载速度更快。

I wonder what other experienced network people will say over the two strategies,
1. many small data
2. small number of big data & unzipping.

EDIT

For experienced iphone developers, I m threading out the DB operation using NSOperationQueue.
Does NSOperationQueue actually threads out well?
I m very suspicious on its performance.
-- I tried posix thread, no significant difference..

最佳回答

I m answering my own question.

It turned out that inserting many images into sqlite DB at once in a client takes long time, as a result, network packet in transit is not delivered to client fast enough.

http://www.sqlite.org/faq.html#q19

在我通过“彩虹”建议之后,它实际上超过了“单单下载战略”的“手法”。

问题回答

暂无回答




相关问题
How to upload and download file from a server using C#

I am developing a webpage in that the user can download their Resume for Edit. So I have a link to download the article. I use the following code for download. DataTable dt = user.getUserDetails(2); ...

Detecting PDF Download

I have recently added functionality for generating pdf reports to a web application. However the reports can be quite large and take some time to show the pdf download dialog. I want to show a spinner ...

Writing file to users giving sporadic error in IE

I have a very interesting issue with only specific IE implementations. I have an ASPX page that is used to write files down to the user, as part of the process the page uses the following code to ...

PHP - List of Excel files to download from Intranet Site?

I have a intranet site running PHP 5 that needs to list a folder containing only Excel files. Ideally the user needs to be able to input some search criteria (ie date) and the files would be filtered ...

Determine total size of SVN directory/trunk

Is there a way to count/calculate the total size of a svn directory if you were to checkout a revision? I have limited internet downloads so I need to know how big something is before I go and ...

Scala and html: download an image (*.jpg, etc) to Hard drive

I ve got a Scala program that downloads and parses html. I got the links to the image files form the html, Now I need to transfer those images to my hard drive. I m wondering what the best Scala ...

Downloading file with wxHTTP?

Im really stumped. Im using the wxHTTP class in wxWidgets to try and download two files. The first request succeeds but the second one fails when wxHTTP->GetInputStream is called. Between downloads, ...

热门标签