# DataSource peers configuration (part 2)

Here are the rest of the DataSource configuration items that define a DataSource application’s connections to its DataSource peers.

 "this DataSource application" means the DataSource application for which you are defining the configuration. "DataSource peer" or "peer" means a DataSource application that this DataSource application communicates with.

More DataSource-peer configuration items can be found in DataSource peers configuration (part 1).

## datasrc-batch-time

`datasrc-batch-time` specifies the time period in seconds for this DataSource application to batch together messages sent to a peer.

As an example, if `datasrc-batch-time` time is 0.2 seconds, when the DataSource application needs to send a message to the peer and there are no outgoing mesages already in the queue, it queues the message and waits 0.2 seconds. Any subsequent outgoing messages are also queued until 0.2 seconds have elapsed, and then all the queued messages are sent to the peer in one batch. Batching messages in this way can improve performance when there is a high rate of data updates being sent to the peer.

If datasrc-batch-time is set to `0.0`, messages are not batched.

Use in: C

Syntax: `datasrc-batch-time <time-period>`

Type: float

Default value: `0.01` (seconds)

Values accepted: `0.0` — `10.0`

## datasrc-default-obj-hash-size

`datasrc-default-obj-hash-size` specifies the default number of entries in the hashtable that holds information about this DataSource application’s active subscriptions.

Use in: C

Syntax: `datasrc-default-obj-hash-size <number-of-objects>`

Type: integer

Default value: `16384` objects

## datasrc-id

 This configuration item is deprecated. Use datasrc-local-label instead.

`datasrc-id` specifies the ID number of this DataSource application. You can override this ID for a particular peer connection by adding a local-id option to the add-peer configuration item relating to the connection.

Use in: C, Java

Syntax: `datasrc-id <ID-number>`

Type: integer

Default value: `0`

## datasrc-interface

`datasrc-interface` binds the DataSource server socket to a single IP address or to a single IP address wildcard.

 Only one DataSource server-socket is supported per DataSource application.

If no value is specified (default), then the DataSource server socket is available on all IPv4 and IPv6 addresses on the host. Some system settings affect this functionality; see the two tables below.

 Do not set `datasrc-interface` directly for Liberator. Instead, use the configuration macros `LIBERATOR${THIS_LEG}_DATASRC_INTERFACE` and `LIBERATOR${OTHER_LEG}_DATASRC_INTERFACE`. For more information, see Deployment Framework’s configuration macros.

The behaviour of `datasrc-interface` differs slightly between C-based and Java-based DataSource applications:

DataSource for C
Value Example Value Result

<empty_string>

`""`

[Default] The DataSource server-socket is available on all available IPv4 and IPv6 addresses on the host. IPv6 addresses are supported from DataSource 7. See footnote 1.

`192.0.2.1`

The DataSource server-socket is bound to the specified IPv4 address.

IPv4 wildcard

`0.0.0.0`

The DataSource server-socket is bound to all available IPv4 addresses on the host.

`2001:db8:0:0:0:0:0:1`

The DataSource server-socket is bound to the specified IPv6 address. Supported from DataSource 7.

IPv6 wildcard

`::`

The DataSource server-socket is bound to all available IPv6 addresses on the local machine. Supported from DataSource 7.

Hostname

`server.example.com`

The DataSource server-socket is bound to the first IP address the hostname resolves to. IPv6 addresses are supported from DataSource 7. See footnote 2.

1. On dual-stack hosts, setting `datasrc_interface` to `""` causes DataSource for C to open an IPv6 server socket that accepts IPv4-mapped addresses. IPv4 address mapping is enabled by default on Linux, but it can be disabled by the system administrator. See your operating system’s documentation for `/proc/sys/net/ipv6/bindv6only`.

2. From version 7, DataSource for C uses the POSIX function `getaddrinfo` for name resolution, which can return multiple IP addresses for a host. On Linux, `getaddrinfo` returns IP addresses in the order defined in RFC 3484, which gives IPv6 addresses precendence over IPv4 addresses of equal suitability. For more information, see your operating system’s manual entry for the POSIX function `getaddrinfo`.

