K
K
Kana2016-04-09 21:03:49
MongoDB
Kana, 2016-04-09 21:03:49

Do I need multiple sessions for MongoDB (mgo) in Golang?

I am writing a RESTful API in Go. Go was chosen because of the built-in tool for code parallelization (each request in its own goroutine), which allows you not to run N entities. But the mongoDB session (I use mgo) is only one, does this mean that every request will still be queued to the database? Do I need to create n sessions and knock on a free one? Or maybe it's better to run n entities then?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Pavlyuk, 2016-04-09
@kana-desu

Judging by the documentation, a connection pool is used there, that is, several connections to the database are created and requests are balanced between them.

U
UIRobot, 2015-03-12
@yenromal

In fact, no one except you can give an answer to this question, no matter what arguments one or the other side brings. We do not know the specifics, we do not know your internal affairs and how the team is organized. And what you described is suitable for 80% of any projects that are thinking about changing the platform.
I myself have been developing on rails for a year and a half, before that I led a couple of projects and I really understand your "torment" about whether it is worth climbing onto the rails.
Personally, I really liked the community around rails, for me it was a key factor.

V
Vladimir Borutkin, 2015-03-10
@Atanvar

Yes, pop is ok, very ok, hire a couple of progers, it's easier and cheaper than going to the studio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question