Re: [Newbie] best strategy for querying multiple servers at a time



Thanks for this answer. I will try libsoup this way in future.

2010/3/23 Dan Winship <danw gnome org>:
> On 03/23/2010 09:14 AM, Guilhem Bonnefille wrote:
>> The question is: what design should I select:
>> - a single SoupSessionAsync, queuing all requests to all servers?
>> - a SoupSessionAsync per server?
>
> A single session. SoupSession already has the logic for dealing with
> requests to multiple servers. Even WebKitGTK only uses a single
> SoupSession. (In general, the only reason you'd need to create multiple
> sessions is if you need the two session to behave differently. Eg,
> having two different sets of passwords or cookies for a single server.)
>
>> For a concrete example, imagine I need to download tiles from servers
>> s1 and s2. At a selected zoom level, I need to download 9 tiles on
>> each servers. So, I queue all the 18 requests. But, s1 is faster than
>> s2 (for example twice faster). So, I wished to retrieve 2 tiles from
>> s1 and 1 tile from s2, then 2 tiles from s1 and 1 tile from s2... and
>> so on. And I don't want to download all tiles from s1 BEFORE
>> downloading tiles from s2.
>
> That's basically what would happen, except that by default libsoup will
> send 2 requests at a time per server (as configured by SoupSession's
> "max-conns-per-host" property). So at time=0 it would send out 2
> requests to each server. At time=1 it would get back responses from s1,
> and send out 2 more requests. At time=2 it would get back responses to
> the second set of s1 requests and the first set of s2 requests, and then
> send out 2 new requests to each server, etc. So the s1 requests will
> finish first (at time=5), but the s2 requests will be halfway done at
> that point.
>
> -- Dan
>



-- 
Guilhem BONNEFILLE
-=- JID: guyou im apinc org MSN: guilhem_bonnefille hotmail com
-=- mailto:guilhem bonnefille gmail com
-=- http://nathguil.free.fr/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]