DataSource for Java
Value Example Value Result

<empty_string>

`""`

[Default] The DataSource server-socket is available on all available IPv4 and IPv6 addresses on the host. IPv6 addresses are supported from DataSource 7. See footnote 1.

`192.0.2.1`

The DataSource server-socket is bound to the specified IPv4 address.

IPv4 wildcard

`0.0.0.0`

The DataSource server-socket is bound to all available IPv4 and IPv6 addresses on the host. IPv6 addresses are supported from DataSource 7. See footnote 1.

`2001:db8:0:0:0:0:0:1`

The DataSource server-socket is bound to the specified IPv6 address. Supported from DataSource 7.

IPv6 wildcard

`::`

The DataSource server-socket is bound to all available IPv4 and IPv6 addresses on the host. Supported from DataSource 7. See footnote 1.

Hostname

`server.example.com`

The DataSource server-socket is bound to the first IP address the hostname resolves to. IPv6 addresses are supported from DataSource 7. See footnote 2.

1. On dual-stack hosts, by default Java creates IPv6 server sockets that accept IPv4-mapped addresses. To force Java to create IPv4 server sockets instead, set the Java system property `java.net.preferIPv4Stack` to `true`. See Oracle’s Networking IPv6 User Guide for more details.

2. DataSource for Java uses Java’s `java.net.InetAddress` class for name resolution. In the interests of compatibility, Java gives IPv4 addresses precedence over IPv6 addresses of equal suitability. To force a Java virtual machine (JVM) to give precedence to IPv6 addresses, set the JVM option `java.net.preferIPv6Addresses` to `true`. See Oracle’s Networking IPv6 User Guide for more details.

Use in: C, Java

Syntax: `datasrc-interface <address_or_hostname>`

Type: string

Default value: `""` (empty string)

## datasrc-local-label

`datasrc-local-label` sets a name that uniquely defines this DataSource application within the Caplin Platform installation`. `Together with the remote-label option of add-peer, it replaces `datasrc_id` and the `remote-id` option of `add-peer`.

You can override this label for a particular peer connection by adding a local-label option to the add-peer configuration item relating to the connection (this allows you to implement multiple connections for the same peer).

 Here’s an example of how `datasrc-local-label` and `remote-label` are used together.

Use in: C, Java

Syntax: `datasrc-local-label <label-name>`

Type: string

Default value: `[none]`

## datasrc-name

`datasrc-name` The name of this DataSource application, which the application’s DataSource peers use to identify it.

You can override this name by adding a local-name option to an add-peer entry - the `local-name` is then the name that the DataSource peer defined by the `add-peer` entry uses to identify this application.

The name can contain the parameters `%a` and `%h`. At run time, `%a` is replaced by the DataSource application-name, and `%h` is replaced by the host name of the machine on which the DataSource application is running.

Use in: C, Java

Syntax: `datasrc-name <name-of-this-DataSource-application>`

Type: string

Default value: `%a-%h`

## datasrc-pkt-log

`datasrc-pkt-log` specifies the name of this DataSource application’s packet log file. Can also be used to turn off logging.

The name can include an absolute file path, otherwise the specified file path is relative to the path specified by the log-dir configuration item. The name can contain the parameter `%a`, which is replaced at run-time by the DataSource application-name.

To turn off logging, specify `/dev/null` as the file name: `datasrc-pkt-log /dev/null`

Use in: C, Java

Syntax: `datasrc-pkt-log <log-file-name>`

Type: string

Default value: `packet-%a.log`

## datasrc-port

`datasrc-port` specifies the network port to listen on for connections from DataSource peers. The default of `0` means that no connections can be made to this DataSource application (in which case, you’d configure the application so that it initiates the connections to its peers; see the addr and port options of add-peer).

To listen for secure (SSL) connections from DataSource peers, you must specify the configuration item datasrc-sslport.

Use in: C, Java

