最大化同时http下载的数量 [英] Maximize the number of simultaneous http-downloads
问题描述
我试图尽可能多地同时执行http下载IPad2(ios6.0)。这纯粹用于测试此设备上可能的功能。甚至对GUI性能不感兴趣(如果它没有响应也不重要)
I'am trying to perform as many as possible simultaneous http-downloads an IPad2 ( ios6.0 ). This is pure for testing what is possible on this device. Even not interested in GUI performance ( not important if it doesn't respond )
我创建了一个特殊的HTTP服务器,它向客户端发送x分钟数据。收到的数据并不重要。我只测量了多少并发下载的速度。
我已经实现了两种不同的方式来安排12个HTTP请求。
I've created a special HTTP-server that sends for x minutes data to the client. The data received is of no importance. I just measure the speed an how many concurrent downloads. I've implemented 2 different ways of scheduling 12 HTTP-requests.
一个通过在队列中使用NSOperation对象完成并在12上设置NSOperationQueueDefaultMaxConcurrentOperationCount
One is done by using NSOperation objects in a Queue and set the NSOperationQueueDefaultMaxConcurrentOperationCount on 12
第二个实现是通过创建执行同步http请求的12个NSThreads。
The second implementation is by creating 12 NSThreads that perform a synchro http-request.
请求全部发送到同一目的地IP。
The requests are all sent to the same destination IP.
我观察到的是,在这两种情况下,第6到第12个请求都得到一个TimeOut(错误代码-1001)。如果1将超时值设置为80.0秒,我看到第1次完成后第6次下载开始。
What I observe is that in both cases the 6th to 12th request get a TimeOut ( errorcode -1001 ). If 1 put the timeout-value to 80.0 seconds, I see that the 6th download starts when the 1st is done.
- IOS中有多少并发下载限制?
- 还有其他方法可以执行这些并发下载吗?
- 有没有办法将线程绑定到核心(以便它不会得到中断,如C ++中的cpuaffinity)或线程优先级
推荐答案
您最多可以同时连接5个同一台服务器。这是iOS固定限制,可能是因为某些http协议限制。您可以阅读更多信息此处。
You can have maximum of 5 simultaneous connections to the same server. It's an iOS fixed limit and it's probably because of some http protocol constraints. You can read a bit more info here.
这篇关于最大化同时http下载的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!