单个域名的RR记录上限

前几天同事反馈有个2000多个域名指向了自己的一台服务器,但是查询对应机器的PTR记录时发现只有1700多个。
dig -x 查询了一下发现确实只有1700多个,检查了对应的zone文件内PTR记录是有2000多个的。偶然发现dig返回的MSG SIZE到了65519

在RFC1035中提到了DNS的几个限制:
labels 63 octets or less
names 255 octets or less
TTL positive values of a signed 32 bit number.
UDP messages 512 octets or less
整个UDP的消息被限制在512,不过随着后来EDNS0扩展协议(rfc2671),UDP的报文是可以到4096的(最大可以到65535)。
在查询同事提供的PTR记录时,请求本身被TC置位走了TCP,因次这个UDP的限制无关的。DNS的限制实际在协议上


All RRs have the same top level format shown below:
                                    1  1  1  1  1  1
      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                                               |
    /                                               /
    /                      NAME                     /
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                      TYPE                     |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                     CLASS                     |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                      TTL                      |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                   RDLENGTH                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
    /                     RDATA                     /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
where:
NAME            an owner name, i.e., the name of the node to which this
                resource record pertains.
TYPE            two octets containing one of the RR TYPE codes.
CLASS           two octets containing one of the RR CLASS codes.
TTL             a 32 bit signed integer that specifies the time interval
                that the resource record may be cached before the source
                of the information should again be consulted.  Zero
                values are interpreted to mean that the RR can only be
                used for the transaction in progress, and should not be
                cached.  For example, SOA records are always distributed
                with a zero TTL to prohibit caching.  Zero values can
                also be used for extremely volatile data.
RDLENGTH        an unsigned 16 bit integer that specifies the length in
                octets of the RDATA field.

因为RDLENGTH是16bit的,所以报文被限制到了2^16=65536。

发表在 dns | 留下评论

startssl证书CA被吊销

近期证书到期,到startssl上续了一个证书,部署上死活不行。
搜了一下才发现startssl的ca因为沃通倒签证书、私自颁发github证书,CA被Mazilla,Chrome都去除了。。
腾讯云上申请了1个免费的ssl证书搞定。

发表在 杂谈 | 留下评论

控制linux时钟速度的几个参数

1. tick

用户态下内核时钟计数间隔,默认都是100HZ。因此单个tick代表了10^4 us。

可以设置每个tick代表的时钟长度,因此把tick增加1(即增加为10001us)的影响是每天时间慢8.64s(24小时的tick被提前消耗完)


24*3600*100*10001/10^6-24*3600=8.64s。

2. ppm

百万分之一秒,1个PPM增加


24*360*(10^6+1)/10^6-24*3600=0.0864s。

PPM 增加500,每天的时间慢500*0.0864=43.2s

假设服务器现在标准的PPM为 A,为了让系统24小时快1s。则ppm的调整为
A- 1*10^6/3600/24=A-11.574074。

处理闰秒如果想让时钟在一天内慢1s,则可以用ntptime -f把frequency改为服务器当前的值+11.574


ubuntu@ip-172-31-23-155:~/ntp-4.2.8p9$ ntptime
ntp_gettime() returns code 0 (OK)
  time dc1e24a0.5e832b98  Mon, Jan  9 2017 15:02:56.369, (.369189989),
  maximum error 73959 us, estimated error 101 us, TAI offset 0
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 75.601 us, frequency 18.063 ppm, interval 1 s,
  maximum error 73959 us, estimated error 101 us,
  status 0x2001 (PLL,NANO),
  time constant 5, precision 0.001 us, tolerance 500 ppm,

3. freq


In struct timex, freq, ppsfreq, and stabil are ppm (parts per
       million) with a 16-bit fractional part, which means that a value of 1
       in one of those fields actually means 2^-16 ppm, and 2^16=65536 is 1
       ppm.  This is the case for both input values (in the case of freq)
       and output values.
  -f newfreq, --frequency newfreq
              Set the system clock frequency offset to newfreq.  newfreq can be negative or positive, and gives a much finer adjustment than the --tick switch.  When
              USER_HZ=100, the value is scaled such that newfreq = 65536 speeds up the system clock by about 1 ppm, or .0864 sec/day

