How to understand the connection of mongodb

mongodb also seems to have the concept of connection pooling. The default maximum number of connections is 1024, and each connection consumes a certain amount of memory resources.

How to understand this "connection" of

mongobd? For example, in node, only one process starts the node program, and when starting the application, the account password is configured and the database is specified. As the program starts to connect to the Mongobd database automatically, is a connection to mongodb established?

the launched node program receives a lot of http requests, and in each request operation, the previously created connection object is called to perform the operation on the mongodb. That is, no matter how many http requests node receives, doesn"t it always have only one connection to mongodb operating on the database? How to understand the number of connections in mongodb? If so, the default maximum of 1024 connections does not seem to be needed.

Nov.24,2021

mongodb also seems to have the concept of connection pool. The default maximum number of connections is 1024
.

has the concept of connection pooling, but 1024 doesn't know what it means. The maximum connection on the server is 65000, and the maximum number of client Java/C-sharp is 100 by default. The number of NodeJS correctly should be 5 (because it is single-threaded). 1024 probably refers to ulimit? This is the maximum number of open files given by the operating system by default. Everything in Linux is a file, so this limit is also limited to the number of network connections.

how to understand this "connection" of mongobd? For example, in node, only one process starts the node program, and when starting the application, the account password is configured and the database is specified. As the program starts to connect to the Mongobd database automatically, is a connection to mongodb established?

to

the started node program receives a lot of http requests, and in each request operation, the previously created connection object is called to perform the operation on the mongodb. That is, no matter how many http requests node receives, doesn't it always have only one connection to mongodb operating on the database? How to understand the number of connections in mongodb? If so, the default maximum of 1024 connections does not seem to be needed.

you actually mentioned the concept of connection pooling. In fact, no matter when using MongoClient or MongoDatabase objects, connection pooling is running, and more connections will be created according to your concurrency to meet the needs of all requests. Note that NodeJS is a single-threaded asynchronous non-blocking operation, so the number of requests is not necessarily equal to the number of connections. But it's all about the client. As mentioned earlier, 1024 if it refers to the server-side ulimit, the server may face multiple clients, and the number of connections is the sum of the number of client connections. And 1024 refers not only to the number of connections, it includes all the handles that the server can open, so opening a data file, an index, and a connection takes up one of the 1024. So 1024 is usually not enough and should be adjusted.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e460fc-66525.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e460fc-66525.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?