commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: HttpClient - use ConcurrentHashMap instead of HashMap?
Date Sun, 09 Jan 2011 16:20:49 GMT
Why did you post this to the commons dev list instead of http-components dev?

Ralph

On Jan 9, 2011, at 7:32 AM, sebb wrote:

> AbstractCookieSpec uses an unsynchronised  HashMap, so is not thread-safe.
> 
> AIUI, ConcurrentHashMap has much better performance than a
> synchronised HashMap - but of course we are not using synch here.
> 
> A quick test using the code at [1] (1 thread, 1 VM) appears to show
> that the performance of CHM and HM is fairly similar:
> 
> Map type:           HashMap
> Runtime:            3000
> Number of threads:  1
> Write probability:  0.6
> Remove probability: 0.02
> Ops per second:     1260837.0
> 
> Map type:           ConcurrentHashMap
> Runtime:            3000
> Number of threads:  1
> Write probability:  0.6
> Remove probability: 0.02
> Ops per second:     1313171.0
> 
> So I wonder if we should consider replacing HashMap with
> ConcurrentHashMap in Cookies and elsewhere in HttpClient?
> 
> [1] http://unserializableone.blogspot.com/2007/04/performance-comparision-between.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message