华中科技大学硕士学位论文内存数据库的存储管理姓名:蒋智鹏申请学位级别:硕士专业:通信与信息系统指导教师:王芙蓉20080501IMMDBI/OcachDBcachDBcachDBcachDBcachDB50M20%~25%cachDBIIAbstractWiththedevelopmentofscienceandtechnologyrequirementofnewapplicationandmaturityofobjectivecondition(increaseofmemorycapacity)makestheMMDB(MainMemoryDatabase)cameintobeing.MMDBputtheworkversionofdatabaseinmemory,soI/Oofdiskwillnotbebottleneckanymore,thegoalofdesigningMMDBwillbetransferredtoefficientlyemployingCPUandmainmemory.AsthestoragemanagementmoduleisthecoreoftheMMDB,thestrategiesofstoragemanagementdirectlyrelatedtotheperformanceofMMDBsystem.ThispaperfirstIntroducedtheconceptofMMDBandtheresearchstatusathomeandabroad,thenanalyzethekeytechnologiesofstoragemanagement,includingthestoragelayerstructureofMMDB,themanagementofmemoryspace,theOrganizationalstructureofMMDB,thestoragemodelofMMDB,thestoragestructureofMMDB,etc.OnthebasisofathoroughunderstandingthekeytechnologiesusedinstoragemanagementofMMDB,therealizationofstoragemanagementmoduleofMainMemoryDatabasecachDBisgiven,mainlydescribethestrategieusedinthestoragemanagementofcachDB,asaimprovementof“memorypoolstrategy”,cachDBgivesasolutionbasedonmemorypageforthemanagementofmemory.Troughthese,cachDBcouldfindanddistributetheavailablememoryspacequicklyandensuretheutilizationofmemoryspace.Thispaperalsoproposeastoragestructurethatstorethecombinationofindexandrecord,thustheinsertoperationofMMDBissimplifiedandtheutilizationofmemoryisimproved.thetestandanalysistellsusthatcachDBcouldfindanddistributavailablememoryquickly(about50MByte/second),andcouldmakegooduseofmemoryspaceofMMDB.TestalsoprovedthatthecombinationofindexandrecordcouldsimplifytheoperationofMMDB,theinsertionrateisincreasedby20%to25%thanbefore,andtheMMDBconsumedlessmemorythanbefore,theutilizationofthememoryisimproved.Keywords:MainMemoryDatabase(MMDB);StrorageManagement;cachDB;MemoryManagement 111.1DiskResidentDatabaseDRDBDRAMbitDRAM201G2G324G4G4G643264642642[1]MainMemoryDatabase2MMDB[2]1.2DRDB,DRDBI/OI/OI/OI/OI/OI/OI/OI/OMMDBI/OCPU:1.1/02.33.4.I/OMMDBI/O()MMDB1/O:I/O[3]DB,TADBD(T)TTTA,DBM(t)tDBWT(t)tTATWT(t)D(T)DBM(t)DB1.32080201.4MMDBNV-RAM,UPSRAM[5]2.MMDB[8]-[10]AVL[12]3.[14][17],[18]4.CPUcacheTLB[8]hashing[19][21]5.MMDBFUZZY(),BLACK/WHITE(/),COPY-ON-UPDATE()[22]-[23]CPU[24][25]OracleBerkeleyDBSQLiteFastDBMcObjecteXtremDB1.151.1BerkeleyDBOracleBerkeleyDBAPIBerkeleyDBKEY/VALUESQLiteSQLiteSQLExtremeDBMcObjectExtremDBSQLRAMAPIFastDBFastDBSQLC++fastDB1.46cachDBcachDBcachDBcachDB1.57cachDBcachDBcachDBcachDBcachDB5123cachDBcachDB4cachDBcachDBcachDBcachDB85922.1,,,,cachDB2.2MMDB[5],[7]-[12]4M1M2M310M4M1M2M3M42.1VolatileMemoryM1M1M1M1M1Non-VolatileMemoryM2M1M2M211M3M4M1M3SQLite,FastDB,eXtremDBBerkeleyDBcachDBM1M3M2M4M1M2,M2M4M1M12.32.2,,2.3.112[27]MMDB[28][29]323224GDLL,DLL32windows2.213EXE/DLLWindowsDLLWindows2.22.2324GexeDLLDLLI/OwindowscreateFileMapping14mapViewOfFile323224G4GBCPU(commit)RAM2.3.22.3.115162.3.2.1[30]FastDB,ARTs-EDB2.3.00100000000000000000000112.32.3162161016171/1280102.3.2.2[34]eXtremeDB2.418Block1Block2MemorySize=M2FreeBlock=n2MemorySize=M1FreeBlock=n1MemorySize=M3FreeBlock=n3Blockn1Block1Block2Blockn3Block1Block2Blockn22.42.4cachDBcachDB19cachDB3cachDB2.4I/OI/OI/OCPU2.4.12.4.1.1[1],[35]202.5123n...1n...21n...243212.5P,S,LPSL21,SQLite,cachDBcachDB2.4.1.2[36]-[37]2.6-TablesPtr-...-...-...DatabaseObject-IndexType-IndexNodePtr-...-...IndexObject-Field1-Field2-...-...-Fieldn-TimeStamp-NextPtr-PrePtrRecordObject-Data-RecordPtr-lPtr-rPtrIndexNodeObject-RecordPtr-RecordNum-IndexPtr-...-...TableObject-RecordPtr-RecordNum-IndexPtr-...-...TableObject-RecordPtr-RecordNum-IndexPtr-...-...TableObject-IndexType-IndexNodePtr-...-...IndexObject-Data-RecordPtr-lPtr-rPtrIndexNodeObject-Data-RecordPtr-lPtr-rPtrIndexNodeObject-Field1-Field2-...-...-Fieldn-TimeStamp-NextPtr-PrePtrRecordObject-Field1-Field2-...-...-Fieldn-TimeStamp-NextPtr-PrePtrRecordObject2.622fastDB2.4.2hashT2.4.2.1hashhash[38]-[39]hashhashhashhashhashhashhashhash2.7HashValue1HashValuenHashValuen-1........HashValue2HashFieldValueAddressFieldValueAddressFieldValueAddressFieldValueAddressFieldValueAddressFieldValueAddressHash2.7hash2.7hashhashhashhashhashhashhashhash23hashhashhashhashhashhashhashhashhashhashhash2.4.2.2TB[40]BI/OBBBAVLT[40]T2.8Data1Data2DatanLchildRchildTnodeTnodeTnodeTnodeTnodeTnodeT2.8TT24Greatlowerbound,GLBLowerupperbound,LUBTTTTAVLAVLThashTcachDB2.5N-Array[44],45[47]2.5.1N-ArrayN-ArrayN-ArrayN-Array2.925Slot1Slot2Slot32Field1Field2Fieldn1Field1Field2Fieldn3Field1Field2Fieldn2.9N-ArrayN-ArrayN-ArrayN-ArrayN-Array2.5.22.10261Field12Field13Field11Field22Field23Field21Fieldn2Fieldn3Fieldn1122nn2.10N-Array[44]N-ArraycachDBSQLitefastDBeXtremDBN-Array272.6G1.[39]2.[50]-[51][52]2.728293cachDB3.1cachDBcachDBcachDB2cachDB3.2cachDBcachDBcachDB3.1cachDBcachDB3.1cachDBcachDB30,,,cachDBhashTcachDBcachDBcachDBXMLcachDBcachDBcachDBcachDBcachDBcachDBcachDBcachDB31cachDBcachDB2cachDBcachDBcachDBcachDBcachDBhashTcachDBN-ArraycachDB3.3cachDBcachDBcachDBcachDBcachDBcachDBcachDBcachDBcachDB323.3.1cachDBcachDBcreatShareMemcr