3 Working with the TimesTen Data Manager Daemon

The TimesTen Data Manager daemon, which is the Oracle TimesTen Data Manager service on Windows, starts when TimesTen is installed. The daemon operates continually in the background.

The TimesTen daemon performs the following functions:

  • Manages shared memory access

  • Coordinates process recovery

  • Keeps management statistics on what databases exist, which are in use, and which application processes are connected to which databases

  • Manages RAM policy

  • Starts replication processes, the TimesTen Server and the cache agent.

Application developers do not interact with the daemon directly. No application code runs in the daemon and application developers do not generally have to be concerned with it. Application programs that access TimesTen databases communicate with the daemon transparently using TimesTen internal routines.

The following sections discuss interaction with the TimesTen daemon on various platforms:

Starting and stopping the TimesTen daemon

The following sections discuss how to start and stop the TimesTen daemon on various platforms:

Note:

The daemon writes a timestend.pid file into the directory from which the daemon was started. By default, the daemon home directory is install_dir/info on UNIX and install_dir\srv\info on Windows. This file contains the daemon process ID. When the process terminates, the timestend.pid file is removed.

Starting and stopping the Oracle TimesTen Data Manager service on Windows

The Oracle TimesTen Data Manager service starts when you install the Oracle TimesTen Data Manager on your Windows system. To manually start and stop the Oracle TimesTen Data Manager service, you can use the ttDaemonAdmin utility with the -start or -stop option, or the Windows Administrative Tools as follows:

  1. Open the Windows Administrative Tools.

  2. Double-click Services. All currently available services are displayed.

  3. Select TimesTen Data Manager 11.2.2, then click the appropriate button to stop or start the service.

Note:

You must have administrative privileges to start and stop the TimesTen service.

Changing the startup mode

When you install the TimesTen Data Manager, the TimesTen Data Manager Service starts automatically whenever the system restarts. In addition, if you installed the TimesTen Server, it is automatically started whenever the TimesTen Data Manager service is started. You can change the startup mode for the TimesTen Data Manager to require manual startup.

To change the startup mode:

  1. Open the Windows Administrative Tools.

  2. Double-click Services. All currently available services are displayed.

  3. Double-click the TimesTen Data Manager 11.2.2 service to examine its properties dialog.

  4. In the properties dialog, the Startup type list should indicate Automatic (default). You can optionally change it to Manual. In either case, you can click Stop or Start (as applicable) in the properties dialog to stop or start the service. For typical usage, set the Startup type back to the default and click OK when you are through.

Starting and stopping the daemon on UNIX

You must be the instance administrator to start and stop the TimesTen daemon.

The instance administrator must manually start and stop the daemon, after each system reboot, unless the setuproot script has been executed. To manually start and stop the TimesTen main daemon, you can use the ttDaemonAdmin utility with the -start or -stop option.

The root user can start the daemon by executing the daemon startup script. The following table shows the location of the daemon startup script by platform.

Platform Location of daemon startup script
Linux /etc/init.d/tt_instance_name
Solaris /etc/init.d/tt_instance_name
AIX /etc/init.d/tt_instance_name

Running the setuproot script

If you want the TimesTen instance to start each time the system is restarted, run the setuproot script as root. The setuproot script is located in the install_dir/bin directory:

# cd install_dir/bin
# setuproot -install

Shutting down a TimesTen application

A TimesTen application consists of a database that has been allocated shared memory, user connections, and possibly replication and cache agents for communication with other TimesTen or Oracle databases.

To shut down a TimesTen application, complete the following tasks:

  1. Disconnect all user connections gracefully.

  2. Shut down all replication and cache agents.

  3. Unload the database from shared memory if it was manually loaded.

  4. Stop the TimesTen daemon.

Managing TimesTen daemon options

The ttendaemon.options file contains TimesTen daemon options. During installation, the installer sets some of these options to correspond to your responses to the installation prompts.

On Windows, the ttendaemon.options file is located in the daemon home directory:

install_dir\srv\info

On UNIX, the ttendaemon.options file is located in the daemon home directory:

install_dir/info 

The features that the ttendaemon.options file controls are as follows:

  • The network interfaces on which the daemon listens

  • The minimum and maximum number of TimesTen subdaemons that can exist for the TimesTen instance

  • Whether or not the TimesTen Server is started

  • Whether or not you use shared memory segments for client/server inter-process communication

  • The number of Server processes that are prespawned on your system

  • The location and size of support and user logs

  • Backward compatibility

  • The maximum number of users for a TimesTen instance

  • Data access across NFS mounted systems. This is for Linux only.

  • The TNS_ADMIN value for the Oracle Database. This option cannot be modified in this file.

  • Modifying the default database recovery after a fatal error

