eygle.com   eygle.com
eygle.com  
 

« April 8, 2006 | Blog首页 | April 10, 2006 »



April 9, 2006

What's Mean "internal dummy connection"?

作者:eygle

出处:http://blog.eygle.com

升级到Apache2.2之后,在Apache的日志中经常看到大量的internal dummy connection日志:

[root@systest logs]# tail -f access_log.20060409 |grep "internal dummy connection"
::1 - - "GET / HTTP/1.0" 200 68091 "-" "Apache/2.2.0 (Unix) PHP/5.1.2 (internal dummy connection)"
::1 - - "GET / HTTP/1.0" 200 68091 "-" "Apache/2.2.0 (Unix) PHP/5.1.2 (internal dummy connection)"
::1 - - "GET / HTTP/1.0" 200 68091 "-" "Apache/2.2.0 (Unix) PHP/5.1.2 (internal dummy connection)"
::1 - - "GET / HTTP/1.0" 200 68091 "-" "Apache/2.2.0 (Unix) PHP/5.1.2 (internal dummy connection)"
::1 - - "GET / HTTP/1.0" 200 68091 "-" "Apache/2.2.0 (Unix) PHP/5.1.2 (internal dummy connection)"
::1 - - "GET / HTTP/1.0" 200 68091 "-" "Apache/2.2.0 (Unix) PHP/5.1.2 (internal dummy connection)"

不知道是什么意思?哪位能指点一下,谢谢:)

感谢留言网友的指点,这些信息的含义为:
/* Create the request string. We include a User-Agent so that
* adminstrators can track down the cause of the odd-looking
* requests in their logs.
*/
srequest = apr_pstrcat(p, "GET / HTTP/1.0\r\nUser-Agent: ",
ap_get_server_version(),
" (internal dummy connection)\r\n\r\n", NULL);
通过修改Apache的配置文件可以在日志中屏蔽这些信息:
SetEnvIf Remote_Addr "::1" dontlog
CustomLog "|/usr/local/sbin/cronolog /opt/apache/logs/eygle_access_log.%Y%m%d" combined env=!dontlog
参考链接:
http://www.clusting.com/Apache/ApacheManual/logs.html http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?view=markup&pathrev=230808

 

Posted by eygle at 4:48 PM | Comments (5)


关于自动PGA管理的进一步探讨

作者:eygle

出处:http://blog.eygle.com

伴随自动PGA调整新特性的引入,Oracle随之引入了一系列新的视图,V$PGASTAT就是其中的一个.
在V$PGASTAT中有这样一个条目: global memory bound ,该条目记录数据库允许的最高PGA内存使用量,我们可以从不同的PGA参数设置来观察一下Oracle运行的PGA上限.


SQL> alter system set pga_aggregate_target=&Nm;
Enter value for nm: 10m
old   1: alter system set pga_aggregate_target=&Nm
new   1: alter system set pga_aggregate_target=10m

System altered.

Elapsed: 00:00:00.05
SQL> SET autotrace traceonly
SQL> SELECT DISTINCT * FROM t WHERE ROWNUM < 500000;

20000 rows selected.

Elapsed: 00:03:04.12

…….
SQL> SET autotrace off
SQL> SELECT sql_text, operation_type, POLICY, last_memory_used / 1024 / 1024,
  2         last_execution, last_tempseg_size
  3    FROM v$sql l, v$sql_workarea a
  4   WHERE l.hash_value = a.hash_value
  5     AND sql_text = 'SELECT DISTINCT * FROM t WHERE ROWNUM < 500000';

SQL_TEXT                                       OPERATION_TYPE     POLIC
-------------------------------------------------- ------------------ -----
LAST_MEMORY_USED/1024/1024 LAST_EXE LAST_TEMPSEG_SIZE
-------------------------- -------- -----------------
SELECT DISTINCT * FROM t WHERE ROWNUM < 500000     GROUP BY (SORT)    AUTO
                .548828125 206 PASSES          62914560

Elapsed: 00:00:00.02
SQL> 
SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                               MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                           10
global memory bound                                                   .5

SQL> alter system set pga_aggregate_target=&Nm;
Enter value for nm: 30M
old   1: alter system set pga_aggregate_target=&Nm
new   1: alter system set pga_aggregate_target=30M

System altered.

Elapsed: 00:00:00.05
SQL> SET autotrace traceonly
SQL> SELECT DISTINCT * FROM t WHERE ROWNUM < 500000;

20000 rows selected.

Elapsed: 00:00:53.30
………..
SQL> SET autotrace off
SQL> SELECT sql_text, operation_type, POLICY, last_memory_used / 1024 / 1024,
  2         last_execution, last_tempseg_size
  3    FROM v$sql l, v$sql_workarea a
  4   WHERE l.hash_value = a.hash_value
  5     AND sql_text = 'SELECT DISTINCT * FROM t WHERE ROWNUM < 500000';

SQL_TEXT                                           OPERATION_TYPE     POLIC LAST_MEMORY_USED/1024/1024
-------------------------------------------------- ------------------ ----- --------------------------
LAST_EXECUTION       LAST_TEMPSEG_SIZE
-------------------- -----------------
SELECT DISTINCT * FROM t WHERE ROWNUM < 500000     GROUP BY (SORT)    AUTO                  1.48046875
6 PASSES                      57671680


