[ 
https://issues.apache.org/jira/browse/OAK-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13790132#comment-13790132
 ] 

Thomas Mueller edited comment on OAK-924 at 10/9/13 8:05 AM:
-------------------------------------------------------------

Just an idea: What about keeping (caching) the whole namespace data fully in 
memory, in two hash tables or so (one forward mapping, one reverse mapping)? 
Then, for every write to the namespace storage, update a write counter property 
at the root of the namespace storage. When reading from the namespace (JCR 
namespace read calls), check the current write counter, and if it changed, 
rebuild the cache (re-read the whole namespace data from storage, meaning from 
the nodes, to the in-memory cache).

This would only work well if there are few writes. But if there are few writes, 
it should speed up reads a lot, as all reads would only require one lookup 
(reading the write counter property).

Another limitation would be the size of the namespace data. But as far as I 
know, there isn't all that much data.

It wouldn't require commit hooks (well, a commit hook could be used to update 
the write counter). The storage wouldn't need any indexing (redundant reverse 
mappings).


was (Author: tmueller):
Just an idea: What about keeping (caching) the whole namespace data fully in 
memory, in two hash tables or so (one forward mapping, one reverse mapping)? 
Then, for every write to the namespace storage, update a write counter property 
at the root of the namespace storage. When reading from the namespace (JCR 
namespace read calls), check the current write counter, and if it changed, 
rebuild the cache (re-read the whole namespace from storage).

This would only work well if there are few writes. But if there are few reads, 
it should speed up reads a lot, as all reads would only require one lookup 
(reading the write counter property).

It wouldn't require commit hooks (well, a commit hook could be used to update 
the write counter). The storage wouldn't need any indexing (redundant reverse 
mappings).

> Optimize namespace lookups
> --------------------------
>
>                 Key: OAK-924
>                 URL: https://issues.apache.org/jira/browse/OAK-924
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: core, jcr
>            Reporter: Jukka Zitting
>            Assignee: Jukka Zitting
>              Labels: performance
>         Attachments: OAK-924-bench.patch
>
>
> The current namespace handling code does a lot of repetitive work, which 
> shows up in hotspots like XML imports and Sling's namespace mapping code.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to