Use the ttmodinstall utility to make changes to the ttendaemon.options file for most commonly changed options. See "ttmodinstall" in the Oracle TimesTen In-Memory Database Reference. If you cannot use ttmodinstall to change a particular option and must modify the ttendaemon.options file directly, stop the TimesTen daemon before you change the file. Restart the TimesTen daemon after you have finished changing the file. To change TimesTen Server options, it is only necessary to stop the server. It is not necessary to stop the TimesTen daemon.

The rest of this section includes the following topics:

Determining the daemon listening address

By default, the TimesTen main daemon, all subdaemons and agents listen on a socket for requests, using any available address. All TimesTen utilities and agents use the loopback address to talk to the main daemon, and the main daemon uses the loopback address to talk to agents.

The -listenaddr entry in a separate line in the ttendaemon.options file tells the TimesTen daemons to listen on the specific address indicated in the value supplied. The address specified with this option can be either a host name or a numerical IP address.

The -listenaddr parameter exists for situations where a server has multiple network addresses and multiple network cards. In this case it is possible to limit the network addresses on which the TimesTen daemon is listening to a subset of the server's network addresses. This is done by making entries only for those addresses on which the daemon listens. These possibilities exist:

  • Given a situation where a server has a "public" network address that is accessible both inside and outside the local network and a "private" address that is accessible only within the local network, adding a -listenaddr entry containing only the private address blocks all communications to TimesTen coming on the public address.

  • By specifying only the local host, the TimesTen main daemon can be cut off from all communications coming from outside the server and communicate only with local clients and subdaemons.

There is no relationship between TimesTen replication and the -listenaddr parameter and there is no requirement for enabling the -listenaddr parameter when replication is enabled. If replication is going to be used in an environment where -listenaddr is enabled, then the replication nodes need to know the allowable network addresses to use. However, if no -listenaddr parameter is enabled replication still works.

To explicitly specify the address on which the daemons should listen on a separate line in the ttendaemon.options file, enter:

-listenaddr address

For example, if you want to restrict the daemon to listen to just the loopback address, you say either:

-listenaddr 127.0.0.1

or

-listenaddr localhost

This means that only processes on the local system can communicate with the daemon. Processes from other systems would be excluded, so you would not be able to replicate to or from other systems, or grant client access from other systems.

If you have multiple ethernet cards on different subnets, you can specify -listenaddr entries to control which systems can connect to the daemon.

You can enter up to four addresses on which to listen by specifying the option and a value on up to four separate lines in the ttendaemon.options file. In addition to the addresses you specify, TimesTen always listens on the loopback address.

Listening on IPv6

By default, TimesTen uses the IPv4 protocol. To enable the daemon to listen on IPv6, you must enter on a separate line in the ttendaemon.options file:

-enableIPv6

and

-listenaddr6 address
  • You can specify an IPv6 address with the -listenaddr6 option to enable IPv6.

  • Specifying the -enableIPv6 option with one or more -listenaddr or -listenaddr6 options adds the IPv6 loopback interface to the list.

  • If you specify the -enableIPv6 option without specifying any addresses with the -listenaddr or -listenaddr6 options, then the daemon listens on any IPv6 interface as well as any IPv4 interface.

The address specified with this option can be either a host name or a numerical IP address. See "Determining the daemon listening address" for specifics on the -listenaddr option

If one or more -listenaddr options are provided, the daemons listen on the specified IPv4 interfaces, with the IPv4 loopback address being added to the list if not specified. If only -enableIPv6 is specified, the daemons listen on both the IPv4 ANY interface and the IPv6 ANY interface.

You can specify both -listenaddr and -listenaddr6 options. If you specify one or more -listenaddr6 options, the daemons listen on the specified IPv4 or IPv6 interfaces, with both the IPv4 and IPv6 loopback interfaces being added if not specified. If the name resolver returns multiple IPv4 and/or IPv6 addresses for a name, the daemons listen on all of the names.

Modifying informational messages

As the daemon operates, it generates error, warning, and informational messages. These messages may be useful for TimesTen system administration and for debugging applications.

By default, informational messages are stored in the following:

  • A user error log that contains information you may need to see. Generally, these messages contain information on actions you may need to take.

  • A support log containing everything in the user error log plus information of use by TimesTen Customer Support.

