策略: Google在数据挖掘中使用Canary Request来试探测Query的破坏性

Google通过重放日志和CanaryRequest技术来减轻查询导致的大规模集群故障问题。前者通过历史日志寻找潜在的破坏性查询,后者则通过在单台机器上测试查询的安全性。

Google在上千个节点上查询内存中的数据并合并结果,其中最严重的问题之一就是:死亡查询(Query of Death)

一个查询可能导致一个程序失败,失败的原因可能是程序bug或者其它因素。这意味着一个单独的查询有可能导致整个集群崩溃。这对于可用性和响应时间来说都是不好的, 因为重新恢复成千台机器的运行时环境需要较长时间。因此,将这样的查询称为死亡查询 。 新的查询不断进入系统,新的软件也不断部署到系统上,导致死亡查询 问题不可能完全被解决。

两个可行方案:
* 针对日志的测试 :google重放了一个月的日志,看这些日志中有什么样的查询会导致系统挂起。这种方法有意义,但是死亡查询依然会出现。
* 发送Canary Request : 将一个请求发送到一台机器上。如果这个请求被成功执行,那么可以推想,这个请求能在所有机器上成功被执行,所以,可以放行这个请求到集群中。如果这个请求 失败,那么只会导致那一台机器挂起,无伤大雅。然后再选一台机器,重新测试请求来确认这个请求是否真的是死亡查询。如果一个请求失败过一定的次数,那么这 个请求将会被拒绝执行,并且记入日志中,将来用于进一步debug。

这样做的结果是,只有几台机器会挂起,而不是成千台机器同时失败。这个技术很聪明,它利用了已有的扩展技术(scale-out)和连续部署技术 (continuous deplyment)。这种策略应该也可以被其他系统所借鉴。

Strategy: Google Sends Canary Requests into the DataMine

Google runs queries against thousands of in-memory index nodes in parallel and then merges the results. One of the interesting problems with this approach, explains Google's Jeff Dean in this lecture at Stanford , is the Query of Death .

A query can cause a program to fail because of bugs or various other issues. This means that a single query can take down an entire cluster of machines, which is not good for availability and response times, as it takes quite a while for thousands of machines to recover. Thus the Query of Death. New queries are always coming into the system and when you are always rolling out new software, it's impossible to completely get rid of the problem.

Two solutions:

  • Test against logs . Google replays a month's worth of logs to see if any of those queries kill anything. That helps, but Queries of Death may still happen.
  • Send a canary request . A request is sent to one machine. If the request succeeds then it will probably succeedon all machines, so go ahead with the query. If the request fails the only one machine is down, no big deal. Now try the request again on another machine to verify that it really is a query of death. If the request fails a certain number of times then the request if rejected and logged for further debugging.

The result is only a few servers are crashed instead of 1000s. This is a pretty clever technique, especially given the combined trends of scale-out and continuous deployment. It could also be a useful strategy for others.

基于粒子群优化算法的p-Hub选址优化(Matlab代码实现)内容概要:本文介绍了基于粒子群优化算法(PSO)的p-Hub选址优化问题的研究与实现,重点利用Matlab进行算法编程和仿真。p-Hub选址是物流与交通网络中的关键问题,旨在通过确定最优的枢纽节点位置和非枢纽节点的分配方式,最小化网络总成本。文章详细阐述了粒子群算法的基本原理及其在解决组合优化问题中的适应性改进,结合p-Hub中转网络的特点构建数学模型,并通过Matlab代码实现算法流程,包括初始化、适应度计算、粒子更新与收敛判断等环节。同时可能涉及对算法参数设置、收敛性能及不同规模案例的仿真结果分析,以验证方法的有效性和鲁棒性。; 适合人群:具备一定Matlab编程基础和优化算法理论知识的高校研究生、科研人员及从事物流网络规划、交通系统设计等相关领域的工程技术人员。; 使用场景及目标:①解决物流、航空、通信等网络中的枢纽选址与路径优化问题;②学习并掌握粒子群算法在复杂组合优化问题中的建模与实现方法;③为相关科研项目或实际工程应用提供算法支持与代码参考。; 阅读建议:建议读者结合Matlab代码逐段理解算法实现逻辑,重点关注目标函数建模、粒子编码方式及约束处理策略,并尝试调整参数或拓展模型以加深对算法性能的理解。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值