You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Jörg Hoh <jh...@googlemail.com.INVALID> on 2022/11/15 10:11:36 UTC

Performance of caconfig

Hi all,

I am currently looking into improving performance by reducing the access to
the Sling repository. And I also came across usage of context-aware
configuration (caconfig), which can do a lot of repository calls.
Unfortunately I also found a pattern, that the same (?) call to caconfig
was done by many components on the same page. Given the nature of the Sling
repository, all these calls should return with the same result.
While I tried to optimize this on the component level I ialso understood,
that this is not always possible, and that we should rather do this at the
level of caconfig.

What is your opinion on that? I think that we could use the new
"resourceResolver.getPropertyMap()" feature to cache the results of a
caconfig lookup; that cache would actually share the lifetime of the
resourceResolver and thus be well suited to cache such data.

Jörg




-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh

Re: Performance of caconfig

Posted by Jörg Hoh <jh...@googlemail.com.INVALID>.
Hi Stefan,

long-running resource resolvers are indeed an antipattern, but as the state
does not change by default (unless a refresh is explicitly called), it
should not be a problem in the first place.

I could imagine that the typical "entrypoints" into caconfig, for example

configurationResourceResolver.getResource and
configurationResourceResolver.getResourceCollection

are responsible to check if a result for the provided parameters are
already cached. I cannot speak of any hotspots, as these are highly
dependent on the usecase,

Jörg



Am Di., 15. Nov. 2022 um 11:26 Uhr schrieb Stefan Seifert
<St...@diva-e.com.invalid>:

> hello jörg.
>
> yes, i assume there is room for improvement here. due to all the possible
> inheritance concepts, a lot of calls have to be made to follow that
> inheritance chain.
>
> introducing caching layers may help, as usual we have to do it with care.
> although an antipattern it might be possible a resource resolver is used
> long-living e.g. in an OSGi service.
>
> did you already collect some statistic data and identified some hotspots
> you want to look upon?
>
> stefan
>
> > -----Original Message-----
> > From: Jörg Hoh <jh...@googlemail.com.INVALID>
> > Sent: Tuesday, November 15, 2022 11:12 AM
> > To: Sling Developers List <de...@sling.apache.org>
> > Subject: Performance of caconfig
> >
> > Hi all,
> >
> > I am currently looking into improving performance by reducing the access
> > to the Sling repository. And I also came across usage of context-aware
> > configuration (caconfig), which can do a lot of repository calls.
> > Unfortunately I also found a pattern, that the same (?) call to caconfig
> > was done by many components on the same page. Given the nature of the
> > Sling repository, all these calls should return with the same result.
> > While I tried to optimize this on the component level I ialso understood,
> > that this is not always possible, and that we should rather do this at
> the
> > level of caconfig.
> >
> > What is your opinion on that? I think that we could use the new
> > "resourceResolver.getPropertyMap()" feature to cache the results of a
> > caconfig lookup; that cache would actually share the lifetime of the
> > resourceResolver and thus be well suited to cache such data.
> >
> > Jörg
> >
> >
> >
> >
> > --
> > Cheers,
> > Jörg Hoh,
> >
> > https://cqdump.joerghoh.de
> > Twitter: @joerghoh
>


-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh

RE: Performance of caconfig

Posted by Stefan Seifert <St...@diva-e.com.INVALID>.
hello jörg.

yes, i assume there is room for improvement here. due to all the possible inheritance concepts, a lot of calls have to be made to follow that inheritance chain.

introducing caching layers may help, as usual we have to do it with care. although an antipattern it might be possible a resource resolver is used long-living e.g. in an OSGi service.

did you already collect some statistic data and identified some hotspots you want to look upon?

stefan

> -----Original Message-----
> From: Jörg Hoh <jh...@googlemail.com.INVALID>
> Sent: Tuesday, November 15, 2022 11:12 AM
> To: Sling Developers List <de...@sling.apache.org>
> Subject: Performance of caconfig
> 
> Hi all,
> 
> I am currently looking into improving performance by reducing the access
> to the Sling repository. And I also came across usage of context-aware
> configuration (caconfig), which can do a lot of repository calls.
> Unfortunately I also found a pattern, that the same (?) call to caconfig
> was done by many components on the same page. Given the nature of the
> Sling repository, all these calls should return with the same result.
> While I tried to optimize this on the component level I ialso understood,
> that this is not always possible, and that we should rather do this at the
> level of caconfig.
> 
> What is your opinion on that? I think that we could use the new
> "resourceResolver.getPropertyMap()" feature to cache the results of a
> caconfig lookup; that cache would actually share the lifetime of the
> resourceResolver and thus be well suited to cache such data.
> 
> Jörg
> 
> 
> 
> 
> --
> Cheers,
> Jörg Hoh,
> 
> https://cqdump.joerghoh.de
> Twitter: @joerghoh