遗留问题: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. 高性能页面加载技术(流水线加载)BigPipe的C#简单实现(附源码)

    一,BigPipe简介 BigPipe是一个重新设计的基础动态网页服务体系.大体思路是,分解网页成叫做Pagelets的小块,然后通过Web服务器和浏览器建立管道并管理他们在不同阶段的运行.这是类似于 ...

  2. 显示 SQLite 日志

    通过在 Logcat 查看 SQL 执行语句可以帮助你调试 SQLite 问题, 使用 ADB SHELL 执行如下命令即可在 Logcat 输出 SQL 执行日志: adb shell setpro ...

  3. Light OJ 1032 - Fast Bit Calculations(数位DP)

    题目大意: 一个数字把他看成二进制数字,数字里又会一些相邻的1,问从0到n至间所有相邻1的总和是多少?   分解成2进制数字,然后数位DP就行了.   ======================== ...

  4. 【转】微信Android SDK示例代码及运行方法

    原文网址:http://blog.csdn.net/icyfox_bupt/article/details/23742217 最近在研究微信SDK,无奈网上好使的教程太少,对于程序员来说最好的东西,一 ...

  5. JS原型函数相关基础知识

    函数对象和普通对象 //普通对象 var oo1 = {}, oo2 = new Object(), oo3 = []; console.log(typeof oo1 + ',' + typeof o ...

  6. Quality in the Test Automation Review Process and Design Review Template

    About this document Prerequisite knowledge/experience: Software Testing, Test Automation Applicable ...

  7. 使用Sql按日期条件查询

    --查询当天(1: select * from ShopOrder where datediff(day,ordTime,getdate()-1)=0 --查询当天(2:select * from i ...

  8. Leetcode那点事儿

    1 .Two Sum 2.Add Two Numbers 3.Longest Substring Without Repeating Characters 7.Reverse Integer  26. ...

  9. 【C++】冒泡排序、插入排序、快速排序

    #include<iostream> using namespace std; void BubbleSort(int *a,int istart,int len)//冒泡排序 { //a ...

  10. php写excel

    $this->loadexcel();        $objPHPExcel = new PHPExcel();        $objPHPExcel->getProperties() ...