Berkeley DB Reference Guide: Server program
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

### Berkeley DB Reference Guide: RPC Client/Server |

# Server program

The Berkeley DB server utility, berkeley_db_svc, handles all the client application requests.

Currently, the berkeley_db_svc utility is single-threaded, limiting the number of requests that it can handle. Modifying the server implementation to run in multithread or multiprocess mode requires modification of the server code automatically generated by the rpcgen program.

There are two different types of timeouts used by berkeley_db_svc. The first timeout (which can be modified within some constraints by the client application), is the resource timeout. When clients use transactions or cursors, those resources hold locks in Berkeley DB across calls to the server. If a client application dies or loses its connection to the server while holding those resources, it prevents any other client from acquiring them. Therefore, it is important to detect that a client has not used a resource for some period of time and release them. In the case of transactions, the server aborts the transaction. In the case of cursors, the server closes the cursor.

The second timeout is an idle timeout. A client application may remain idle with an open handle to an environment and a database. Doing so simply consumes some memory; it does not hold locks. However, the Berkeley DB server may want to eventually reclaim resources if a client dies or remains disconnected for a long period of time, so there is a separate idle timeout for open Berkeley DB handles.

The list of home directories specified to berkeley_db_svc are the only ones client applications are allowed to use. When berkeley_db_svc is started, it is given a list of pathnames. Clients are expected to specify the name of the home directory (defined as the last component in the directory pathname) as the database environment they are opening. In this manner, clients need to know only the name of their home environment; not its full pathname on the server machine. This means, of course, that only one environment of a particular name is allowed on the server at any given time.

Copyright Sleepycat Software