Persistent Media I/O in Python

The eXtremeDB disk manager supports asynchronous I/O as described in the following section.

 

Asynchronous file I/O

By default, AIO is disabled. In order to use the asynchronous I/O mode, the application specifies DbParamsModeMask.USE_AIO in the open_database() argument db_params_mode_mask. The default parameters for AIO are max_queue_length=10007 (the size of the asynchronous transaction buffer) and n_workers=1 (the number of worker threads writing data to the persistent media.) If these parameters need to be altered the aio_start() API must be called before open_database() . The aio_start() API signature is as follows:

 
    aio_start(max_queue_length, n_workers);
     

And when closing the database, AIO processing should be closed explicitly by calling Database method aio_stop(). For example:

 
    exdb.aio_start(1000,2);
    db = exdb.open_database(dbname=’perfdb’, dictionary=dict,
        is_disk=true, db_segment_size=900*1024*1024,
        db_log_type = ‘UNDO_LOG’,
        log_params = log_params,
        db_params_mode_mask=exdb.DbParamsModeMask.USE_AIO );
    ...
    // Database processing
     
    exdb.aio_stop();
     

By default, one AIO thread is started for each database and the default queue size is set to 10007. Sometimes it could be beneficial to change the number of AIO threads (for example if the database is comprised of multiple physical IO devices, or is resided on a RAID) and/or the queue size. However note that the number of I/O threads won't exceed the number of databases created in a process, regardless of the value of worker threads passed by the application (the runtime does not allow more than one AIO thread to serve a database)

(Applications do not need to call either of these methods, aio_start() or aio_stop(), if the default values are acceptable.)