[ 
https://issues.apache.org/jira/browse/LUCENE-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12964512#action_12964512
 ] 

Earwin Burrfoot commented on LUCENE-2779:
-----------------------------------------

I mean, even if aquiring locks costed you one second each, you're not going to 
notice that, as in your case it is a startup-only cost.

Look at this Directory impl I used for a while - https://gist.github.com/715617 
- it uses synchronizedMap() over HashMap.
I had around 100qps with it on 4/8-way boxes AND pretty frequent updates.
I benchmarked a switch to RWLock and it yielded zero benefits.

> Use ReadWriteLock in RAMDirectory
> ---------------------------------
>
>                 Key: LUCENE-2779
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2779
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Store
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> RAMDirectory synchronizes on its instance in many places to protect access to 
> map of RAMFiles, in addition to updating the sizeInBytes member. In many 
> places the sync is done for 'read' purposes, while only in few places we need 
> 'write' access. So I think ReadWriteLock can be useful.
> Also, syncing around sizeInBytes is unnecessary IMO, since it's an AtomicLong 
> ...
> I'll post a patch shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to