The ttDaemonLog utility enables you to control the type of events that TimesTen writes to and fetches from the TimesTen user and error logs. For more information, see "ttDaemonLog" in the Oracle TimesTen In-Memory Database Reference.

The following options in the ttendaemon.options file specify the locations and size of the support and user logs, as well as the number of files to keep stored on your system.

Option Description
-supportlog path -f path Specifies the location for the support log file. The default file is daemon_home/ttmesg.log.
-maxsupportlogfiles num The TimesTen main daemon automatically rotates the files once they get to a specific size. This option specifies the number of support log files to keep. The default is 10.
-maxsupportlogsize nBytes Specifies the maximum size of the support log file. The default is 100 MB.
-userlog logfile

or

-userlog [syslog]

logfile: A user-provided logfile specifies the location and name of the log file to use. The default file is daemon_home/tterrors.log.

syslog: Specify -userlog [syslog] so that the output is sent to one of the following appropriate operating system files:

  • The UNIX syslog

  • The Windows Event Log

-maxuserlogfiles num The TimesTen main daemon automatically rotates the files once they get to a specific size. This option specifies the number of user log files to keep. The default is 10.
-maxuserlogsize nBytes Specifies maximum size of the user log. Default is 10 MB.
-showdate On UNIX systems only, indicates that the date should be prepended to all messages.

If you have specified the Event Log as the location for your log messages, to view them follow these steps:

  1. Open the Event Viewer window. From the Start menu, select Control Panel, Administrative Tools, and then select Event Viewer.

  2. In the Event Viewer list, choose Applications and Services Logs.

    The window displays log messages generated by applications. Any messages with the word "TimesTen" in the "Source" column were generated by the Oracle TimesTen Data Manager service.

  3. To view any TimesTen message, double-click the message summary.

    The message window is displayed. You can view additional messages by clicking Next, Previous, up or down arrows, depending on your version of Windows.

Note:

You can also view messages using the ttDaemonLog utility.

To specify the syslog facility used to log TimesTen daemon and subdaemon messages on UNIX, on a separate line of the ttendaemon.options file add:

-facility name

Possible name values are: auth, cron, daemon, local0-local7, lpr, mail, news, user, or uucp.

To turn off detailed log messages, add a # before -verbose in the ttendaemon.options file.

Changing the allowable number of subdaemons

TimesTen uses subdaemons to perform the following:

  • Manage databases.

  • Flush the transaction log buffer to disk.

  • Perform periodic checkpoints.

  • Implement the aging policies of various tables.

  • Find and break deadlocks.

  • Rollback transactions for abnormally terminated direct-mode applications.

  • Perform required background processing for the database.

The main TimesTen daemon spawns subdaemons dynamically as they are needed. You can manually specify a range of subdaemons that the daemon may spawn, by specifying a minimum and maximum.

At any point in time, one subdaemon is potentially needed for TimesTen process recovery for each failed application process that is being recovered at that time.

By default, TimesTen spawns a minimum of 4 subdaemons and specifies the default maximum number of subdaemons at 50. However, you can change these settings by assigning new values to the -minsubs and -maxsubs options in the ttendaemon.options file.

Allowing database access over NFS-mounted systems

By default, TimesTen systems cannot access data across NFS-mounted systems. On Linux x86 64-bit systems, you can access checkpoint and transaction log files on NFS-mounted systems.

To enable data access on NFS-mounted systems, on a separate line of the ttendaemon.options file, add:

-allowNetworkFiles

Enabling Linux large page support

To enable Linux large page support on TimesTen, on a separate line of the ttendaemon.options file, add:

-linuxLargePageAlignment Size_in_MB

The Size_in_MB is the Hugepagesize value in /proc/meminfo, specified in MB instead of KB.

For more information on HugePages at the operating system level, see "Linux prerequisites" in the Oracle TimesTen In-Memory Database Installation Guide.

Modifying the default automatic database recovery after a fatal error

You can modify the default database recovery behavior by setting the -enablePolicyInactive option in the ttendaemon.options file before you start the TimesTen daemon. For full details on this option, see "Changes to RAM policy after automatic recovery fails".

Configuring a range for shared memory keys

You can configure a range for all shared memory keys used by TimesTen with the -shmkeyrange daemon option. You can constrain shared memory keys to a specific range to prevent shared memory collisions. However, if you use this option, it is your responsibility to ensure that no other shared memory segments use shared memory keys in the specified range.

Note:

This option is only available on UNIX or Linux platforms. This option cannot be used for Windows platforms.

The syntax is as follows:

-shmkeyrange low-high

