CUBRID InsideFirst Look Inside CUBRIDJan 18, 2009
저작권 Copyright NoticeCREATIVE COMMONS 저작자표시-동일조건변경허락 2.0 대한민국이용자는 아래의 조건을 따르는 경우에 한하여 자유롭게이 저작물을 복제, 배포, 전송, 전시, 공연 및 방송할 수 있습니다.이차적 저작물을 작성할 수 있습니다.다음과 같은 조건을 따라야 합니다:저작자표시. 귀하는 원저작자를 표시하여야 합니다. What does "Attribute this work" mean? The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well. 동일조건변경허락. 귀하가 이 저작물을 개작, 변형 또는 가공했을 경우에는, 이 저작물과 동일한 이용허락조건하에서만 배포할 수 있습니다. 귀하는, 이 저작물의 재이용이나 배포의 경우, 이 저작물에 적용된 이용허락조건을 명확하게 나타내어야 합니다.저작권자로부터 별도의 허가를 받으면 이러한 조건들은 적용되지 않습니다.Nothing in this license impairs or restricts the author's moral rights.CREATIVE COMMONS Attribution-Share Alike 2.0 KoreaYou are free:to Share — to copy, distribute and transmit the workto Remix — to adapt the workUnder the following conditions:Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). What does "Attribute this work" mean? The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.Any of the above conditions can be waived if you get permission from the copyright holder.Nothing in this license impairs or restricts the author's moral rights.http://creativecommons.org/licenses/by-sa/2.0/kr/Copyright 2009 Search Solution Corporation. All Rights Reserved.
CUBRID
ContentsSystem Architecture and ProcessesDesign & Implementation ConceptsModule and Source StructureIn The Next CUBRID Inside4/41   First Look Inside CUBRID
What is CUBRID?
System Architecture
CUBRID Processes and IPC
Query Processing WorkflowSystem Architecture and Processes15/41   First Look Inside CUBRID
System Architecture and ProcessesWhat is CUBRID?CUBRID isOpen Source DBMS owned and developed by NHNHosted at nForge siteTargeted to a database platform for Internet portal serviceRelational database system with object extensions – Object-Relational Model1,000,000 line of source code scaled projectEngine – C/C++, CUBRID Manager (GUI) and JDBC driver – JavaCUBRID providesFull-featured database server engineServer and Broker architectureGUI management and query toolCUBRID ManagerVarious API (JDBC, ODBC(OLE DB), PHP, and CCI)Python and Ruby as contributed projects1.16/41   First Look Inside CUBRID
System Architecture and ProcessesSystem Architecture1.2Server SubsystemMulti-threaded storage engine part which runs as DB serverConsists of Transaction Manager, Object Manager, Lock Manager, Query Manager, Log Manager, and Storage ManagerClient SubsystemClient library part providing native C APIConsists of Query Parser & Optimizer, Object & Lock Cache, Transaction Manager and Object ManagerBroker SubsystemLinked with client library and implemented CCI protocolDoes job queuing, connection pooling, monitoring and loggingConnectorsJDBC driverCCI libraryMany drivers are implemented with CCI library – ODBC, OLEDB, PHP, Python, and Ruby7/41   First Look Inside CUBRID
System Architecture and ProcessesSystem Architecture1.2CUBRIDManagerGUIInterfacePHPOLE DBRubyCUBRIDManagerJDBCODBCCCIPythonCM ServerJobQueuingMonitoringConnectionPoolingLoggingAdminUtilityBrokerCreate, Delete, Copy, RenameQueryParser &OptimizerLockCacheObjectManagerTransactionManagerAdd VolumeLoad /UnloadBackup /RestoreQueryManagerLockManagerServerCompact /OptimizeStorageManagerLogManagerCheck /DiagActiveLogFile BasedObjectsDataVolumeIndexVolumeTempVolumeArchiveLog8/41   First Look Inside CUBRID
1.2CUBRIDManagerGUIInterfacePHPOLE DBRubyCUBRIDManagerJDBCODBCCCIPythonCM ServerCreate, Delete, Copy, RenameJobQueuingMonitoringConnectionPoolingLoggingAdminUtilityBrokerClient LibraryAdd VolumeNative C APIParserObjectManagerSchemaManagerTransactionManagerLoad /UnloadQueryTransformWorkspace ManagerBackup /RestoreQueryOptimizerMemory ManagerCompact /OptimizePlanGenerationCheck /DiagCommunication ModuleStorage EngineServerCommunication ModuleTransactionManagerLogManagerLockManagerQueryManagerAccessMethodB+TreeModuleFile ManagerSystemCatalog ModuleSystem ArchitectureBuffer ManagerDisk ManagerActiveLogFile BasedObjectsDataVolumeIndexVolumeTempVolumeArchiveLog9/41   First Look Inside CUBRID
System Architecture and ProcessesCUBRID Processes and IPCMaster Process ‘cub_master’Daemon process listening on the TCP port for clients’ connectioncsql, broker, and admin utilitiesRegistrar of server processes using Unix Domain SocketServer Process ‘cub_server’Multi-threaded process serving clients’ requestsHas thread pool and job queueAccesses database volume and log filesOne server process per one databaseBroker Process ‘cub_broker’Daemon process listening on the TCP port for connectors’ connectionControls cub_cas processes (fork/kill) with connection queueCAS Process ‘cub_cas’Connects to the server process in behalf of connectorsAccording to the database and user nameCSQL Program ‘csql’Interactive SQL execution1.310/41   First Look Inside CUBRID
System Architecture and ProcessesCUBRID Processes and IPC1.3JDBC driverCCI libraryconnectquery &resultquery &resultport listeningcub_brokercubrid_broker.confforkparsedescriptor passAPWeb Servercub_cascub_casshared memorycubridcs.socubridcs.socsqlconnectcubridcs.sorequest &responserequest &responseparseBrokerTCPjob queuemulti-threadport listeningdescriptor passparsecub_mastercub_servercubrid.socubrid.confUDSActiveServerStandbyServermount(read/write)readregistervolume filelog filedatabases.txtvolume filelog fileReplicationcub_admincubridsa.so11/41   First Look Inside CUBRID
System Architecture and ProcessesQuery Processing Workflow1.412/41   First Look Inside CUBRID
System Architecture and ProcessesQuery Processing Workflow1.4XASL  TypeUNIONExtended Access Spec Language(XASL)DIFFERENCEINTERSECTIONOBJFETCHQuery ManagerTransactionManagerLock ManagerSETFETCHBUILD_LISTBUILD_VALUEQuery Result CacheQuery Plan CacheQuery Evaluator(Interpreter)SCANMERGE_LISTScan  ManagementREADUPDATEStorage ManagerDELETEINSERT13/41   First Look Inside CUBRID
Design & Implementation Concepts2Client-Server and Standalone Mode
Object, Class and OID
Representation, Record Descriptor, and Memory Object Pointer
Workspace – Object & Lock Caching
2PL vs. MVCC
XASL (Extended Access Spec Language)
Heap, B+tree, Catalog, and Temp
Click Counter14/41   First Look Inside CUBRID
Design & Implementation ConceptsClient-Server and Standalone Mode2.115/41   First Look Inside CUBRID
Design & Implementation ConceptsObject, Class and OID2.216/41   First Look Inside CUBRID
Design & Implementation ConceptsRepresentation, Record Descriptor, and Memory Object Pointer2.317/41   First Look Inside CUBRID
Design & Implementation ConceptsWorkspace – Object & Lock Caching2.418/41   First Look Inside CUBRID
Design & Implementation Concepts2PL vs. MVCC2.519/41   First Look Inside CUBRID
Design & Implementation ConceptsXASL (Extended Access Spec Language)2.620/41   First Look Inside CUBRID
Design & Implementation ConceptsHeap, B+tree, Catalog, and Temp2.721/41   First Look Inside CUBRID
Design & Implementation ConceptsClick CounterIn Terms of UserWhenever the user clicks an article, the read counter of the article is increased.Counts the clicks on the articleIn Terms of Service Application DeveloperThe read counter is very important for bulletin board type service.Combine getting article data and increasing read counter togetherget_article() + increase_counter() = get_article_and_increase_counter()(SELECT article_info) + (UPDATE read_counter+1)In Terms of Database EngineerDo SELECT and UPDATE in one SQL statementSELECT trigger? SELECT FOR UDPATE?UPDATE the record with the short term lockExampleSELECT doc_id, title, INCR(read_counter), post_date FROM board WHERE doc_id=?2.822/41   First Look Inside CUBRID
Design & Implementation ConceptsClick Counter2.8Don’t walk the same passage twice!When you get there, do as many things as possible.Killing two birds with one stone.23/41   First Look Inside CUBRID
Module and Source Structure3Overall Structure
Query Processing Component
Transaction Management Component
Server Storage Management Component
Client Storage Management Component
Object Management Component
Job and Thread Management Component
Client-Server Communication Layer
Broker Component24/41   First Look Inside CUBRID

