Server design


In the FineDB server, there is 3 different kind of threads:

  • The main thread, which creates the other ones and then listen for incoming connections.
  • The writer thread, which role is to write asynchronously into the LMDB storage engine.
  • The communication threads. They handle communication with clients, interpreting their requests. Readings and synchronous writings are done directly; asynchronous writings are delegated to the writer thread.

Communication between threads

There is two nanomsg communication streams:

  • The first one is a PUSH/PULL fanout load-balanced stream. The main thread pushes there the file descriptor of every new incoming connection. Nanomsg distributes automatically these messages to the communication threads.
  • The second one is a PUSH/PULL fanin data stream. Communication threads use it to send data to the writer thread.



  1. TCP socket listening for new connections
  2. Nanomsg connection, used to transmit the incoming client connections to the connection threads.
  3. Reading operations are done directly on the LMDB storage engine.
  4. Synchronous writing operations are done directly too.
  5. Nanomsg connection, used to transmit asynchronous writings to the writer thread.
  6. The writer thread access directly to the LMDB storage engine.