TimesTen的守护进程

TimesTen的守护进程分为主守护进程和子守护进程。

主守护进程

主守护进程即ttDaemonAdmin启动的进程,也称为Data Manager Daemon。

主守护进程的作用为:

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

每一个TimesTen实例配有一个主守护进程,一个主守护进程下可有多个数据库。

子守护进程

每一个数据库/DataStore都配备相应的子守护进程(subdaemon), 子守护进程父进程即主守护进程。

在OS中可以查看到子守护进程,不过区别不明显,只能看到有两个实例tt1122和ttnew,其它的区别就是-id了:

$ ps -ef|grep timestensubd
oracle    2648  2644  0 Jun29 ?        00:02:35 /home/oracle/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000000 -facility user
oracle    2649  2644  0 Jun29 ?        00:05:20 /home/oracle/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000001 -facility user
oracle    2650  2644  0 Jun29 ?        00:00:35 /home/oracle/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000002 -facility user
oracle    8775  2644  0 10:33 ?        00:00:13 /home/oracle/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000011 -facility user
oracle    6633  6629  0 03:57 ?        00:00:25 /u01/TimesTen/ttnew/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000000 -facility user
oracle    6634  6629  0 03:57 ?        00:00:25 /u01/TimesTen/ttnew/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000001 -facility user
oracle    6635  6629  0 03:57 ?        00:00:25 /u01/TimesTen/ttnew/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000002 -facility user
oracle    6636  6629  0 03:57 ?        00:00:25 /u01/TimesTen/ttnew/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000003 -facility user

$ ps -p 2644
  PID TTY          TIME CMD
 2644 ?        00:01:56 timestend

$ ps -p 6629
  PID TTY          TIME CMD
 6629 ?        00:00:51 timestend

从输出还可看出,2644和6629是主守护进程。

每一个timestensubd负责一个数据库。

$ ttstatus
TimesTen status report as of Thu Jun 30 17:56:03 2016

Daemon pid 6629 port 55555 instance ttnew
TimesTen server pid 6638 started on port 55556
------------------------------------------------------------------------
Data store /u01/TimesTen/ttnew/info/DemoDataStore/repdb2_1122
There are no connections to the data store
Replication policy  : Manual
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group oracle
End of report
虽然没有任何数据库,表示之前看到的是idle subdaemon
$ ttstatus
TimesTen status report as of Thu Jun 30 17:48:42 2016

