`
Intrepid2012
  • 浏览: 71036 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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, 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.


第二:Define the Network Address as ttShmHost in the logical server name
[ttLocalHost_tt1121]
Description=TimesTen Server
Network_Address= ttShmHost
TCP_PORT=53389

UNIX domain socket communication 
[ttLocalHost_tt1121]
Description=TimesTen Server
Network_Address= ttLocalHost
TCP_PORT=53389
相对来说, 使用socket方式比第一种tcp/ip 效率更高,比第二种 shared memory 占用内存要少。


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics