Giter VIP home page Giter VIP logo

Comments (8)

ptupitsyn avatar ptupitsyn commented on June 12, 2024

Ignite client is thread-safe and can handle many requests in parallel (multiplexing).

It is recommended to create only one long-lived instance (or a small pool of instances) and reuse them across all API requests.

from ignite.

satishviswanathan avatar satishviswanathan commented on June 12, 2024

@ptupitsyn - Thank you for your response.

Just to give a background of our use case. we have many microservices (with multiple instances) connect to Ignite. So basically we would be having one client / instance of a microservice. Also is there recommendation on establishing a client connection like using connection pooling in the DB world (I understand in the case of DB connection it is different as we don't reuse the connection). Just making sure I'm following the right standards for a highly transaction system.

from ignite.

ptupitsyn avatar ptupitsyn commented on June 12, 2024

I don't have any specific recommendations, it should work well with 1 client instance per microservice. Pooling is not necessary here.

from ignite.

satishviswanathan avatar satishviswanathan commented on June 12, 2024

Thank you. Appreciate your response.

from ignite.

satishviswanathan avatar satishviswanathan commented on June 12, 2024

@ptupitsyn - I have a sudo code of how my domain transaction is wrapped in a unit of work. Within the same transaction I'm trying to update by cache as well. Is this a good design approach to update by transaction DB and ignite in a single transaction. As soon as I add ignite in a transaction dotnet runtime upgrades the transaction as s 2PC resulting in npsql failure. I assume since I have a transaction opened and using ignite client put() is invoked then it joins to the existing ambient transaction as a volatile resource which is causing this.

Do you think this is possible ? From an application perspective I would like to have the state of the data in transactional DB and cache up-to-date at any point of time.


try
{
   using( var transactionScope = new TransactionScope(TransactionScopeOption.Required,
            new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
            TransactionScopeAsyncFlowOption.Enabled))
    {
    
           //NHibernate ORM using npgsql - create / update
          //Apache ignite - put() 
         
           transactionScope .Complete();
    }
}
catch
{
  // handle exception
}

from ignite.

ptupitsyn avatar ptupitsyn commented on June 12, 2024

Coordinating a transaction across two databases requires a two-phase commit: https://learn.microsoft.com/en-us/dotnet/framework/data/transactions/committing-a-transaction-in-single-phase-and-multi-phase

Thin client can only do a single-phase commit, so there is no guarantee of atomicity across two DBs.

  • This is implemented in "thick" mode and works as expected with TransactionScope. Consider using a thick client.
  • Alternatively, write your own logic to roll back the changes in DB 1 if commit fails in DB 2. Many consider this approach to be more efficient in micro-service scenarios.

from ignite.

satishviswanathan avatar satishviswanathan commented on June 12, 2024

@ptupitsyn Thank you for sharing your thoughts. If we do a saga pattern with rollback strategy then we can still stay with thin client right ?

from ignite.

ptupitsyn avatar ptupitsyn commented on June 12, 2024

If we do a saga pattern with rollback strategy then we can still stay with thin client right ?

Correct.

from ignite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.