4

I'm writing a back-end application which is supposed to receive request from clients and perform some operations with ignite cache. The issue is I need low-latency response time and recreating Ignite client node to perform some operation with cache is totally unacceptable.

Is it common to create Ignite client node once on application startup and then use it any time the back-end received request from client that requires some operations with Ignite cache. I mean something like that:

public class Handler{

    private static final Ignite igniteClient;
    static{
        Ignition.setClientMode(true);
        igniteClient = Ignition.start();
    } 
    private final Semaphore semaphore = new Semaphore(5);

    private void handle(){
        semaphore.acquire();
        //use igniteClient
        semaphore.release();
    }
}
St.Antario
  • 26,175
  • 41
  • 130
  • 318

1 Answers1

4

Yes, it's common to create Ignite client nodes on application startup and then reuse it.

Moreover, it's a not a good idea to create new client for each request, because it will lead to topology changes on each NODE_JOIN & NODE_LEFT events, which lead to creating new objects and connections for each client on a server nodes.

St.Antario
  • 26,175
  • 41
  • 130
  • 318
Evgenii Zhuravlev
  • 2,987
  • 1
  • 9
  • 15