hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tatu Saloranta <cowtownco...@yahoo.com>
Subject Re: MultithreadedHttpConnectionManager and high loads
Date Tue, 28 Oct 2008 16:19:03 GMT
--- On Mon, 10/27/08, sebb <sebbaz@gmail.com> wrote:

> From: sebb <sebbaz@gmail.com>
> Subject: Re: MultithreadedHttpConnectionManager and high loads
> To: "HttpClient User Discussion" <httpclient-users@hc.apache.org>
> Date: Monday, October 27, 2008, 12:03 PM
> On 27/10/2008, De Groot, Cees
> <cdegroot@marktplaats.nl> wrote:
> > Hi,
> >
> >  We're using HC in order to access an internal
> high-volume service
> >  (thousands reqs/sec), and we noticed that
> DefaultHttpParams is
> >  synchronized all over the place. This kills
> concurrency (I have a thread
> >  dump showing ~1200 threads waiting there ;-)), and I
> don't think it is
> >  necessary - it should be possible to read settings
> without having to
> >  acquire locks first.
> 
> That's not necessarily true. Synchronize does more than
> provide mutual exclusion - i.e. locking - it also ensures that fields
> written in one thread are correctly seen in another.

This is certainly correct and good point (details of how the memory view syncing is done can
be even more complicated than simple flush, conceptually it's a memory barrier). For anyone
unfamiliar with the concept (mutex and memory consistency) should read "Java Memory Model"
article:

http://www.cs.umd.edu/~pugh/java/memoryModel/

Anyway, one thing I was wondering was whether syncs (or, the alternative, using volatile)
could still be avoided for default values.
This because it would seem like such values would be immutable?

-+ Tatu +-



      

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message