惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - 问天何必

网文小说应该怎么从零开始设计故事情节呢? 拒绝花里胡哨,这次来真的,又做了一个导航+超级搜索, 50+功能自定义调整。 一个优秀的导航站。 1个能顶100个 Redis 挂了自动重启的shell 脚本。 苹果cms自动采集,重复执行遇到“上次执行时间: --跳过”的解决办法 苹果cms, 后台设置保存不了的解决办法 c# 【电影搜索引擎】采集电影站源码 解决 C:\WINDOWS\system32\inetsrv\rewrite.dll 未能加载。返回的数据为错误. - 问天何必 安利一个聚合搜索导航站,及怎么样设置成默认的搜索引擎 img error 图片加载失败的最佳方案 百度站长平台HTTPS认证所遇到的坑 百度Sitemap生成器 女朋友经常问影视剧, 答不上来怎么办? fiddler抓取手机上https数据配置和失败的解决办法 STSDB 一 windows2012 IIS部署GeoTrust证书踩过的坑。 百度编辑器解决span被过滤, 自动加P标签 jquery ajax GET POST 跨域请求实现 代码记录:使用Aforge.net让视频图像反转180度
宝塔linux面板, 服务器日志分析与流量统计这款插件的mysql版优化。
问天何必 · 2020-05-25 · via 博客园 - 问天何必

 在花1块钱,购买了那个《服务器日志分析与流量统计》这个插件, 用来分析日志和流量, 当www.wxtv.net流量巨大, 短短几天就产生了8百万条网站日志,  使用的是mysql存储日志的方式,   该插件的作者几乎没有优化过mysql存储方式(我也不知道sqlite方式有没有优化),  大几百万的日志, 查询几乎打不开, 还把整个mysql拖死。 打开mysql的慢日志查询, 发现全是统计的语句超时了。 

慢日志记录:

SET timestamp=1590377705;
select website,ip,CAST(time AS CHAR) AS time,httpstatus,size,httpmothed,pageurl,shebieinfo from weblogs where website='www.wxtv.net' and time>='2020-05-2100:00:01' and time<='2020-05-2123:59:59' and shebieinfo like '%baidus%' order by time desc limit 0,100;
# Time: 200525 11:35:10
# User@Host: wlog[wlog] ******  Id: 1230472
# Query_time: 4.893739  Lock_time: 0.000176 Rows_sent: 1  Rows_examined: 2227923
SET timestamp=1590377710;
select count(ip) from weblogs where website='www.wxtv.net' and time>='2020-05-2100:00:01' and time<='2020-05-2123:59:59' and shebieinfo like '%baidus%' order by time desc;

解决办法:

增加weblogs表的time字段的索引。 操作步骤如下:

1. 点击左边菜单“数据库”。

2. 选择当时日志配置的mysql数据库, 点击管理,打开phpMyAdmin。 

3.  在phpMyAdmin中, 选择日志的数据库。  点击结构。 

4. 点击time字段操作列中的索引, 给time字段新建索引。  

建好索引后, 再打开《服务器日志分析与流量统计》这个插件, 查询速度变成了秒级。 

PS: 该款插件只卖1块钱, 所谓1分钱一分货, 作者在mysql方式上, 几乎都没有测试。  买过来, 可以打开它的源码, 修改代码, 在服务器上进行优化。