因此freq增加65536相当于增加1个PPM(1E-6S)。freq增加65536,每天的影响-0.0864s/天。
因为单个freq对时钟的影响非常小。所以大部分时候不用调整freq,除非是要求比较高的情况下,比如这个机器本身是做时钟服务器。

4. 工具介绍

1. adjtimex

可以根据和主板上的硬件时钟作对比,调整系统的每个tick代表的us数和freq,加-c参数会给出建议值。


ubuntu@ip-172-31-23-155:~$ sudo adjtimex -c
                                      --- current ---   -- suggested --
cmos time     system-cmos  error_ppm   tick      freq    tick      freq
1484017467       0.491349             10000   1217447
1484017477       0.491537       18.8  10000   1217447
1484017487       0.491743       20.6  10000   1217447    9999   6421047
1484017497       0.491901       15.8  10000   1217447   10000    183072
1484017507       0.492101       20.0  10000   1217447    9999   6460109
1484017517       0.492283       18.2  10000   1217447    9999   6577297
1484017527       0.492490       20.7  10000   1217447    9999   6414797
2. ntptime

这个可以比较方便的直接设置frequency偏移量。


ubuntu@ip-172-31-23-155:~$ ntptime
ntp_gettime() returns code 0 (OK)
  time dc1ece09.54a99b70  Tue, Jan 10 2017  3:05:45.330, (.330713562),
  maximum error 124171 us, estimated error 64 us, TAI offset 0
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset -8.136 us, frequency 18.577 ppm, interval 1 s,
  maximum error 124171 us, estimated error 64 us,
  status 0x2001 (PLL,NANO),
  time constant 5, precision 0.001 us, tolerance 500 ppm,
ubuntu@ip-172-31-23-155:~$ ntptime --help
ntptime: unknown option --
usage: ntptime [-MNT:cde:f:hm:o:rs:t:]

-M          switch to microsecond mode
-N          switch to nanosecond mode
-T tai_offset   set TAI offset
-c          display the time taken to call ntp_gettime (us)
-e esterror     estimate of the error (us)
-f frequency    Frequency error (-500 .. 500) (ppm)
-h          display this help info
-m maxerror     max possible error (us)
-o offset       current offset (ms)
-r          print the unix and NTP time raw
-s status       Set the status bits
-t timeconstant log2 of PLL time constant (0 .. 6)

汇总

参数 增加单位数 1天影响
freq +1 -0.000001318359375s
ppm +1 -0.0864s
tick +1 -8.64s

简单的换算 1tick=100ppm=100 * 65536 freq

发表在 System | 留下评论

ntp支持的外部时钟源

公司先后采购过多种GPS授时服务器。之前一直不是太明白ntpd是如何使用外接的这些硬件。
这两年树莓派比较流行,也有很大人利用外接的扩展件让树莓派成为一级时钟源。其中关键的ntp.conf配置如下


driftfile /var/lib/ntp/ntp.drift

# coarse time ref-clock, not really needed here as we have LAN & WAN servers
server 127.127.28.0  minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 +0.350 refid GPS  stratum 15

# Kernel-mode PPS ref-clock for the precise seconds
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0  refid PPS

# LAN servers
server 192.168.0.3  minpoll 5 maxpoll 5 iburst prefer
server 192.168.0.2  minpoll 5 maxpoll 5 iburst
server 192.168.0.7  minpoll 5 maxpoll 5 iburst

对比了公司采购的GPS授时服务器的配置


NTP-SERVER:/#ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*127.127.20.1    .GPS.            0 l   16   16  377    0.000    0.002   0.001
 127.127.1.0     .LCK.            0 l    -   16  377    0.000    0.000   0.001