For example:

-shmkeyrange 0x4000000-0x40FFFFFF

There can be no space in the low-high clause. The range is inclusive; thus, in the preceding example, both 0x40000000 and 0x40FFFFFF are valid keys. In addition, the minimum range size is 16.

With this option, it is possible to run out of shared memory keys, especially if there multiple invalidations or there are more TimesTen databases in use than originally anticipated.

If a user provides any of the following invalid options for the shared memory keys, then the TimesTen daemon aborts the startup process.

  • Invalid numeric strings

  • Only one number is specified for the range

  • The first number is greater than the second number in the range specification

  • The range size is less than 16.

  • The range is specified incorrectly.

Managing TimesTen Client/Server options

This section includes the following topics:

Modifying the TimesTen Server options

The TimesTen Server is a child process of the TimesTen daemon that operates continually in the background. To modify the TimesTen Server options, you must do the following:

  1. Stop the TimesTen Server.

  2. Modify the options in the ttendaemon.options file as described in the following sections.

  3. Restart the TimesTen Server.

Controlling the TimesTen Server

The -server portno entry in a separate line in the ttendaemon.options file tells the TimesTen daemon to start the TimesTen Server and what port to use. The portno is the port number on which the server listens.

If the TimesTen Server is installed, you can enable or disable the TimesTen Server:

  • To enable the TimesTen Server, remove the comment symbol '#' in front of the -server portno entry.

  • To disable the TimesTen Server, add a comment symbol '#' in front of the -server portno entry.

Prespawning TimesTen Server processes

Each TimesTen Client connection requires one server process. By default, a server process is spawned when a client requests a connection.

You can prespawn a pool of reserve server processes, making them immediately available for a client connection, thus improving client/server connection performance.

The -serverpool number entry in a separate line in the ttendaemon.options file on the Server system tells the TimesTen Server to create number processes. If this option is not specified, no processes are prespawned and kept in the reserve pool.

When a new connection is requested, if there are no items in the server pool, a new process is spawned, as long as you have not met the operating system limit.

If you request more process than allowed by your operating system, a warning is returned. Regardless of the number of processes requested, an error does not occur unless a client requests a connection when no more are available on the system, even if there are no processes remaining in the reserve pool.

Changes to the TimesTen Server take effect when the Server is restarted.

Specifying multiple connections to the TimesTen Server

By default, TimesTen creates only one connection to a Server for each child process. You can set multiple connects to a single TimesTen Server, either by using the Server connection attributes described in the "Server connection attributes" section in the Oracle TimesTen In-Memory Database Reference or by setting the TimesTen daemon options described in this section. These options enable you to set the number of connections to a TimesTen Server, the number of servers for each DSN and the size of each connection to the server.

Changes to TimesTen Server settings do not occur until the TimesTen server is restarted. To restart the Server, use the following command:

ttDaemonAdmin -restartserver

Note:

In the case that you have set both the Server connection attributes and these daemon options, the value of the Server connection attributes takes precedence.

Configuring the maximum number of client connections per child server process

To run a child server process in multithreaded mode so that a single server process can service multiple client connections to a database, add the following line to the ttendaemon.options file:

-maxConnsPerServer NumberOfClientConnections

Note:

If you are running a server in multithreaded mode and a server process fails, then all the client connections being handled by that process are terminated. Consider this when configuring the server for multithreaded mode and choose a value for the maxConnsPerServer attribute that balances your requirements for reliability and availability versus the more efficient resource usage of multithreaded mode.

The possible values of NumberOfClientConnections range from 1 to 2047, inclusive. The default value is 1, which indicates that the child server process runs in multi-process mode and, therefore, can service only one client connection.

Configuring how connections are distributed among the child server processes spawned for a server DSN

To specify the number of child server processes for a particular server DSN that will use round-robin connection distribution (when -maxConnsPerServer >1), add the following line to the ttendaemon.options file:

-serversPerDSN NumberOfChildServerProcesses

The possible values of NumberOfChildServerProcesses range from 1 to 2047, inclusive. The default value is 1.

By default (value=1), the first maxConnsPerServer client connection to a server DSN is assigned to a single child server process, the next maxConnsPerServer connection is assigned to a second child server process and so on.

If -serversPerDSN is set to N where N > 1, then the first N * maxConnsPerServer client connections to a server DSN are distributed in round robin fashion over N child server processes. If additional client connections beyond N * maxConnsPerServer are opened to the same server DSN, then those connections are assigned to new child server processes sequentially as for the case when -serversPerDSN=1.

