Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BoltDB performance as a backend DB

I am thinking about using BoltDB as a backend main DB and have few question with my Go code; also need your opinion of using BoltDB as a main backend DB.

  1. I am using Go's net/http, and use boltDb as global variable.
  2. When the program starts, it will read BoltDB and the file is open until the program terminates.
  3. When requests(http) are sent to the program, it will access BoltDB. (HandleFunc)
  4. I didn't use any channel.

Q1. Most important question, is BoltDB capable for production with 1000 concurrent connection? Q2. If there were concurrent writing queries, will BoltDB automatically process one by one?

Thank you so much. I am new to Go and BoltDB and I am wondering if I am using right DB with right way.

like image 620
Gon Avatar asked Mar 30 '16 03:03

Gon


1 Answers

A1. Yes, we use it with way more than 1000 concurrent connections.

A2. Yes, bolt is thread safe, when you call db.Update, it will lock the database, so you know you data will always be consistent.

Also a hint, never do any heavy lifting inside the update func.

like image 121
OneOfOne Avatar answered Oct 06 '22 02:10

OneOfOne