NTP-SERVER:/#cat /etc/ntp.conf|grep -v "^#"|grep '[a-z]'
server  127.127.20.1 prefer mode 17 minpoll 4
fudge   127.127.20.1 stratum 0 refid GPS flag2 1 flag3 1
server  127.127.1.0 minpoll 4   maxpoll 4
fudge   127.127.1.0 stratum 0 refid LCK
driftfile /var/drift
broadcastdelay  0.008
authenticate yes
keys        /etc/ntp/keys
logconfig =clockevents +syncevents +sysevents +clockall +syncall +sysall

server和fudge的相关说明如下


       The  fudge  command  is  used  to provide additional information for individual clock drivers and normally follows immediately after the server command. The address
       argument specifies the clock address. The refid and stratum options control can be used to override the defaults for the device.  There  are  two  optional  device-
       dependent time offsets and four flags that can be included in the fudge command as well.
       The  stratum  number  of  a  reference clock is by default zero. Since the ntpd daemon adds one to the stratum of each peer, a primary server ordinarily displays an
       external stratum of one. In order to provide engineered backups, it is often useful to specify the reference clock stratum as greater than zero. The stratum  option
       is  used  for  this  purpose.  Also, in cases involving both a reference clock and a pulse-per-second (PPS) discipline signal, it is useful to specify the reference
       clock identifier as other than the default, depending on the driver. The refid option is used for this purpose. Except where noted, these options apply to all clock
       drivers.
REFERENCE CLOCK COMMANDS
       server 127.127.t.u [prefer] [mode int] [minpoll int] [maxpoll int]
               This command can be used to configure reference clocks in special ways. The options are interpreted as follows:
               prefer  Marks  the reference clock as preferred. All other things being equal, this host will be chosen for synchronization among a set of correctly operat‐
                       ing hosts. See the Mitigation Rules and the prefer Keyword page for further information.
               mode int
                       Specifies a mode number which is interpreted in a device-specific fashion. For instance, it selects a dialing protocol in  the  ACTS  driver  and  a
                       device subtype in the parse drivers.
               minpoll int
               maxpoll int
                       These  options specify the minimum and maximum polling interval for reference clock messages in seconds, interpreted as dual logarithms (2 ^ x). For
                       most directly connected reference clocks, both minpoll and maxpoll default to 6 (2^16 = 64 s). For modem reference clocks, minpoll  defaults  to  10
                       (2^10 = 1024 s = 17.1 m) and maxpoll defaults to 14 (2^14 = 16384 s = 4.5 h). The allowable range is 4 (16 s) to 17 (36.4 h) inclusive.
       fudge 127.127.t.u [time1 sec] [time2 sec] [stratum int] [refid string] [flag1 0|1] [flag2 0|1] [flag3 0|1] [flag4 0|1]
               This command can be used to configure reference clocks in special ways. It must immediately follow the server command which configures the driver. Note that
               the same capability is possible at run time using the ntpdc program. The options are interpreted as follows:
               time1 sec
                       Specifies a constant to be added to the time offset produced by the driver, a fixed-point decimal number in seconds. This is used as  a  calibration
                       constant  to  adjust  the nominal time offset of a particular clock to agree with an external standard, such as a precision PPS signal. It also pro‐
                       vides a way to correct a systematic error or bias due to serial port or operating system latencies, different cable  lengths  or  receiver  internal
                       delay.  The  specified offset is in addition to the propagation delay provided by other means, such as internal DIPswitches. Where a calibration for
                       an individual system and driver is available, an approximate correction is noted in the driver documentation pages.  Note: in  order  to  facilitate
                       calibration  when more than one radio clock or PPS signal is supported, a special calibration feature is available. It takes the form of an argument
                       to the enable command described in the Miscellaneous Options page and operates as described in the Reference Clock Drivers page.
               time2 secs
                       Specifies a fixed-point decimal number in seconds, which is interpreted in a driver-dependent way. See the descriptions of specific drivers  in  the
                       reference clock drivers page.
               stratum int
                       Specifies  the  stratum  number  assigned  to  the  driver, an integer between 0 and 15. This number overrides the default stratum number ordinarily
                       assigned by the driver itself, usually zero.
               refid string
                       Specifies an ASCII string of from one to four characters which defines the reference identifier used  by  the  driver.  This  string  overrides  the
                       default identifier ordinarily assigned by the driver itself.
               flag1 flag2 flag3 flag4
                       These  four  flags are used for customizing the clock driver. The interpretation of these values, and whether they are used at all, is a function of
                       the particular clock driver. However, by convention flag4 is used to enable recording monitoring data to the clockstats  file  configured  with  the
                       filegen command. Further information on the filegen command can be found in the Monitoring Options page.

