ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Margorin <rus...@gmail.com>
Subject Re: NoopSwapSpaceSpi and dynamically started caches
Date Thu, 18 Feb 2016 09:35:47 GMT
Hi all.

Sorry for asking again, but after some experiments I want to discuss
several options for grid swap policy. Some of them have odd side effects.
It's better to explicitly write them down to select the best solution.

1. Strict policy.
- @IgniteSpiConsistencyChecked(optional = false) used in FileSwapSpaceSpi
and NoopSwapSpaceSpi. Nodes with different swap providers could not coexist
in the grid.
- Cache with swap space could be start, only if all nodes in the grid has
FileSwapSpaceSpi provider enabled.
In this case if part of nodes in the grid use FileSwapSpaceSpi and other
part use NoopSwapSpaceSpi, than only random part of them will start. If the
first started node has FileSwapSpaceSpi, then all nodes with
 NoopSwapSpaceSpi will fail to start, and vice versa.
Interesting thing is that client nodes ( with Ignition.setClientMode(true))
should also has the same swap space provider as others nodes in the grid.
I.e. If nodes in the grid use FileSwapSpaceSpi, client will fail to start
if it use  NoopSwapSpaceSpi. That is strange, because client node does not
store any data, so swap policy is irrelevant to them.
Another interesting thing with client nodes is that client node with
NoopSwapSpaceSpi will never be able to start cache with swap enabled:
- if all nodes in the grid use FileSwapSpaceSpi, than client node simply
will fail to start
- if all nodes in the grid use NoopSwapSpaceSpi, than cache with swap will
not start on such nodes
2. Soft policy
- @IgniteSpiConsistencyChecked(optional = true) used in FileSwapSpaceSpi
and NoopSwapSpaceSpi. Nodes with different swap providers could coexist,
warning is printed in case of different providers.
- Cache with swap space could be start, only if all nodes in the grid has
FileSwapSpaceSpi provider enabled.
In this case success of dynamic cache with swap creation depends on order
in which the nodes start. Suppose we have node with swap (nSwap), node
without swap (nNoSwap) and a client, who just after start creates dynamic
cache with swap (cSwap).
If nSwap and nNoSwap started before cSwap, than cSwap will fail to create
cache, because not all nodes in the grid support swap space.
If nSwap started first, than started cSwap. cSwap will create cache
succesfuly. After that nNoSwap will start. And we have configuration now,
when nodes with different swap policies are coexist in grid, but cache with
swap successfully started.
3. Another option, initially suggested by Artem, is always use
FileSwapSpaceSpi if user doesn't provide SwapSpaceSpi explicitly. Probably
will get higher resources usage in this case.
4. Leave it as now, but with logging:
- @IgniteSpiConsistencyChecked(optional = true)
- log when cache with swap enabled started and there some nodes without
swap in the grid
Which option should we choose?


On Tue, Feb 16, 2016 at 2:55 PM, Yakov Zhdanov <yzhdanov@apache.org> wrote:

> I think, yes
>
> --Yakov
>
> 2016-02-16 14:19 GMT+03:00 Konstantin Margorin <ruskim@gmail.com>:
>
> > Should we use optional=false in @IgniteSpiConsistencyChecked ?
> >
> > On Tue, Feb 16, 2016 at 1:15 PM, Dmitriy Setrakyan <
> dsetrakyan@apache.org>
> > wrote:
> >
> > > Sounds good to me.
> > >
> > > On Tue, Feb 16, 2016 at 2:13 AM, Yakov Zhdanov <yzhdanov@apache.org>
> > > wrote:
> > >
> > > > Let's require that all nodes should have same swap space SPI. I think
> > we
> > > > can put @GridSpiConsistencyChecked on file swap space SPI (any other
> > > > suggestions?).
> > > >
> > > > --Yakov
> > > >
> > > > 2016-02-15 23:31 GMT+03:00 Konstantin Margorin <ruskim@gmail.com>:
> > > >
> > > > > Probably I can handle this ticket, but I want to clarify one thing.
> > > > >
> > > > > Suppose dynamic cache with enabled swap should be partitioned
> between
> > > two
> > > > > nodes with backups=1. First node started with FileSwapSpaceSpi,
> > second
> > > > with
> > > > > NoopSwapSpaceSpi.
> > > > >
> > > > > How cache should start in this case?
> > > > >
> > > > >
> > > > > On Mon, Feb 15, 2016 at 3:45 PM, Artem Shutak <
> ashutak@gridgain.com>
> > > > > wrote:
> > > > >
> > > > > > I've created a newbie issue for that:
> > > > > > https://issues.apache.org/jira/browse/IGNITE-2650.
> > > > > >
> > > > > > -- Artem --
> > > > > >
> > > > > > On Wed, Feb 10, 2016 at 8:53 PM, Dmitriy Setrakyan <
> > > > > dsetrakyan@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > Artem,
> > > > > > >
> > > > > > > I like the option with proper exception in case if a dynamic
> > cache
> > > is
> > > > > > > started with swap enabled while there was no swap configured
in
> > > > Ignite.
> > > > > > >
> > > > > > > Starting FileSwapSpaceSpi all the time is not a good option
as
> > user
> > > > > will
> > > > > > > face the same problem when trying to change to a different
SPI.
> > > > > > >
> > > > > > > D.
> > > > > > >
> > > > > > > On Wed, Feb 10, 2016 at 4:39 AM, Artem Shutak <
> > > ashutak@gridgain.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Igniters,
> > > > > > > >
> > > > > > > > I've noticed an issue with NoopSwapSpaceSpi and dynamically
> > > started
> > > > > > > cashes.
> > > > > > > >
> > > > > > > > We have the following logic on node start:
> > > > > > > >
> > > > > > > >             if (cfg.getSwapSpaceSpi() == null) {
> > > > > > > >                 boolean needSwap = false;
> > > > > > > >
> > > > > > > >                 if (cfg.getCacheConfiguration() !=
null &&
> > > > > > > > !Boolean.TRUE.equals(cfg.isClientMode())) {
> > > > > > > >                     for (CacheConfiguration c :
> > > > > > > > cfg.getCacheConfiguration()) {
> > > > > > > >                         if (c.isSwapEnabled()) {
> > > > > > > >                             needSwap = true;
> > > > > > > >
> > > > > > > >                             break;
> > > > > > > >                         }
> > > > > > > >                     }
> > > > > > > >                 }
> > > > > > > >
> > > > > > > >                 cfg.setSwapSpaceSpi(needSwap ? new
> > > > > FileSwapSpaceSpi() :
> > > > > > > new
> > > > > > > > NoopSwapSpaceSpi());
> > > > > > > >             }
> > > > > > > >
> > > > > > > > According to the code above, if IgniteConfiguration
doesn't
> > > contain
> > > > > > cache
> > > > > > > > configurations or all configured caches configured
without
> > swap,
> > > > then
> > > > > > > node
> > > > > > > > will be started with NoopSwapSpaceSpi.
> > > > > > > > As a result in this case, when we start dynamic cache
with
> > > enabled
> > > > > swap
> > > > > > > > then actually swap doesn't work.
> > > > > > > >
> > > > > > > > There is simple workaround - user have to explicitly
set
> > > > > > FileSwapSpaceSpi
> > > > > > > > to configuration. But now, there is no any warning
or
> > exception.
> > > > > > > >
> > > > > > > > What we can do:
> > > > > > > >
> > > > > > > >    1. Throw an exception on dynamic cache start (with
swap
> > > enabled)
> > > > > > > >    if NoopSwapSpaceSpi is configured.
> > > > > > > >    2. Actually, I don't see why we need NoopSwapSpaceSpi
at
> > all.
> > > I
> > > > > > think
> > > > > > > we
> > > > > > > >    should configure FileSwapSpaceSpi always if user
doesn't
> > > provide
> > > > > any
> > > > > > > >    SwapSpaceSpi explicitly.
> > > > > > > >
> > > > > > > > Thoughts?
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > -- Artem --
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message