遗留问题:whid=1969的日志记录是什么意思?

网站站点信息未分配的时候,会用1969去代替站点信息。

PV:页面浏览量(page view),用户每次打开或刷新一次网页即被计算一次.

关于pv的计算,我们首先考虑下最简单的情况:计算易迅网每天的的pv,这个pv不分站点和渠道.

我们打开跳板机,进入75机器的shell目录.

打开shell目录里的siteKeyData_AllSite.sh,开始研究这个文件.

我们注意到这个脚本文件里,有一个getPV函数,我们来看下这个函数.

pv计算规则:

①页面跳转,并且当前页面id合法;

②网站端的,不计无线;

③IFrame内嵌页卡不计入PV;

④外部投放的页卡不计入PV;

⑤符合以上4点的就算做一条pv,pv数加1.

我们根据以上5点,写一个测试脚本vic_AllSite_pv.sh.算一下20140909号的的一天的易迅网的pv量.

 #!/bin/bash

 ## file name: vic_AllSite_pv.sh

 ## example: ./vic_AllSite_pv.sh  

 #获取当前脚本所在路径
currdir=$(cd "$(dirname "$")"; pwd) #进入脚本所在目录
cd $currdir ## PHP path
PHP_BIN="/usr/local/php/bin/php" ## 显示脚本的正确用法
function showUsage()
{
echo "Usage: sh vic_AllSite_pv.sh [log_file_time]" >&
exit ;
} ## 如果参数为0,则显示该脚本的用法
if [ $# = ]; then
showUsage
fi ## 变量初始化
start_time=`date "+%Y-%m-%d %H:%M:%S.%N"`
if [ $# = ]; then
log_file_time=$
fi ## 处理结果的存储文件名
result_pv_filename="../data_today/""vic_ALLSITE_PV""_""$log_file_time" ## site_key
## warehouseid - 各分站总体数据
## warehouseid_1 - 各分站商品详情页数据 ## get PV
function getPV()
{ log_file_time=$
log_filename="row_data_"$
log_filename=$log_filename"*" awk -v fdate=$log_file_time -v ftype=$period_type -F"\t" '{
## 不是页面跳转或者当前页面id不合法的请求,过滤掉
if($ != || int($) < ) next; ## 不计无线
wh_id = int($);
## if ( (wh_id == ) || (wh_id == ) || (wh_id == ) || (wh_id == ) ) next;
if ( (wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) ) next; ## IFrame内嵌页卡不计入PV
if( (int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ) next; ## 外部投放的页卡不计入PV
if( == $ && !match($, /buy\.(51buy|yixun)\.com/)) next; if((int($) % == ) || match($, /item\.(51buy|yixun)\.com/)) {
pvArr["0_1"] = pvArr["0_1"] + ;
} if((int($) == ) || match($, /buy\.(51buy|yixun)\.com\/cart\.html/)) {
pvArr["0_2"] = pvArr["0_2"] + ;
} if((int($) == ) || (int($) == ) || match($, /buy\.(51buy|yixun)\.com\/order.html/)) {
pvArr["0_3"] = pvArr["0_3"] + ;
} ## key: 分站ID
pvArr[""] = pvArr[""] + ;
} END {
for(key in pvArr)
{
print key"\t"pvArr[key] > "../data_today/""ALLSITE_PV_"ftype"_"fdate
}
}' ../data_today/$log_filename
} ## start execute
getPV $log_file_time ## store result to DB
##${PHP_BIN} -c . -f siteKeyDataStore_AllSite.php $result_pv_filename $result_uv_filename $result_btnuv_filename ## process end time
end_time=`date "+%Y-%m-%d %H:%M:%S.%N"` echo -e "ALLSITE_PV_Data:""["",""$log_file_time""]:""$start_time""~""$end_time"

vic_AllSite_pv.sh

计算结果如下:

0 3430852 //全站一天的pv
0_1 1071985 //商品详情页pv
0_2 76135 //购物车pv
0_3 40871 //下单页pv

全站的pv比较好算,那么各分站的pv又该怎么去算呢.

其实有了前面的基础,分站的计算就比较简单了,我们更改一下脚本.

 #!/bin/bash

 ## file name: vic_Sites_pv.sh

 ## example: ./vic_Sites_pv.sh  

 #获取当前脚本所在路径
currdir=$(cd "$(dirname "$")"; pwd) #进入脚本所在目录
cd $currdir ## PHP path
PHP_BIN="/usr/local/php/bin/php" ## 显示脚本的正确用法
function showUsage()
{
echo "Usage: sh vic_Sites_pv.sh [log_file_time]" >&
exit ;
} ## 如果参数为0,则显示该脚本的用法
if [ $# = ]; then
showUsage
fi ## 变量初始化
start_time=`date "+%Y-%m-%d %H:%M:%S.%N"`
if [ $# = ]; then
log_file_time=$
fi ## 处理结果的存储文件名
result_pv_filename="../data_today/""vic_SITES_PV""_""$log_file_time" ## site_key
## warehouseid - 各分站总体数据
## warehouseid_1 - 各分站商品详情页数据 ## get PV
function getPV()
{ log_file_time=$
log_filename="row_data_"$
log_filename=$log_filename"*" awk -v fdate=$log_file_time -v ftype=$period_type -F"\t" '{
## 不是页面跳转或者当前页面id不合法的请求,过滤掉
if($ != || int($) < ) next; ## 不计无线
wh_id = int($);
## if ( (wh_id == ) || (wh_id == ) || (wh_id == ) || (wh_id == ) ) next;
if ( (wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) &&
(wh_id != ) ) next; ## IFrame内嵌页卡不计入PV
if( (int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ||
(int($) == ) || (int($) == ) ) next; ## 外部投放的页卡不计入PV
if( == $ && !match($, /buy\.(51buy|yixun)\.com/)) next; if((int($) % == ) || match($, /item\.(51buy|yixun)\.com/)) {
pvArr[$"_1"] = pvArr[$"_1"] + ;
} if((int($) == ) || match($, /buy\.(51buy|yixun)\.com\/cart\.html/)) {
pvArr[$"_2"] = pvArr[$"_2"] + ;
} if((int($) == ) || (int($) == ) || match($, /buy\.(51buy|yixun)\.com\/order.html/)) {
pvArr[$"_3"] = pvArr[$"_3"] + ;
} ## key: 分站ID
pvArr[$] = pvArr[$] + ;
} END {
for(key in pvArr)
{
print key"\t"pvArr[key] > "../data_today/""SITES_PV_"ftype"_"fdate
}
}' ../data_today/$log_filename
} ## start execute
getPV $log_file_time ## store result to DB
##${PHP_BIN} -c . -f siteKeyDataStore_AllSite.php $result_pv_filename $result_uv_filename $result_btnuv_filename ## process end time
end_time=`date "+%Y-%m-%d %H:%M:%S.%N"` echo -e "SITES_PV_Data:""["",""$log_file_time""]:""$start_time""~""$end_time"

计算结果如下:

2001_3 5789
1_3 16977
4001_1 76058
2001 550962
1969_1 22
4001_2 4795
3001 314763
1969_2 1
4001_3 2252
4001 239516
5001 134831
3001_1 93959
3001_2 6710
1001_1 291933
3001_3 3231
5001_1 40875
1001_2 19668
5001_2 2934
1001_3 11163
5001_3 1459
1969 19877
1 1283055
2001_1 181135
1_1 388003
2001_2 10970
1_2 31057
1001 887848

剩下的就是渠道pv数据的计算了.我们另起一章,详细解说.

关于pv的那些事!!的更多相关文章

  1. BI任务列表

    了解点击流系统和pv/uv的相关计算 关于pv的那些事!! ···············································2014-09-10 homework做了些什 ...

  2. @ConfigurationProperties 配置详解

    文章转自 https://blog.csdn.net/qq_26000415/article/details/78942494 前言新的一年到了,在这里先祝大家新年快乐.我们在上一篇spring bo ...

  3. 网络服务器搭建的那些事(PV QPS Throughput) 转载

    一.前言: 从事后台sever开发的同学,代码开发完成之后,上线之前,总会进行各种黑盒白盒测试,压测.正确性测试... 而测试同学,会给开发同学一份测试报告,需要开发同学进行确认...问题来了,里面好 ...

  4. Pinterest 架构:两年内月 PV 从零到百亿【翻译】

    原文地址 这篇文章,采用 Markdown 方式,写的还是比较实在的,要是有架构图就好了. Pinterest 是图片版的 Twitter,用户把自己感兴趣的东西用图钉(Pins)钉在钉板(PinBo ...

  5. 从100PV到1亿级PV网站架构演变

    如果你对项目管理.系统架构有兴趣,请加微信订阅号"softjg",加入这个PM.架构师的大家庭 一个网站就像一个人,存在一个从小到大的过程.养一个网站和养一个人一样,不同时期需要不 ...

  6. 两年内从零到每月十亿 PV 的发展来谈 Pinterest 的架构设计(转)

    原文:Scaling Pinterest - From 0 To 10s Of Billions Of Page Views A Month In Two Years 译文:两年内从零到每月十亿 PV ...

  7. [转载]从100PV到1亿级PV网站架构演变

    原文地址:http://www.uml.org.cn/zjjs/201307172.asp 一个网站就像一个人,存在一个从小到大的过程.养一个网站和养一个人一样,不同时期需要不同的方法,不同的方法下有 ...

  8. 关于Redis的那些事

    1.  MySql+Memcached架构的问题 Memcached采用客户端-服务器的架构,客户端和服务器端的通讯使用自定义的协议标准,只要满足协议格式要求,客户端Library可以用任何语言实现. ...

  9. Pinterest架构:两年内月PV从零到百亿

    Pinterest正经历了指数级曲线般的增长,每隔一个半月就翻番.在这两年里,Pinterest,从 每月PV量0增长到100亿,从两名c创始人和一个工程师成长为四十个工程师,从一台MySQL 服务器 ...

随机推荐

  1. php pdo和mysqli对比选择

    1)总的比较   PDO MySQLi 数据库支持 12种不同的数据库支持 支持MySQL API OOP OOP + 过程 Connection Easy Easy 命名参数 支持 不支持 对象映射 ...

  2. 【 POJ - 1204 Word Puzzles】(Trie+爆搜|AC自动机)

    Word Puzzles Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 10782 Accepted: 4076 Special ...

  3. highestAvailable比较灵活,毕竟大多数功能不需要系统最高权限(四种方法:屏蔽UAC,右键以管理员身份运行,增加manisfest,制作数字证书)

    打开VS2005.VS2008.VS2010工程,查看工程文件夹中的Properties文件夹下是否有app.manifest这个文件:如没有,按如下方式创建:鼠标右击工程在菜单中选择“属性”,点击工 ...

  4. ubuntu下virtualbox使用u盘

    1.virtualbox中使用u盘流程 以下是使用U盘的整个流程(参考了网络上其他人的教程,亲测可用): 添加当前用户为vboxusers一员 终端输入:cat /etc/group |grep vb ...

  5. JVM参数配置大全

    前阵子遇到几个面试题都是关于对Java内存控制的,因此从网上找到这篇文章,希望自己对Java的内存分配有重新的认识 /usr/local/jdk/bin/java -Dresin.home=/usr/ ...

  6. Apache Hadoop RPC Authentication 安全绕过漏洞

    漏洞名称: Apache Hadoop RPC Authentication 安全绕过漏洞 CNNVD编号: CNNVD-201308-425 发布时间: 2013-08-28 更新时间: 2013- ...

  7. HDFS Block Replica Placement实现原理

    1. 背景   Block Replica Placement——数据块复本存储策略,HDFS Namenode以此为依据选取数据块复本应存储至哪些HDFS Datanodes,策略的设计需要权衡以下 ...

  8. Tcxtreelist动态控制列或行是否能够编辑

    procedure Tfrmaaa.grd1Editing(Sender: TObject; AColumn: TcxTreeListColumn; var Allow: Boolean);begin ...

  9. [转载]css hack

    做前端多年,虽然不是经常需要hack,但是我们经常会遇到各浏览器表现不一致的情况.基于此,某些情况我们会极不情愿的使用这个不太友好的方式来达到大家要求的页面表现.我个人是不太推荐使用hack的,要知道 ...

  10. jQuery 属性操作和CSS 操作

    如有在jQuery方法中涉及到函数,此函数必定会返回一个数值(函数由于运行次数不同触发一些不同效果) jQuery 属性操作方法(以下方法前些日子学习过,不再赘述) addClass() attr() ...