Code Monkey home page Code Monkey logo

Comments (4)

calvin2021y avatar calvin2021y commented on August 23, 2024

snapshot should be execute by async with a callback.

User can choice to do the work in same thread or by uv_work_t, or create a new thread.

from raft.

MathieuBordere avatar MathieuBordere commented on August 23, 2024

It's not as simple as just moving the work to a thread, we need to snapshot the state of the database and write it to disk without taking into account changes to the database that happen in meanwhile. It's more of a dqlite problem where the copying (memcpy) of the state of the database takes all the time and happens in the main loop because then we are sure the database is not changing underneath us. I'm looking to take snapshots with copy-on-write behavior using more or less what's described here https://stackoverflow.com/questions/10998943/get-the-copy-on-write-behaviour-of-forking-without-fork.

In that way, we could take a 'quick' snapshot in the main loop without all the memcpy work and write it to disk without worrying that the data in meanwhile has changed.

from raft.

calvin2021y avatar calvin2021y commented on August 23, 2024

I find dqlite design is not suit for my use case, so I plan to use raft without dqlite.

On my design the sanpshot can be take from other thread without block main event loop, that is why I ask for this. (it is like copy-on-write solution)

from raft.

MathieuBordere avatar MathieuBordere commented on August 23, 2024

For now we will monitor the dqlite improvement in canonical/dqlite#356 and reopen asynchronous snapshots #268 when truly needed.

from raft.

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.