I need my client to download 30Mb worth of files.
下面是设置。
- They are comprised of 3000 small files.
- They are downloaded through tcp bsd socket.
- They are stored in client s DB as they get downloaded.
- 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..