CUBRID Inside - Architecture, Source & Management Components

  • 1.
    CUBRID InsideFirst LookInside CUBRIDJan 18, 2009
  • 2.
    저작권 Copyright NoticeCREATIVECOMMONS 저작자표시-동일조건변경허락 2.0 대한민국이용자는 아래의 조건을 따르는 경우에 한하여 자유롭게이 저작물을 복제, 배포, 전송, 전시, 공연 및 방송할 수 있습니다.이차적 저작물을 작성할 수 있습니다.다음과 같은 조건을 따라야 합니다:저작자표시. 귀하는 원저작자를 표시하여야 합니다. What does "Attribute this work" mean? The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well. 동일조건변경허락. 귀하가 이 저작물을 개작, 변형 또는 가공했을 경우에는, 이 저작물과 동일한 이용허락조건하에서만 배포할 수 있습니다. 귀하는, 이 저작물의 재이용이나 배포의 경우, 이 저작물에 적용된 이용허락조건을 명확하게 나타내어야 합니다.저작권자로부터 별도의 허가를 받으면 이러한 조건들은 적용되지 않습니다.Nothing in this license impairs or restricts the author's moral rights.CREATIVE COMMONS Attribution-Share Alike 2.0 KoreaYou are free:to Share — to copy, distribute and transmit the workto Remix — to adapt the workUnder the following conditions:Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). What does "Attribute this work" mean? The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.Any of the above conditions can be waived if you get permission from the copyright holder.Nothing in this license impairs or restricts the author's moral rights.http://creativecommons.org/licenses/by-sa/2.0/kr/Copyright 2009 Search Solution Corporation. All Rights Reserved.
  • 3.
  • 4.
    ContentsSystem Architecture andProcessesDesign & Implementation ConceptsModule and Source StructureIn The Next CUBRID Inside4/41 First Look Inside CUBRID
  • 5.
  • 6.
  • 7.
  • 8.
    Query Processing WorkflowSystemArchitecture and Processes15/41 First Look Inside CUBRID
  • 9.
    System Architecture andProcessesWhat is CUBRID?CUBRID isOpen Source DBMS owned and developed by NHNHosted at nForge siteTargeted to a database platform for Internet portal serviceRelational database system with object extensions – Object-Relational Model1,000,000 line of source code scaled projectEngine – C/C++, CUBRID Manager (GUI) and JDBC driver – JavaCUBRID providesFull-featured database server engineServer and Broker architectureGUI management and query toolCUBRID ManagerVarious API (JDBC, ODBC(OLE DB), PHP, and CCI)Python and Ruby as contributed projects1.16/41 First Look Inside CUBRID
  • 10.
    System Architecture andProcessesSystem Architecture1.2Server SubsystemMulti-threaded storage engine part which runs as DB serverConsists of Transaction Manager, Object Manager, Lock Manager, Query Manager, Log Manager, and Storage ManagerClient SubsystemClient library part providing native C APIConsists of Query Parser & Optimizer, Object & Lock Cache, Transaction Manager and Object ManagerBroker SubsystemLinked with client library and implemented CCI protocolDoes job queuing, connection pooling, monitoring and loggingConnectorsJDBC driverCCI libraryMany drivers are implemented with CCI library – ODBC, OLEDB, PHP, Python, and Ruby7/41 First Look Inside CUBRID
  • 11.
    System Architecture andProcessesSystem Architecture1.2CUBRIDManagerGUIInterfacePHPOLE DBRubyCUBRIDManagerJDBCODBCCCIPythonCM ServerJobQueuingMonitoringConnectionPoolingLoggingAdminUtilityBrokerCreate, Delete, Copy, RenameQueryParser &OptimizerLockCacheObjectManagerTransactionManagerAdd VolumeLoad /UnloadBackup /RestoreQueryManagerLockManagerServerCompact /OptimizeStorageManagerLogManagerCheck /DiagActiveLogFile BasedObjectsDataVolumeIndexVolumeTempVolumeArchiveLog8/41 First Look Inside CUBRID
  • 12.
    1.2CUBRIDManagerGUIInterfacePHPOLE DBRubyCUBRIDManagerJDBCODBCCCIPythonCM ServerCreate,Delete, Copy, RenameJobQueuingMonitoringConnectionPoolingLoggingAdminUtilityBrokerClient LibraryAdd VolumeNative C APIParserObjectManagerSchemaManagerTransactionManagerLoad /UnloadQueryTransformWorkspace ManagerBackup /RestoreQueryOptimizerMemory ManagerCompact /OptimizePlanGenerationCheck /DiagCommunication ModuleStorage EngineServerCommunication ModuleTransactionManagerLogManagerLockManagerQueryManagerAccessMethodB+TreeModuleFile ManagerSystemCatalog ModuleSystem ArchitectureBuffer ManagerDisk ManagerActiveLogFile BasedObjectsDataVolumeIndexVolumeTempVolumeArchiveLog9/41 First Look Inside CUBRID
  • 13.
    System Architecture andProcessesCUBRID Processes and IPCMaster Process ‘cub_master’Daemon process listening on the TCP port for clients’ connectioncsql, broker, and admin utilitiesRegistrar of server processes using Unix Domain SocketServer Process ‘cub_server’Multi-threaded process serving clients’ requestsHas thread pool and job queueAccesses database volume and log filesOne server process per one databaseBroker Process ‘cub_broker’Daemon process listening on the TCP port for connectors’ connectionControls cub_cas processes (fork/kill) with connection queueCAS Process ‘cub_cas’Connects to the server process in behalf of connectorsAccording to the database and user nameCSQL Program ‘csql’Interactive SQL execution1.310/41 First Look Inside CUBRID
  • 14.
    System Architecture andProcessesCUBRID Processes and IPC1.3JDBC driverCCI libraryconnectquery &resultquery &resultport listeningcub_brokercubrid_broker.confforkparsedescriptor passAPWeb Servercub_cascub_casshared memorycubridcs.socubridcs.socsqlconnectcubridcs.sorequest &responserequest &responseparseBrokerTCPjob queuemulti-threadport listeningdescriptor passparsecub_mastercub_servercubrid.socubrid.confUDSActiveServerStandbyServermount(read/write)readregistervolume filelog filedatabases.txtvolume filelog fileReplicationcub_admincubridsa.so11/41 First Look Inside CUBRID
  • 15.
    System Architecture andProcessesQuery Processing Workflow1.412/41 First Look Inside CUBRID
  • 16.
    System Architecture andProcessesQuery Processing Workflow1.4XASL TypeUNIONExtended Access Spec Language(XASL)DIFFERENCEINTERSECTIONOBJFETCHQuery ManagerTransactionManagerLock ManagerSETFETCHBUILD_LISTBUILD_VALUEQuery Result CacheQuery Plan CacheQuery Evaluator(Interpreter)SCANMERGE_LISTScan ManagementREADUPDATEStorage ManagerDELETEINSERT13/41 First Look Inside CUBRID
  • 17.
    Design & ImplementationConcepts2Client-Server and Standalone Mode
  • 18.
  • 19.
    Representation, Record Descriptor,and Memory Object Pointer
  • 20.
    Workspace – Object& Lock Caching
  • 21.
  • 22.
    XASL (Extended AccessSpec Language)
  • 23.
  • 24.
    Click Counter14/41 First Look Inside CUBRID
  • 25.
    Design & ImplementationConceptsClient-Server and Standalone Mode2.115/41 First Look Inside CUBRID
  • 26.
    Design & ImplementationConceptsObject, Class and OID2.216/41 First Look Inside CUBRID
  • 27.
    Design & ImplementationConceptsRepresentation, Record Descriptor, and Memory Object Pointer2.317/41 First Look Inside CUBRID
  • 28.
    Design & ImplementationConceptsWorkspace – Object & Lock Caching2.418/41 First Look Inside CUBRID
  • 29.
    Design & ImplementationConcepts2PL vs. MVCC2.519/41 First Look Inside CUBRID
  • 30.
    Design & ImplementationConceptsXASL (Extended Access Spec Language)2.620/41 First Look Inside CUBRID
  • 31.
    Design & ImplementationConceptsHeap, B+tree, Catalog, and Temp2.721/41 First Look Inside CUBRID
  • 32.
    Design & ImplementationConceptsClick CounterIn Terms of UserWhenever the user clicks an article, the read counter of the article is increased.Counts the clicks on the articleIn Terms of Service Application DeveloperThe read counter is very important for bulletin board type service.Combine getting article data and increasing read counter togetherget_article() + increase_counter() = get_article_and_increase_counter()(SELECT article_info) + (UPDATE read_counter+1)In Terms of Database EngineerDo SELECT and UPDATE in one SQL statementSELECT trigger? SELECT FOR UDPATE?UPDATE the record with the short term lockExampleSELECT doc_id, title, INCR(read_counter), post_date FROM board WHERE doc_id=?2.822/41 First Look Inside CUBRID
  • 33.
    Design & ImplementationConceptsClick Counter2.8Don’t walk the same passage twice!When you get there, do as many things as possible.Killing two birds with one stone.23/41 First Look Inside CUBRID
  • 34.
    Module and SourceStructure3Overall Structure
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
    Job and ThreadManagement Component
  • 41.
  • 42.
    Broker Component24/41 First Look Inside CUBRID