Why one of secondary mongo instance is utilizing high memory while other secondary instance very less?

94 views
Skip to first unread message

Mukesh Kumar

unread,
Dec 9, 2015, 9:37:14 AM12/9/15
to mongodb-user
I have 3 member replica set, Primary is utilizing 6 GB, one secondary- 4 GB and another secondary 13 GB. Primary is for write only and secondary is for read only. I still don't understand, why one of secondary mongo instance is utilizing triple memory as of another mongo instance.
DB size- 24 GB, RAM on primary- 16GB, 32 GB on both secondary mongo instance.

I have also checked mongostat and in res it shows 14.2g(in high utilized secondary mongo instance) and in another one it shows about 4.1g of res.

Please let me know if further details needed.

Dwight Merriman

unread,
Dec 9, 2015, 10:33:18 AM12/9/15
to mongodb-user
there are several possible reasons.  the simplest would be the 13GB one has been up without reboot longer than the other one.  As time and queries pass, pages will fault into the file system cache.  the more recently rebooted box, will not have as much paged in.

i'm assuming you are using mmap storage engine when I say this.  

it is normal with mmap for ALL free memory on the server to be used for caching, in the file system cache.  It will be released on an as-needed basis by the OS, as need.  This file system cache memory is reported as part of the mongod's resident bytes, the portion which caches database file pages.  So if that is what is happening, everything is fine.

Please let us know what version of mongodb you are using and which storage engine, mmap or wiredtiger.

Mukesh Kumar

unread,
Dec 9, 2015, 10:58:29 AM12/9/15
to mongodb-user
Yes, We are using Mongo v2.6.10, mmap. Both the machine has been rebooted 4 days back.

Mukesh Kumar

unread,
Dec 9, 2015, 11:02:00 AM12/9/15
to mongodb-user
Please let me know if it's normal behavior or should I have to do something or if you need more info please let me know.

Asya Kamsky

unread,
Dec 9, 2015, 8:32:17 PM12/9/15
to mongod...@googlegroups.com
First, please check if both/all machines are configured the same way, especially disk.  For example, high read ahead can manifest this way sometimes. 

But also keep in mind that your secondary is not read-only - it has to handle all of the writes that the primary does.  

Asya
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/9f07e2c7-e17f-4e5c-becc-ee53d8f898c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Asya Kamsky
Lead Product Manager
MongoDB
Download MongoDB - mongodb.org/downloads
Free MongoDB Monitoring - cloud.mongodb.com
Free Online Education - university.mongodb.com
Get Involved - mongodb.org/community
We're Hiring! - https://www.mongodb.com/careers

Mukesh Kumar

unread,
Dec 10, 2015, 2:27:32 AM12/10/15
to mongodb-user
Hi Asya,


First, please check if both/all machines are configured the same way, especially disk.  For example, high read ahead can manifest this way sometimes.
- Both the secondary machine has been configured same way, only read operation is happening on both the secondary. One secondary instance is using 14GB of RAM while another secondary instance is using about 5GB only. I want to know about this part

But also keep in mind that your secondary is not read-only - it has to handle all of the writes that the primary does. 

-Our secondary instance is for read only operations, and write is happening on primary.



On Thursday, December 10, 2015 at 7:02:17 AM UTC+5:30, Asya Kamsky wrote,:
First, please check if both/all machines are configured the same way, especially disk.  For example, high read ahead can manifest this way sometimes. 

But also keep in mind that your secondary is not read-only - it has to handle all of the writes that the primary does.  

Asya


On Wednesday, December 9, 2015, Mukesh Kumar <mukesh.m...@gmail.com> wrote:
Please let me know if it's normal behavior or should I have to do something or if you need more info please let me know.

On Wednesday, December 9, 2015 at 9:28:29 PM UTC+5:30, Mukesh Kumar wrote:
Yes, We are using Mongo v2.6.10, mmap. Both the machine has been rebooted 4 days back.

On Wednesday, December 9, 2015 at 9:03:18 PM UTC+5:30, Dwight Merriman wrote:
there are several possible reasons.  the simplest would be the 13GB one has been up without reboot longer than the other one.  As time and queries pass, pages will fault into the file system cache.  the more recently rebooted box, will not have as much paged in.

i'm assuming you are using mmap storage engine when I say this.  

it is normal with mmap for ALL free memory on the server to be used for caching, in the file system cache.  It will be released on an as-needed basis by the OS, as need.  This file system cache memory is reported as part of the mongod's resident bytes, the portion which caches database file pages.  So if that is what is happening, everything is fine.

Please let us know what version of mongodb you are using and which storage engine, mmap or wiredtiger.

On Wednesday, December 9, 2015 at 9:37:14 AM UTC-5, Mukesh Kumar wrote:
I have 3 member replica set, Primary is utilizing 6 GB, one secondary- 4 GB and another secondary 13 GB. Primary is for write only and secondary is for read only. I still don't understand, why one of secondary mongo instance is utilizing triple memory as of another mongo instance.
DB size- 24 GB, RAM on primary- 16GB, 32 GB on both secondary mongo instance.

I have also checked mongostat and in res it shows 14.2g(in high utilized secondary mongo instance) and in another one it shows about 4.1g of res.

Please let me know if further details needed.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.

Wan Bachtiar

unread,
Dec 15, 2015, 6:46:52 PM12/15/15
to mongodb-user

-Our secondary instance is for read only operations, and write is happening on primary.

Hi Mukesh,

Your secondary instances are also handling write operations. Each of the secondary has to maintain a copy of the primary data set through replication, by applying operations from the primary’s oplog in an async process.

For more info on replication, please see Replication Concepts.


Primary is for write only and secondary is for read only. I still don’t understand, why one of secondary mongo instance is utilizing triple memory as of another mongo instance.

If you are reading from secondaries, how do the client applications connect to them ? Perhaps one secondary instance receive more connections from the client applications, and has to process more queries than the other secondary.

See Replication Read Preference for more information on secondary reads.


Regards,

Wan.

Reply all
Reply to author
Forward
0 new messages