Elapsed: 00:00:00.02
SQL> 
SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                                MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                           30
global memory bound                                                   1.5

Elapsed: 00:00:00.00

我们可以注意到,PGA的global memory bound会一直处在5%的PGA_AGGREGATE_TARGET参数设置,直到5% PGA_AGGREGATE_TARGET超过100M,然后global memory bound被限制为100M,也就是满足我们前文提到的:

对于串行操作,单个SQL操作能够使用的PGA内存按照以下原则分配:
MIN(5% PGA_AGGREGATE_TARGET,100MB)

注意,修改PGA_AGGREGATE_TARGET参数可以使用如下命令:
alter system set pga_aggregate_target=4096M ;

修改参数后,通常需要之行操作才能看到视图信息的变化:

SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                              MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                           10
global memory bound                                                    .5

SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                                MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                           20
global memory bound                                                    1

SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                               MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                           40
global memory bound                                                   2

SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                             MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                         1024
global memory bound                                              51.1992188

SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                                MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                       4096
global memory bound                                                   100


实际上这个100M的上限是受到了另外一个隐含参数的控制,该参数为_pga_max_size,该参数的缺省值为200M,单进程串行操作PGA的上限不能超过该参数的1/2.
SQL> SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ
  2    FROM SYS.x$ksppi x, SYS.x$ksppcv y
  3   WHERE x.inst_id = USERENV ('Instance')
  4   AND y.inst_id = USERENV ('Instance')
  5   AND x.indx = y.indx
  6   AND x.ksppinm LIKE '%&par%'
  7  /
Enter value for par: pga_max
old   6:    AND x.ksppinm LIKE '%&par%'
new   6:    AND x.ksppinm LIKE '%pga_max%'

NAME                           VALUE      DESCRIB
---------------------------------------------  ----------------  ---
_pga_max_size                  209715200     Maximum size of the PGA memory for one process

如果我们修改该参数, global memory bound将可以突破100M的上限:

SQL> alter system set "_pga_max_size"=400M;

System altered.
……………………
SQL> SELECT NAME, VALUE / 1024 / 1024 MB
  2    FROM v$pgastat
  3   WHERE NAME IN ('aggregate PGA target parameter', 'global memory bound');

NAME                                                            MB
---------------------------------------------------------------- ----------
aggregate PGA target parameter                                         4096
global memory bound                                                 200

对于PGA的控制,还有一系列的内部参数,列举如下,仅供参考:

SQL> l
  1  SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ
  2    FROM SYS.x$ksppi x, SYS.x$ksppcv y
  3   WHERE x.inst_id = USERENV ('Instance')
  4     AND y.inst_id = USERENV ('Instance')
  5     AND x.indx = y.indx
  6*    AND x.ksppinm LIKE '%&par%'
SQL> /
Enter value for par: smm
old   6:    AND x.ksppinm LIKE '%&par%'
new   6:    AND x.ksppinm LIKE '%smm%'

NAME                     VALUE DESCRIB
------------------------ ----- ----------------------------------------------------------------
_smm_auto_min_io_size    56    Minimum IO size (in KB) used by sort/hash-join in auto mode
_smm_auto_max_io_size    248   Maximum IO size (in KB) used by sort/hash-join in auto mode
_smm_auto_cost_enabled   TRUE  if TRUE, use the AUTO size policy cost functions
_smm_control             0     provides controls on the memory manager
_smm_trace               0     Turn on/off tracing for SQL memory manager
_smm_min_size            128   minimum work area size in auto mode
_smm_max_size            2560  maximum work area size in auto mode (serial)
_smm_px_max_size         15360 maximum work area size in auto mode (global)
_smm_bound               0     overwrites memory manager automatically computed bound
_smm_advice_log_size     0     overwrites default size of the PGA advice workarea history log
_smm_advice_enabled      TRUE  if TRUE, enable v$pga_advice

11 rows selected.

 

Posted by eygle at 4:47 PM | Comments (12)


经典重现

作者:eygle

出处:http://blog.eygle.com

Cost-Based.gif很意外,这么快就看到了《Cost Based Oracle Fundamentals》这本书的电子版,网络的力量一直是惊人的.
ERN的渠道也真是广泛.
Thomas Kyte这样评价这本书:
The insights that Jonathan provides into the workings
            of the cost-based optimizer will make a DBA a better
            designer, and a Developer a better SQL coder. Both
            groups will become better troubleshooters.
            — Thomas Kyte, VP (Public Sector), Oracle Corporation
            


这是一部艰深的经典之作,出版社也曾经不看好这本书的销量,曲高和寡总是难免.
也许能够真正从头到尾仔细通读这本书的人也恐怕不多.

不管怎样,能看到经典,总是有值得欣喜的地方,虽然,再一次侵犯了作者的版权.
经典之作,欣然而获,不亦快载?

 

Posted by eygle at 4:45 PM | Comments (1)



CopyRight © 2004-2008 eygle.com, All rights reserved.