You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@druid.apache.org by JJ Meyer <jj...@gmail.com> on 2019/12/27 15:50:34 UTC

8399 Migrating Guava to Caffeine

Hello all,

I'm planning on contributing for the first time. I'm working on
https://github.com/apache/druid/issues/8399. No issues seem to occur when
replacing guava with caffeine in any of the classes posted in the issue
with exception of the class, OnHeapLoadingCache.

I wanted to post something here as I believe it will require a config
change to use caffeine in this case. (
https://druid.apache.org/docs/latest/development/extensions-core/druid-lookups.html#example-loading-on-heap-guava).
It seems as if guava's `concurrencyLevel` is not a property in caffeine's
cache. Currently there are types `guava` and `mapDb`. To prevent a config
change a third cache type, caffeine, can be added and the guava cache can
be marked as deprecated and potentially removed in some future major
release. The configs would be identical to the guava type with exception of
`concurrencyLevel` (it will be removed for the caffeine option).

What do you all think of this? Is there another solution that is preferred?

Thanks,
JJ

Re: 8399 Migrating Guava to Caffeine

Posted by Gian Merlino <gi...@apache.org>.
That's a good suggestion, especially since the extension has this note
"Please note that this is an experimental module and the
development/testing still at early stage. Feel free to try it and give us
your feedback." I think I'd actually prefer Roman's suggestion.

On Mon, Jan 6, 2020 at 8:55 AM Roman Leventov <le...@gmail.com> wrote:

> To avoid lingering of Guava for a few more Druid releases in code, the
> "guava" config value could just forcibly use caffeine cache,
> concurrencyLevel parameter ignored, and appropriate warning messages
> logged. There is no harm in this, Caffeine's concurrency is practically
> "elastic" and doesn't demand concurrencyLevel.
>
> On Mon, 6 Jan 2020 at 01:13, Gian Merlino <gi...@apache.org> wrote:
>
> > Hey JJ,
> >
> > I think your idea of adding a new option and deprecating "guava" is a
> good
> > way forward.
> >
> > Gian
> >
> > On Fri, Dec 27, 2019 at 7:50 AM JJ Meyer <jj...@gmail.com> wrote:
> >
> > > Hello all,
> > >
> > > I'm planning on contributing for the first time. I'm working on
> > > https://github.com/apache/druid/issues/8399. No issues seem to occur
> > when
> > > replacing guava with caffeine in any of the classes posted in the issue
> > > with exception of the class, OnHeapLoadingCache.
> > >
> > > I wanted to post something here as I believe it will require a config
> > > change to use caffeine in this case. (
> > >
> > >
> >
> https://druid.apache.org/docs/latest/development/extensions-core/druid-lookups.html#example-loading-on-heap-guava
> > > ).
> > > It seems as if guava's `concurrencyLevel` is not a property in
> caffeine's
> > > cache. Currently there are types `guava` and `mapDb`. To prevent a
> config
> > > change a third cache type, caffeine, can be added and the guava cache
> can
> > > be marked as deprecated and potentially removed in some future major
> > > release. The configs would be identical to the guava type with
> exception
> > of
> > > `concurrencyLevel` (it will be removed for the caffeine option).
> > >
> > > What do you all think of this? Is there another solution that is
> > preferred?
> > >
> > > Thanks,
> > > JJ
> > >
> >
>

Re: 8399 Migrating Guava to Caffeine

Posted by Roman Leventov <le...@gmail.com>.
To avoid lingering of Guava for a few more Druid releases in code, the
"guava" config value could just forcibly use caffeine cache,
concurrencyLevel parameter ignored, and appropriate warning messages
logged. There is no harm in this, Caffeine's concurrency is practically
"elastic" and doesn't demand concurrencyLevel.

On Mon, 6 Jan 2020 at 01:13, Gian Merlino <gi...@apache.org> wrote:

> Hey JJ,
>
> I think your idea of adding a new option and deprecating "guava" is a good
> way forward.
>
> Gian
>
> On Fri, Dec 27, 2019 at 7:50 AM JJ Meyer <jj...@gmail.com> wrote:
>
> > Hello all,
> >
> > I'm planning on contributing for the first time. I'm working on
> > https://github.com/apache/druid/issues/8399. No issues seem to occur
> when
> > replacing guava with caffeine in any of the classes posted in the issue
> > with exception of the class, OnHeapLoadingCache.
> >
> > I wanted to post something here as I believe it will require a config
> > change to use caffeine in this case. (
> >
> >
> https://druid.apache.org/docs/latest/development/extensions-core/druid-lookups.html#example-loading-on-heap-guava
> > ).
> > It seems as if guava's `concurrencyLevel` is not a property in caffeine's
> > cache. Currently there are types `guava` and `mapDb`. To prevent a config
> > change a third cache type, caffeine, can be added and the guava cache can
> > be marked as deprecated and potentially removed in some future major
> > release. The configs would be identical to the guava type with exception
> of
> > `concurrencyLevel` (it will be removed for the caffeine option).
> >
> > What do you all think of this? Is there another solution that is
> preferred?
> >
> > Thanks,
> > JJ
> >
>

Re: 8399 Migrating Guava to Caffeine

Posted by Gian Merlino <gi...@apache.org>.
Hey JJ,

I think your idea of adding a new option and deprecating "guava" is a good
way forward.

Gian

On Fri, Dec 27, 2019 at 7:50 AM JJ Meyer <jj...@gmail.com> wrote:

> Hello all,
>
> I'm planning on contributing for the first time. I'm working on
> https://github.com/apache/druid/issues/8399. No issues seem to occur when
> replacing guava with caffeine in any of the classes posted in the issue
> with exception of the class, OnHeapLoadingCache.
>
> I wanted to post something here as I believe it will require a config
> change to use caffeine in this case. (
>
> https://druid.apache.org/docs/latest/development/extensions-core/druid-lookups.html#example-loading-on-heap-guava
> ).
> It seems as if guava's `concurrencyLevel` is not a property in caffeine's
> cache. Currently there are types `guava` and `mapDb`. To prevent a config
> change a third cache type, caffeine, can be added and the guava cache can
> be marked as deprecated and potentially removed in some future major
> release. The configs would be identical to the guava type with exception of
> `concurrencyLevel` (it will be removed for the caffeine option).
>
> What do you all think of this? Is there another solution that is preferred?
>
> Thanks,
> JJ
>