Syntax: `datasrc-port <port-number>`

Type: integer

Default value: `0` (No connections can be made.)

## datasrc-reject-new-peers

`datasrc-reject-new-peers` when set to TRUE, prevents a peer from connecting to this DataSource application when there’s already a peer connected that has the same label (or the same ID if there’s no label defined for the peer).

Setting `datasrc-reject-new-peers` prevents abnormal behaviour if the system is wrongly configured and two peers are inadvertently deployed with the same labels or IDs. By default, if a DataSource peer tries to connect to this DataSource application but there is already one connected with the same label or ID, the current peer is disconnected and the new one is allowed to connect. The first peer could then attempt to reconnect, which would cause the second peer to be disconnected. The second peer would then in turn attempt to reconnect, and so on.

This configuration item turns off this default behaviour, so the second DataSource peer is never allowed to connect.

The peer’s label is defined in the remote-label option of this DataSource application’s add-peer configuration entry. The peer’s ID is defined in the remote-id option of the `add-peer`.

Use in: C, Java

Syntax: `datasrc-reject-new-peers <boolean>`

Type: boolean

Default value: `FALSE` (a new peer with the same label or ID as an existing one is allowed to connect)

## datasrc-tcp-nodelay-off

`datasrc-tcp-nodelay-off` specifies whether the DataSource application’s peer connection sockets should have the TCP_NODELAY feature turned off. The default is `FALSE`, which means TCP_NODELAY is enabled. Setting this configuration item to `TRUE` disables TCP_NODELAY.

Use in: C, Java

Syntax: `datasrc-tcp-nodelay-off <boolean>`

Type: boolean

Default value: `FALSE` (TCP_NODELAY is disabled)

## peer-accept-wait-time

`peer-accept-wait-time` specifies the time in seconds to wait for an information packet when accepting a connection from a peer.

Use in: C

Syntax: `peer-accept-wait-time <time-interval>`

Type: float

Default value: `10.0` seconds

## peer-monitor-interval

`peer-monitor-interval` specifies the interval in seconds at which statistics about this DataSource application’s connection to its DataSource peers are read and transferred to the application’s JMX monitoring module.

You can override this item for a specific peer by adding a monitor-interval option to this DataSource application’s add-peer configuration item for the peer.

Use in: C, Java

Syntax: `peer-monitor-interval <time-interval>`

Type: float

Default value: `30.0` seconds

`peer-thread-pool-size` specifies the maximum number of pooled connection threads allocated to handle the DataSource application’s peer connections that don’t have an explicitly named thread.

If you configure more than 30 peers, you should define `peer-thread-pool-size`. For more about `peer-thread-pool-size` and the thread-name option of `add-peer`, see Configure threads for peer communication.

If this item is configured, the DataSource application creates a pool of threads that are used to handle peer connections. The item specifies the maximum number of threads in the pool.

When a peer connection doesn’t have a named thread configured for it (see the thread-name option of the add-peer item), communication with the peer is handled on one of the pool threads. However, if `peer-thread-pool-size` is 0 or not defined, an unnamed thread is created and dedicated to that peer. If `peer-thread-pool-size` is less than the number of peer connections with no explicitly named thread, these connections share threads from the pool.

Use in: C

Syntax: `peer-thread-pool-size <max-number-of-threads>`

Type: integer

Default value: `-1` (no pool configured - see explanation below)

## source-request-timeout

`source-request-timeout` specifies a timeout in seconds for a DataSource peer’s response to a request (for example, a subscription request) sent to it by this DataSource application. If the peer doesn’t respond within this time, the requested object is assumed to be not available and the application sends a discard message for the object to the peer.

`source-request-timeout` is a global timeout that applies to all DataSource peers; you can override it for individual peers by setting the request-timeout option of add-peer. You can override all of these timers for a particular data service by setting the request-timeout option of add-data-service.

Use in: C

Syntax: `source-request-timeout <timeout-in-seconds>`

Type: float

Default value: `-1.0` (no timeout)