WengQiang's Blog

where there is a will, there is a way!

rocksdb 读写

rockdb read_write
rockdb read_write
  • wal: write ahead log it can be used to completely recover the data in memtable

    Options::wal_dir: the directory to store wal files Options::wal_ttl: the timeout to delete the wal file

  • memtable: the write cache of rocksdb
  • block cache: the read cache of rocksdb

    阅读全文 »

select() vs poll() vs epoll()

  1. select() int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);

  2. poll()

    1
    2
    3
    4
    5
    6
    7
    8
    int poll (struct pollfd *fds, unsigned int nfds, int timeout);

    struct pollfd {
    int fd;
    short events;
    short revents;
    };

  3. epoll() epoll_create(), epoll_ctl(), epoll_wait()

  • select() have three bitmask-based set of fds(fd-set), poll() only have signle array of fds(pollfd structure)
  • select() will reconstruct the fds, so should build each set before each call; poll() has seperate events and returned events, so it don't need.

  • select() and poll() manage everything in user mode and send sets each time to wait on, to add another fd we need to add it to the set and call select()/poll() again(); however epoll() use epoll_create to create context in the kernel mode, using epoll_ctl to update the context.

阅读全文 »

hyperledger fabric

  1. ordering service: broadcast and establish concensus
  2. identity and membership
  3. scalable dissemination(optional): An optional peer-to-peer gossip service disseminates the blocks output by ordering service to all peers
  4. smart-contract execution
  5. ledger maintenance

limitation of Order-Execute architecture

  1. sequential execution
  2. no deterministic code
  3. confidentiality of execution

fabric Execute-Order-Validation architecture

  1. node type
  • client: submit transaction proposals and broadcast them
  • peer: execute transaction proposals and validate them and maintain blockchain ledger which is append-only not all peers will execute the transaciton proposals, which called endorsing peers execute them.
  • ordering service node

  1. introduction in general, on common processor machine, Integer multiplication is many times faster than division. So dividing a numerator n by a divisor d is mathematically equivalent to multiplication by the inverse of the divisor n / d = n * (1/d)

  2. faster remainder algorithm for detail, see paperFaster Remainder by Direct Computation Applications to Compilers and Software Libraries

the faster remainder algorithm implemented in c is following(unsigned and signed):

阅读全文 »
0%