Single or multiple instances of Ignite and IgniteCache

classic Classic list List threaded Threaded
2 messages Options
javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Single or multiple instances of Ignite and IgniteCache

I understand that Ignite and IgniteCache are thread safe...

When I create my instance of Ignite is it better to instantiate multiple
instances of both Ignite and IgniteCache or is it better to build them
through a singleton?

So far it doesn't seem to matter and it's easier to Ingnition.getOrStart()
then to try to synchronize the creation of the grid instance. Also as an
additional note Ignite is started as client only node...



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Single or multiple instances of Ignite and IgniteCache

Hello!

You can always do Ingnition.getOrStart(), it will be an effective singleton.
Same with getOrCreateCache().
Keeping an instance might be slightly faster but that should not be very important.

However, if you have more than one node you better keep explicit references to them to avoid talking to wrong instance.

Regards,
--
Ilya Kasnacheev


ср, 9 янв. 2019 г. в 01:01, javadevmtl <[hidden email]>:
I understand that Ignite and IgniteCache are thread safe...

When I create my instance of Ignite is it better to instantiate multiple
instances of both Ignite and IgniteCache or is it better to build them
through a singleton?

So far it doesn't seem to matter and it's easier to Ingnition.getOrStart()
then to try to synchronize the creation of the grid instance. Also as an
additional note Ignite is started as client only node...



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/