Daemon pid 2644 port 53392 instance tt1122
TimesTen server pid 2653 started on port 53393
------------------------------------------------------------------------
Data store /home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb2
There are 18 connections to the data store
Shared Memory KEY 0x0e0077ad ID 4718612
PL/SQL Memory KEY 0x0f0077ad ID 4751381 Address 0x7fa0000000
Type            PID     Context             Connection Name              ConnID
Process         10938   0x000000000203dad0  cachedb2                          1
Replication     10955   0x00000000038aa750  LOGFORCE:1092778304             127
Replication     10955   0x0000000003910870  XLA_PARENT:1089628480           129
Replication     10955   0x0000000003925460  REPLISTENER:1101670720          131
Replication     10955   0x00000000039d8750  TRANSMITTER(M):1108805952       126
Replication     10955   0x00007fe9c00008c0  REPHOLD:1098090816              128
Replication     10955   0x00007fe9c80008c0  FAILOVER:1081899328             130
Subdaemon       2648    0x0000000001be0360  Manager                         142
Subdaemon       2648    0x0000000001c57430  Rollback                        141
Subdaemon       2648    0x0000000001debbc0  Checkpoint                      137
Subdaemon       2648    0x0000000001e407f0  Monitor                         136
Subdaemon       2648    0x0000000001e95420  IndexGC                         135
Subdaemon       2648    0x000000000312f8f0  HistGC                          139
Subdaemon       2648    0x0000000003184520  Log Marker                      138
Subdaemon       2648    0x000000000325aa50  AsyncMV                         134
Subdaemon       2648    0x00000000032af680  Aging                           133
Subdaemon       2648    0x00000000033042b0  Deadlock Detector               132
Subdaemon       2648    0x00000000034097c0  Flusher                         140
Replication policy  : Manual
Replication agent is running.
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Data store /home/oracle/TimesTen/tt1122/info/DemoDataStore/repdb1_1122
There are no connections to the data store
Replication policy  : Manual
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Data store /home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1
There are 18 connections to the data store
Shared Memory KEY 0x4400c901 ID 3997713
PL/SQL Memory KEY 0x4500c901 ID 4030482 Address 0x7fa0000000
Type            PID     Context             Connection Name              ConnID
Process         11076   0x0000000001c84ad0  cachedb1                          1
Replication     10918   0x000000000361f460  LOGFORCE:1101203776             127
Replication     10918   0x000000000368b270  REPHOLD:1108773184              130
Replication     10918   0x00000000036b2350  XLA_PARENT:1098053952           128
Replication     10918   0x00000000036c6f40  REPLISTENER:1093052736          129
Replication     10918   0x00000000038048e0  RECEIVER:1115072832             125
Replication     10918   0x00007fa0880008c0  FAILOVER:1083238720             131
Subdaemon       2649    0x0000000000e82360  Manager                         142
Subdaemon       2649    0x0000000000ef9430  Rollback                        141
Subdaemon       2649    0x0000000001008980  Monitor                         136
Subdaemon       2649    0x000000000108d5e0  IndexGC                         134
Subdaemon       2649    0x00000000010ff8f0  AsyncMV                         133
Subdaemon       2649    0x0000000001134cd0  Flusher                         132
Subdaemon       2649    0x0000000001272b40  Deadlock Detector               140
Subdaemon       2649    0x00000000012d6150  Log Marker                      138
Subdaemon       2649    0x0000000001346c10  Checkpoint                      137
Subdaemon       2649    0x000000000269bb80  HistGC                          135
Subdaemon       2649    0x00000000026b0770  Aging                           139
Replication policy  : Manual
Replication agent is running.
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group oracle
End of report
$ ttstatus|grep -i subdaemon
Subdaemon       2648    0x0000000001be0360  Manager                         142
Subdaemon       2648    0x0000000001c57430  Rollback                        141
Subdaemon       2648    0x0000000001debbc0  Checkpoint                      137
Subdaemon       2648    0x0000000001e407f0  Monitor                         136
Subdaemon       2648    0x0000000001e95420  IndexGC                         135
Subdaemon       2648    0x000000000312f8f0  HistGC                          139
Subdaemon       2648    0x0000000003184520  Log Marker                      138
Subdaemon       2648    0x000000000325aa50  AsyncMV                         134
Subdaemon       2648    0x00000000032af680  Aging                           133
Subdaemon       2648    0x00000000033042b0  Deadlock Detector               132
Subdaemon       2648    0x00000000034097c0  Flusher                         140

Subdaemon       2649    0x0000000000e82360  Manager                         142
Subdaemon       2649    0x0000000000ef9430  Rollback                        141
Subdaemon       2649    0x0000000001008980  Monitor                         136
Subdaemon       2649    0x000000000108d5e0  IndexGC                         134
Subdaemon       2649    0x00000000010ff8f0  AsyncMV                         133
Subdaemon       2649    0x0000000001134cd0  Flusher                         132
Subdaemon       2649    0x0000000001272b40  Deadlock Detector               140
Subdaemon       2649    0x00000000012d6150  Log Marker                      138
Subdaemon       2649    0x0000000001346c10  Checkpoint                      137
Subdaemon       2649    0x000000000269bb80  HistGC                          135
Subdaemon       2649    0x00000000026b0770  Aging                           139

主守护进程可以按需动态产生subdaemon。当有数据库需要加载到内存时,就会产生新的或使用已有的idle subdaemon来负责这个数据库。

TimesTen总是预留一个idle的subdaemon:

a) 主daemon启动时, 会附带启动4 subdaemon,并且最初的状态为idle

b) 若有数据库需要加载到内存,则会指派一个subdaemon负责一个数据库,但总会预留一个idle的subdaemon。

缺省启动的subdaemon数量可以在ttendaemon.options中通过-minsubs设置。

subdaemon的作用包括:

1. 将数据库从内存中卸载

2. 将Log buffer中的日志写盘

3. 日志的归档和清理

4. 检查和消除死锁

5. 在数据库非正常关闭时,从checkpoint和log文件中恢复

6. 回退交易

7. 实现缓存Aging

常用的subdaemon包括:

Worker: Periodically checks for deadlocks and canceling SQL operations on behalf of other applications in order to break any deadlocks.

Flusher: Flushes contents of Log buffer to disk

Checkpoint: Performs checkpoint operation.

Monitor: Implements lock wait timeout. For more information, please refer connection attribute “LockWait” in “Oracle TimesTen In-Memory Database API Reference Guide”.

HistGC: Purging rows in internal tables SYS.TABLE_HISTORY and SYS.COLUMN_HISTORY periodically when they are no longer needed by XLA readers.

Aging: Implementing the aging policies of various tables.

