[SERVER-16515] MMAPv1 should have a singleton RecordAccessTracker, rather than creating one per database Created: 11/Dec/14  Updated: 18/Dec/14  Resolved: 12/Dec/14

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 2.8.0-rc2
Fix Version/s: 2.8.0-rc3

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-16459 Unexpectedly high non-mapped virtual ... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

The RecordAccessTracker allocates a large table in which it stores accessed addresses, in order to keep track of what data is likely in physical memory. In 2.6 versions, this table was global to the process. 2.8.0-rc2 creates a table per database, which can have a large memory footprint in the case that many databases are open on the server. Instead, MMAPv1 should keep a singleton RecordAccessTracker.



 Comments   
Comment by Githook User [ 12/Dec/14 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-16515 change RecordAccessTracker to be per-MMAPv1 engine, not per-MMAPv1 database
Branch: master
https://github.com/mongodb/mongo/commit/2a148f717998b77199c3dd3d7d4e4e47eb1141ef

Comment by David Storch [ 11/Dec/14 ]

I reproduced this as follows. First, start up a mongod instance with --smallfiles. Then create 100 databases:

for (var i = 0; i < 100; i++) { db.getSisterDB("test" + i).foo.insert({_id: 1}); }

Shut down and start a 2.6.6 mongod with the same dbpath. The mem section of server status shows the following:

> db.version()
2.6.6
> db.serverStatus().mem
{
	"bits" : 64,
	"resident" : 1637,
	"virtual" : 6654,
	"supported" : true,
	"mapped" : 3232,
	"mappedWithJournal" : 6464
}

Starting up a build of latest in master, virtual and resident memory are much higher, though mapped is the same:

> db.version()
2.8.0-rc3-pre-
> db.serverStatus().mem
{
	"bits" : 64,
	"resident" : 3641,
	"virtual" : 8667,
	"supported" : true,
	"mapped" : 3232,
	"mappedWithJournal" : 6464
}

After changing to a singleton RecordAccessTracker, the mem stats go back to what they were for 2.6.6.

> db.version()
2.8.0-rc3-pre-
> db.serverStatus().mem
{
	"bits" : 64,
	"resident" : 1640,
	"virtual" : 6665,
	"supported" : true,
	"mapped" : 3232,
	"mappedWithJournal" : 6464
}

Generated at Thu Feb 08 03:41:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.