因此127.127.20.1实际是代表了type 20的时钟类型,1是代表单元号。当前ntpd支持的驱动如下

类型 编号
REFCLK_LOCALCLOCK 1
REFCLK_WWV_PST 3
REFCLK_WWVB_SPECTRACOM 4
REFCLK_TRUETIME 5
REFCLK_IRIG_AUDIO 6
REFCLK_CHU 7
REFCLK_GPS_MX4200 9
REFCLK_GPS_AS2201 10
REFCLK_GPS_ARBITER 11
REFCLK_IRIG_TPRO 12
REFCLK_ATOM_LEITCH 13
REFCLK_IRIG_BANCOMM 16
REFCLK_GPS_DATU 17
REFCLK_NIST_ACTS 18
REFCLK_WWV_HEATH 19
REFCLK_GPS_NMEA 20
REFCLK_GPS_VME 21
REFCLK_ATOM_PPS 22
REFCLK_GPS_HP 26
REFCLK_ARCRON_MSF 27
REFCLK_SHM 28
REFCLK_PALISADE 29
REFCLK_ONCORE 30
REFCLK_JUPITER 31
REFCLK_CHRONOLOG 32
REFCLK_DUMBCLOCK 33
REFCLK_ULINK 34
REFCLK_PCF 35
REFCLK_WWV 36
REFCLK_FG 37
REFCLK_HOPF_SERIAL 38
REFCLK_HOPF_PCI 39
REFCLK_JJY 40
REFCLK_TT560 41
REFCLK_ZYFER 42
REFCLK_RIPENCC 43
REFCLK_NEOCLOCK4X 44
REFCLK_TSYNCPCI 45
REFCLK_GPSDJSON 46
发表在 NTP | 留下评论

ntpq输出说明

以一个阿里云VM上的输出为例


[root@CentOS ~]# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 127.127.1.0     .LOCL.          10 l    -   64    0    0.000    0.000   0.000
#2001:4860:4806: 71.79.79.71      2 u 1012 1024  357  280.158  -15.630   3.135
#2001:4860:4806: 71.79.79.71      2 u  816 1024  377  262.399  -24.971   2.702
#2001:4860:4806: 71.79.79.71      2 u  708 1024  377  364.687  -13.306   4.368
#2001:4860:4806: 71.79.79.71      2 u  606 1024  377  381.816  -28.115   3.897
*182.92.12.11    10.137.38.86     2 u  327 1024  377    0.245    0.810   0.792
+120.25.115.19   10.137.38.86     2 u  824 1024  377   35.800   -0.694   0.819
-120.25.115.20   10.137.38.86     2 u  411 1024  377   35.496    2.679   0.930
+120.25.108.11   10.137.38.86     2 u  947 1024  377   38.739    2.205   0.807
+115.28.122.198  10.137.38.86     2 u  753 1024  377   11.627    0.952   0.938
-10.143.33.49    10.143.0.44      3 u  818 1024  377   28.970   -1.337   0.805
+10.143.33.50    10.143.0.44      3 u  843 1024  377   32.689    0.179   0.832
+10.143.33.51    10.143.0.44      3 u  838 1024  377   32.612    0.252   0.848
+10.143.0.44     10.137.38.86     2 u  889 1024  377   25.149    0.277   0.786
+10.143.0.45     10.143.0.44      3 u  853 1024  377   32.282    0.468   0.808
#10.143.0.46     10.143.0.44      3 u  983 1024  377   29.398   -1.656   0.943