参考

  • TimesTen subdaemon: Frequently Asked Questions (Doc ID 759437.1)
  • TimesTen recovery from abnormally terminated connections (Doc ID 759443.1)
时间: 2024-08-12 08:15:28

TimesTen的守护进程的相关文章

Python setdaemon守护进程

setdaemon守护进程 #_*_coding:utf-8_*_ __author__ = 'gaogd' import time import threading ''' 守护进程,如果主线程down了,子线程也就没有了. 下面先通过主进程生成main主线程,之后main主线程再生成10个子线程. ''' ''' def run(num):     if not num == 5:         time.sleep(1)     print 'Hi, I am thread %s..la

转:linux守护进程的启动方法

Linux 守护进程的启动方法 作者: 阮一峰 日期: 2016年2月28日 "守护进程"(daemon)就是一直在后台运行的进程(daemon). 本文介绍如何将一个 Web 应用,启动为守护进程. 一.问题的由来 Web应用写好后,下一件事就是启动,让它一直在后台运行. 这并不容易.举例来说,下面是一个最简单的Node应用server.js,只有6行. var http = require('http'); http.createServer(function(req, res)

Python实例浅谈之五Python守护进程和脚本单例运行

一.简介 守护进程最重要的特性是后台运行:它必须与其运行前的环境隔离开来,这些环境包括未关闭的文件描述符.控制终端.会话和进程组.工作目录以及文件创建掩码等:它可以在系统启动时从启动脚本/etc/rc.d中启动,可以由inetd守护进程启动,也可以有作业规划进程crond启动,还可以由用户终端(通常是shell)执行. Python有时需要保证只运行一个脚本实例,以避免数据的冲突. 二.Python守护进程 1.函数实现 #!/usr/bin/env python #coding: utf-8

#python#守护进程的实现

找了整天,终于找到一个可以用的代码 #! /usr/bin/env python2.7 #encoding:utf-8 #@description:一个python守护进程的例子 #@tags:python,daemon import sys import os import time import atexit from signal import SIGTERM      class Daemon:   """   A generic daemon class.     

linux守护进程

#include <iostream>#include <unistd.h>//#include "curl/curl.h"#include "app_curl.h"#include "youtube_package.h"#include "CAutoMail.h"#include <fcntl.h>#include <signal.h>#include <unistd.h

C#开发Linux守护进程

C#开发Linux守护进程 Linux守护进程是Linux的后台服务进程,相当于Windows服务,对于为Linux开发服务程序的朋友来说,Linux守护进程相关技术是必不可少的,因为这个技术不仅仅是为了开发守护进程,还可以拓展到多进程,父子进程文件描述符共享,父子进程通讯.控制等方面,是实现Linux大型服务的基础技术之一. 去年我也曾写了一篇关于守护进程的帖子,名字叫<.NET跨平台实践:用C#开发Linux守护进程>,这篇文章的的确确实现了一个Daemon,不过,它有一个弱点,不能运行多

守护进程的创建过程

编写守护进程需要5步 1 创建子进程,父进程结束(让这个进程由init进程托管) pid = fork(); if(pid > 0) //父进程 { exit(0); }2 在子进程中创建新会话(此进程就可以脱离原来进程,脱离控制终端,脱离原来进程组) setsid(); //最主要是脱离控制终端 3 改变当前目录(每一个进程都有一个当前目录), 不是必须的 chdir("/tmp"); 4 重新设置文件权限掩码(不是必须的) umask(0); 5 关闭打开的文件描述符(如果父

Linux守护进程实现程序只运行一次

1.守护进程 守护进程(Daemon)是一种运行在后台的特殊进程,它独立于控制终端并且周期性的执行某种任务或等待处理某些发生的事件. 2.让程序只运行一次 如果让程序只运行一次,有很多方法,此处的一种方法是创建一个名字古怪的文件(保证不跟系统文件或其他文件重名),判断文件存在则让程序不再运行且提示程序正在运行,如果不存在则可以运行. 3.测试代码 此代码额外添加了系统LOG,记录操作的信息. 1 #include <stdio.h> 2 #include <unistd.h> 3

Linux系统开发7 进程关系,守护进程

[本文谢绝转载原文来自http://990487026.blog.51cto.com] <大纲> Linux系统开发7  进程关系守护进程 终端 网络终端 Linux PCB结构体信息 进程组 修改子进程.父进程的组ID 会话组 设置一个会话脱离控制终端 生成一个新的会话 守护进程 守护进程模板 获取当前系统时间  终端 在UNIX系统中用户通过终端登录系统后得到一个Shell进程这个终端成为Shell进 程的控制终端Controlling Terminal在讲进程时讲过控制终端是保存在PCB