Configuring the thread stack size of the child server processes

You generally should not need to set the ServerStackSize attribute. However, if the ttcserver process is getting repeatable Access Violations (Windows) or core dumps (Unix), you may consider increasing the ServerStackSize attribute.

To set the size of the child server process thread stack for each client connection, add the following line to the ttendaemon.options file:

-ServerStackSize ThreadStackSize

ThreadStackSize is specified in KB. The default is 128 KB on 32-bit systems and 256 KB on 64-bit systems. The ServerStackSize attribute is ignored if the maximum number of client connections per child server process is one, because the sole client connection is serviced by the main thread of the child server process. Consider setting the ServerStackSize attribute to 1024 KB if you are running complex SQL queries on your client connections.

Note:

These changes to the TimesTen Server do not occur until the TimesTen daemon is restarted.

Using shared memory for Client/Server IPC

By default, TimesTen uses TCP/IP communication between applications linked with the TimesTen Client driver and the TimesTen Server.

Where the client application resides on the same system as the TimesTen Server, you can alternatively use shared memory for the inter-process communication (IPC).

This can be useful for performance purposes or to allow 32-bit client applications to communicate with a 64-bit database on the server. Before using shared memory as IPC verify that you have configured your system correctly. See "Installation prerequisites" in the Oracle TimesTen In-Memory Database Installation Guide.

The -serverShmIpc entry in a separate line in the ttendaemon.options file tells the TimesTen Server to accept a client connection that intends to use a shared memory segment for IPC.

If this entry is missing, add this line to the ttendaemon.options file to start the TimesTen Server with shared memory IPC capability when the TimesTen daemon is restarted.

If the entry exists, add the # symbol before the line in the ttendaemon.options file to comment it out. The TimesTen Server is no longer started with shared memory IPC capability when the TimesTen daemon starts.

Note:

TimesTen supports a maximum of 16 different instances of the shared memory IPC-enabled server. If an application tries to connect to more than 16 different shared memory segments it receives an ODBC error.

Managing the size of the shared memory segment

The -serverShmSize size entry in a separate line in the ttendaemon.options file tells the TimesTen Server to create a shared memory segment of the specified size in MB.

If this entry is missing, the TimesTen Server creates a shared memory segment of 64MB.

An appropriate value for the shared memory segment depends on:

  • The expected number of concurrent client/server connections to all databases that belong to an instance of the TimesTen Server.

  • The number of concurrent allocated statements within each such connection.

  • The amount of data being transmitted for a query.

Some guidelines for determining the size of the shared memory segment include:

  • The maximum size allowed is 1 gigabyte.

  • TimesTen needs 1 MB of memory for internal use.

  • Each connection needs a fixed block of 16 KB.

  • Each statement starts with a block of 16 KB for the IPC. But this size is increased or decreased depending upon the size of the data being transmitted for a query. TimesTen increments the statement buffer size by doubling it and decreases it by halving it.

For example, if the user application anticipates a max of 100 simultaneous shared-memory-enabled client/server connections, and if each connection is anticipated to have a maximum of 50 statements, and the largest query returns 128 KB of data, use this formula to configure the serverShmSize:

serverShmSize = 1 MB + (100 * 16) KB + (100 * 50 * 128) KB
              = 1 MB + 2 MB + 625 MB = 628 MB

This is the most memory required for this example. The entire memory segment would be used only if all 100 connections have 50 statements each and each statement has a query that returns 128 KB of data in a row of the result.

In this example, if you configured the serverShmSize to 128 MB, either a new shared-memory-enabled client/server connection is refused by the TimesTen Server or a query may fail due to lack of resources within the shared memory segment.

Changing the size of the shared memory segment

Once configured, to change the value of the shared memory segment you must stop the TimesTen Server. Stopping the server detaches all existing client/server connections to any database that is associated with that instance of the TimesTen Server. The steps for modifying the value of the -serverShmSize option are:

  1. Modify the value of -serverShmSize in the ttendaemon.options file.

  2. Use the ttDaemonAdmin utility to restart the TimesTen Server. Only the instance administrator can restart the TimesTen Server.

Controlling the TimesTen Server log messages

The -noserverlog entry in a separate line in the ttendaemon.options file tells the TimesTen daemon to turn off logging of connects and disconnects from the client applications.

If the TimesTen Server is installed, you can enable or disable logging of connect and disconnect messages by:

  • To enable logging, add a comment symbol '#' before the -noserverlog entry.

  • To disable logging, remove the comment symbol '#' before the -noserverlog entry.