remote是远程ntp server的地址在remote前面有各种+ – x #等,也是有相应得含义的


x   discarded by intersection algorithm
.   discarded by table overflow (not used)
-   discarded by the cluster algorithm
+   included by the combine algorithm
#  backup (more than tos maxclock sources)
*   system peer
o   PPS peer (when the prefer peer is valid)

refid

association ID or kiss code

st

stratum层级,GPS为0级,GPS授时服务器为一级。最大不能超过15级。

t是peer类型


u: unicast or manycast client
b: broadcast or multicast client
l: local (reference clock)
s: symmetric (peer)
A: manycast server
B: broadcast server
M: multicast server

when

上一次收到包的时间间隔

poll

同步间隔2^n次方

reach

查询到得总次数

delay

往返延迟,单位是ms

offset

远程时间减去本机时间的差值,单位是ms。为正数说明本地时间比远程时间慢,为负数说明本地时间更快。

jitter

衡量远程服务器时间稳定的一个参数,越小说明远程时间偏差越小。

参考资源

  1. https://www.eecis.udel.edu/~mills/ntp/html/decode.html#peer
  2. https://www.eecis.udel.edu/~mills/ntp/html/ntpq.html
发表在 dns | 标签为 | 留下评论

DNS解析时间与访问量 TTL的关系

大家在维护DNS的时候会有一个烦恼,很难平衡几个点
1. 域名的平均解析时间要很短
– 因为网站访问的时候所有得请求都需要依赖DNS解析,如果网站的访问量小,用户每次请求时需要先等递归DNS递归,整体的时间会很长。
2. 机房故障的时候切换要快
– 有多IDC的人都会面临一个问题,单个IDC故障的时候希望能尽快通过DNS将流量切换到另外的一个IDC,这个时候需要TTL短。
3. DNS的部署成本
– 正常网站的dns其实都不大的,如果没有攻击,4个机器跑个bind也能支撑国内BAT的一起的DNS解析。
– 如果我们希望DNS的解析效果好,就需要在部署位置、接入网络等各方面想办法优化,成本也是指数增加。

不同频率的DNS解析任务来统计DNS的解析时长,可以分析一下网站访问量,域名TTL和用户侧平均DNS解析耗时之间的一些关系。


上图是相同TTL的域名,在访问频率不同的场景下的对比,可以看出随着监控域名的解析频率从1分钟下降到5分钟一次后,DNS的解析时间从66ms增加到85ms。

再从相同监控频率,不同TTL的解析这个维度来看

随着TTL从60s提升到120s,DNS的平均解析时间从66ms下降到59ms。

再看看当TTL提升到600s的时候,DNS的平均解析时间下降到 47ms左右。

基于以上场景对比,我们可以有结论:
1. TTL适当增加,DNS的延迟可以大幅下降。
2. 网站访问量的增加,DNS延迟也可以有大幅下降。

DNS在用户终端的平均解析时间其实很难对比,也不存在完美的最佳实践。对一般中小企业,建议:
1. DNS的TTL 300-600S,如果访问量不是很大,不建议TTL下降到120以下。
2. 机房切换的容忍时间5-10分钟。

发表在 dns | 4条评论

使用线程安全的strtok_r

最近改写一个dns-flood的程序为多线程模式,发现每个线程中生成的随机数字经常是一样 。


void nameformat(char *name, char *QS)
{
        char *bungle, *x;
        char elem[128];

        *QS = 0;
        bungle = malloc(strlen(name) + 3);
        strcpy(bungle, name);
        x = strtok(bungle, ".");
        while (x != NULL) {
            if (snprintf(elem, 128, "%c%s", strlen(x), x) == 128) {
                puts("String overflow.");
                exit(1);
            }
            strcat(QS, elem);
            x = strtok(NULL, ".");
        }
        free(bungle);
}

该函数是在构造DNS请求报文中被调用,通过传入指针name将字符串复制到QS指向的地址内。debug发现QS经常打印出来和name不一样,查了发现strtok不是线程安全的,改用strtok_r后终于OK了。


