ios - Maximum Concurrent Http connections per host, Alamofire? -
i'd increase maximum concurrent connections per host in swift, limited 4 default in ios.
i'm using alamofire.
- i've tried increase httpmaximumconcurrentperhost 50.
- i've tried in loop method , still limited.
- also tried wrap url request operation queue , still limited connections.
i've seen library written in obj-c tells use more 4 connection @ same time per host, don't program obj-c know if real or not. library on github
is there solution uses more concurrent connections per host?
apple says limit per session, limit can exceeded using multiple session per whole application
how can achieved ?
*i've tested internet speed , server response charles , 250 req/second, when using above methods in simulator 22 req/second.
this seems the solution:
let configuration = nsurlsessionconfiguration.defaultsessionconfiguration() configuration.httpmaximumconnectionsperhost = 50 configuration.timeoutintervalforrequest = 30 let manager = alamofire.manager(configuration: configuration)
bear in mind unless framework uses asynchronous io (and don't think nsurlsession does) limited number of cores in processor how many threads can executing concurrently. answer linked above suggests wrapping requests in nsoperation
can manage concurrency more granularly nsoperationqueue
.
Comments
Post a Comment