日期:2014-05-16  浏览次数:20623 次

Timesten 学习笔记(五)Client/Server

Client/Server 模式综述

?

?

TimesTen客户端 访问 远程系统上 的TimesTen 数据库 TimesTen 客户端 ODBC驱动程序 负责连接 应用程序 使用 TimesTen 客户端 驱动 程序 应用程序可以连接 透明 的TimesTen 服务器 数据管理器

???? 可以 直接 使用 TimesTen
客户端 驱动 程序 者使用Windows的 ODBC驱动程序 管理 连接 客户端应用程序 但是不建议使用 Windows ODBC driver manager, 因为可能会带来性能方面的损失。

????TimesTen 服务端 负责监听和转发请求和回应。

?

几点注意:

?

create user or alter user 只能直接连接服务器后创建,不能使用client/server 方式,并且创建用户后应该CREATE SESSION 以便该用户可以通过client端连接服务器。

?

某些工具 不能通过client/server方式访问。 可以使用的工具一般都有 CS标记

?

client/server下的通信协议

?

  • TCP/IP Communication

  • Shared memory communication

  • UNIX domain socket communication

默认情况下使用 tcp/ip

?

如果使用 Shared memory communication,需要如下2个步骤

?

第一:需要在ttendaemon.options 添加- serverShmIpc

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.

?

然后使用 -serverShmSize size 指定sharememory 大小。

?

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