void nameformat_r(char *name, char *QS)
{
        char *bungle, *x;
        char elem[128];
        char *flag;
        *QS = 0;
        bungle = malloc(strlen(name) + 3);
        strcpy(bungle, name);
        x = strtok_r(bungle, ".", &flag);
        while (x != NULL) {
            if (snprintf(elem, 128, "%c%s", strlen(x), x) == 128) {
                puts("String overflow.");
                exit(1);
            }
            strcat(QS, elem);
            x = strtok_r(NULL, ".", &flag);
        }
        free(bungle);
}
发表在 ANCI C | 留下评论

dnspython读取dnszone所有记录

需求

有时需要从zone文件里解析DNS的数据,做一些分析。可以利用dnspython库做zone的解析处理。
简单写一个如下


#!/usr/bin/env python
import dns.zone
import dns.ipv4
import os.path
import sys
import os
import string
import re
zonefile=sys.argv[1]
name=sys.argv[2]
class LOAD_ZONES:
  def  __init__(self,zonefile,name):
    self.types=("A","CNAME","TXT","SOA","MX","NS","PTR")
    self.record=dict()
    self.zonefile=zonefile
    self.name=name
    for type in self.types:
      self.record[type]=dict()
    try:
      zoneload= dns.zone.from_file(f=self.zonefile,origin=self.name,check_origin=False,relativize=False)
      for type in self.types:
        for (name, ttl, rdata) in zoneload.iterate_rdatas(type):
          dname=str(name)
          l = self.record[type].get(dname)
          if l is None:
            self.record[type][dname] = set()
          if type == "A":
            self.record[type][dname].add( ("%s-%s") % (ttl,rdata.address ) )
          else:
            self.record[type][dname].add( ("%s-%s") % (ttl,rdata.to_text().lower()) )
    except dns.zone.NoSOA:
      print "%s no soa" % self.zonefile
    except dns.zone.NoNS:
      print "%s no ns" % self.zonefile
  def dump_record(self):
    for type in self.types:
      for k in self.record[type].keys():
        print k,type,self.record[type][k]
    def __del__(self):
        pass

dns=LOAD_ZONES(zonefile,name)
dns.dump_record()

输入


./load_zone.py test.org.zone test.org
发表在 dns | 留下评论

升级kernel 4.9 尝试BBR

BBR介绍

BBR (Bottleneck Bandwidth and RTT)算法对弱网络下提升性能有一定帮助。虽然说在国内很多公司也都内部有类似的内核协议栈的改进,并且很多的效果
都不比google差,但是这个好歹是进入了kernel 主干的,大家都可以自由使用。

centos7 编译升级

centos编译内核rpm


yum -y install gcc ncurses ncurses-devel bc openssl–devel  perl-devel
make localmodconfig
make menuconfig # 选中BBR
grep -i bbr .config #确认是否选中
make rpm

修改引导项目


grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg

重启后查看


[root@CentOS ipv4]# uname -a
Linux CentOS 4.9.0 #1 SMP Sat Dec 17 00:47:52 CST 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@CentOS ipv4]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr reno cubic

ubuntu 16.04升级

因为我买AWS EC2的时候忘记选磁盘了,磁盘只有8G,造成本地编译内核的时候发现编译不了。就网上找了几个deb包直接安装上了。


wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb
get http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900_4.9.0-040900.201612111631_all.deb
sudo dpkg -i *.deb
sudo update-grub
sudo reboot

重启后设置内核参数


sudo sysctl -w net.ipv4.tcp_congestion_control=bbr
发表在 System | 2条评论

wordpress添加腾讯统计

1. 基本统计

  • /var/www/blog/wp-content/themes/twentyten/header.php 的后添加

<script type="text/javascript">
    var _speedMark = new Date();
</script>

2. 测速统计

  • /var/www/blog/wp-content/themes/twentyten/footer.php 之前加

<script type="text/javascript" src="http://tajs.qq.com/stats?sId=XXXXXX" charset="UTF-8"></script>
发表在 System | 留下评论