xSQL Sample Perfmon

This sample demonstrates a simple persistent database with the performance monitor enabled.

The config file looks like the following:

 
    #
    #  Simple In-Memory configuration
    #
    database_name : diskdb,
    database_size    :  20m,
    cache_size : 10m,
     
    database_filename: "diskdb.dbs", # database file name, string
    log_filename     : "diskdb.log", # log file name, string
     
    runtime_configuration : {
        debug_library : false,
        disk_support : true,
        shared_memory : false,
        transaction_manager : mursiw
     },
    schema : "
    #define uint2     unsigned<2>
     
    declare database  locatedb;
     
    class Employee
    {
        string name;
        uint2 dept_no;
 
        unique tree<name> Iname;
        tree<dept_no>     Idept;
    };
    ",
    db_params: {
        mem_page_size : 512,
        disk_page_size : 8192
    },
     
    sql_trace : false,
    sql_port : 5500,
    sql_statements : "INSERT INTO Employee(name, dept_no) VALUES (['Luke Skywalker', 'Han Solo', 'Darth Vader'], [1,1,2]);",
        perfmon : {
        # Use mcohv
        hv : true,
         
        #IM database size for perfmon
        database_size : 256m,
         
        #Set listening address and port for embedded HTTP server:
        hvaddr : "0.0.0.0",  # Default value - listen on all interfaces
        hvport : 8082, #Default value
        show_browser : true   # Show database browser in addition to performance monitor
    }
         

Note that section schema defines the database with inline DDL text and the sql_statements section specifies the SQL statements to be executed once the database has been created.

This sample can be run from directory samples\xsql\configs\perfmon with the following command:

 
    ..\..\..\..\target\bin\xsql -c xsql.cfg -i
     

With xSQL started in interactive mode, we can now execute SQL statments. For example:

 
    XSQL>select * from Employee;
    name    dept_no
    ------------------------------------------------------------------------------
    Darth Vader     2
    Han Solo        1
    Luke Skywalker  1
     
    Selected records: 3
     

Now open a web browser and navigate to <Server IP>:8082 to see the performance monitor web interface.