BangDB Server- Network Cluster (Master Slaves Model)

Configuration - BangDB Server

Configuration

There are plenty of configuration available for BangDB server and it's very critical to provide the right configuration in order to run the server in best possible and efficient manner

The server comes with default values set and for test and development puposes these values should be good enough. But for the server in production we may need to worry about few variables and set them properly. Note that the configuration file provides hints by putting '*' before the variable. More stars for a variable would mean that this is something that user should look at changing and less stars means be doubly sure before making changes

Basic Configurations

SERVER_DIR:

Use this to set the data dir where the server should put it's data files

Note that this can be provided at run time

BANGDB_DB_TYPE:

If you are keen on persisting the data then set this as 1 else for in-mem only set it as 0

Note that this can be provided at run time for each table using table_env type

BANGDB_INDEX_TYPE:

If you wish to keep the records in sorted order, set it as 2 (Btree) else set it as 1. Note that you can always choose Btree for random data as well

Note that this can be provided at run time for each table using table_env type

BANGDB_LOG:

If you are running the db with BANGDB_DB_TYPE set as 0, then log should be off (0), but for persistent db it's always a good idea to keep the log on (1). Also for transaction log has to be switched on. But there are no restrictions from db side and you are free to chose any value in any scenario. Note that db performance decreases with setting the variable as ON(1)

Note that this can be provided at run time for each table using table_env type

DAT_SIZE:

Using this var you can tell bangdb that this is maximum size of data you would intend to insert. Note that this doesn't include key size but only val size. Hence if you set this var as 1MB then you can't insert more than 1 MB value. To insert more than 1MB value you will need to break the value into multiple pieces and insert all under different keys nd store the mapping somewhere else (may be under different key in the db). Or you can stop the server, change the value to let's say 3MB and restart and insert. Keeping this not too high is always good. Please note that BangDB puts no theratical restriction on size of value but from practical purposes keep it reasonable. Default value is 64K

IDX_SIZE:

This is basically key size and for some reason the name has stuck over here as IDX_SIZE. Please change it to the max key size you would insert. Keeping this low is very beneficial both from performance and memory point of view. For ex; if you intend to have key as integers (may be long) then setting it 10 – 12 is good (10==9999999999 is the max value and it means we can insert around 10 billion to 1000 billion keys). Please note that BangDB puts no restriction on size of the key except that it should be less than page size (see PAGE_SIZE config var)

Note that this can be provided at run time for each table using table_env type

MAX_CLIENT_EVENTS:

This basically denotes the number of concurrent client connections. Hence if we get more connections than this number at a time then rest will be refused. Default value is 10000 which is very high and for all practical purposes should server good. But if wish to bring it down you can set it accordingly

BUFF_POOL_SIZE_HINT:

This is to tell the server to set the memory budget. Higher the value better the overall performance. This is limited by the amount of memory on the server. Note that BangDB respects the hint and never goes beyond the suggested memory as far as memory consumption is concerned. Hence if on a 8GB RAM machine, we allocate 2GB for buffer pool then whole server will consume around 2.2 GB of memory and never go beyond that. If it has to deal with more data then it will start paging out in-mem pages to continue serving clients. The value of the variable just tells BangDB to budget memory around it but the server can handle any amount of data using just specified amount. Suggested value for the var is aroun 5.5GB on 8GB machine and so on... Default value set is 1024

CHKPNT_ENABLED:

If you enable log, then it's a good idea to enable this as well

SERVER_TYPE:

For both master and slave we use same config file, we just change some variable's values. For master set the value as 0 and for slave set it as 1

Note that this can be provided while starting the server as well using the command line arguments

ENABLE_REPLICATION:

Default is 1(ON)

Note that this can be provided while starting the server as well using the command line arguments

SERVER_ID:

IP address of the server you are configuring for, it could be master or slave

Note that this can be provided while starting the server as well using the command line arguments

SERVER_PORT:

Port num, for the server (master or slave)

Note that this can be provided while starting the server as well using the command line arguments

MASTER_SEREVR_ID:

This is basically to tell slave the id of master. Note that for master this value is ignored. For slave, do set the master's ip address

Note that this can be provided while starting the server as well using the command line arguments

MASTER_SERV_PORT:

This is to tell slaves at what port master is listening. For master server this value is ignored

Note that this can be provided while starting the server as well using the command line arguments

For detail discussion on all config variable, please see the configuration document To clarify the last few variables, let's set the master and server's config file. Here master runs at 192.168.1.3:7888 and slave runs at 192.168.1.2:7887

Master

Note that these can be provided while starting the server as well using the command line arguments

SERVER_TYPE = 0

ENABLE_REPLICATION = 1

SERVER_ID = 192.168.1.3

SERVER_PORT = 7888

MASTER_SERVER_ID = 102.168.1.3

MASTER_SERVER_PORT = 7888

Slave

Note that these can be provided while starting the server as well using the command line arguments

SERVER_TYPE = 1

ENABLE_REPLICATION = 1

SERVER_ID = 192.168.1.2

SERVER_PORT = 7887

MASTER_SERVER_ID = 102.168.1.3

MASTER_SERVER_PORT = 7888

so on...

So basically following important points to keep in mind;

(a) For every instance of BangDB that you launch, either master or slave, you will need to configure that server. And to configure the server, we need to place a bangdb.config file in the server's exe dir

(b) Then edit the bangdb.config file and provide all relevant values for the parameters. Master and slave related values can be provided using the command line arguments

(c) Change the server specific info in the config file as shown above in the example. Server_id and port_id combination will be different for different servers, hence we will need to edit them. We will also provide the master id and port for all slaves. Again these values can be provided using the command line arguments and the command line values overrides the values defined in the bangdb.config

The above should be good enough for getting started. If you take care of the config parameters shown in this document then you are all set for long time or may be forever to just continue running the server. Please note that there are many more tuning we can do to make the server perform better or in accordance with our need, but we will cover that later