lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-2779) Use ReadWriteLock in RAMDirectory
Date Sun, 28 Nov 2010 06:11:37 GMT


Shai Erera commented on LUCENE-2779:

In my app, I need to server ~50 qps on a single JVM. And that JVM is dedicated entirely for
reading the index (so the 'WriteLock' will in fact never be required. I don't think this will
be a huge performance gain, but as one smart guy once said on the mailing list, if we keep
adding 1 to 1, eventually it adds up to a big gain.

So I do think RWLock is in place. Also, I think CocurrentHashMap nearly perfectly matches
here, except for the listAll() case where I still need to figure out if something will go
wrong in case the map is modified in the middle of iteration.

> Use ReadWriteLock in RAMDirectory
> ---------------------------------
>                 Key: LUCENE-2779
>                 URL:
>             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:
For additional commands, e-mail:

View raw message