一次一小时的缓存迁移压测,我是怎么把它交给 Cursor「盯着跑完」的

📅 2026/8/5 2:50:01
一次一小时的缓存迁移压测,我是怎么把它交给 Cursor「盯着跑完」的
用一回真切实在的「6个租户×三场景内存压测」来表明, 能为你去安排编排些什么, 不能代办包办哪些事项, 另外, 省下的那些时间究竟都用到什么地方去了, 写在最开始之前。做基建或中间件的人大概都干过这种活若是人一旦走神的状况出现, 那么窗口那怕是歪了要是人始终目不转睛地盯着, 那半天时间也就没了。讲真, 这般的值守较之于写代码而言可是更耗费人的哟。就在前些日子里, 我开展了一回缓存迁移三场景的内存压测工作。整个过程大概花费了70分钟 , 涉及6个现网租户 , 每个租户有三个场景情况 , 对于每个场景都要观察180秒时长。最后我并非自己坐在屏幕跟前进行计时抄写操作 , 而是在将任务编排清晰之后交给Agent去跑完 , 在关键节点它会把进度推送回来 , 这一点着实挺解压的 , 起码不用一直盯着秒表发呆。这篇文章想讲三件事这一回究竟是在对什么进行测试、步骤究竟是如何安排的、在其中实际所做的事情是什么、边界在何处、效率又体现在哪些节省之处呢?不是来吹 AI 多能干就是一次能复盘的协作记录。一、任务长什么样简单但很长业务目标缓存需要从先前的集群迁移至新的集群, 对于互联网上每个实际租户, 可以在三种特定切换流量状态下重新播放获取流量, 从而查看接入层面缓存代理地方所处运营内部的存储情况和使用内存:场景切流意图流量走向策略在但不命中该租户只打旧缓存双写双读且命中该租户旧缓存 新缓存切流完成只打新缓存指标很明确就是进程常驻内存process_resident_memory_bytes{job接入服务}采集用的口径是, 三个接入实例各自进行相关操作, 之后求和, 接着在做后处理时进行除以三的运算从而得到单实例均值, 以此来方便进行横向对比, 别问为什么要除以三, 理由是汇报的人想要看单机大概是多少, 要是呈现求和的数据表, 他们会觉得数据量太大。手工跑一个租户的标准动作对齐过的流程大概是这样重启3台接入实例, sleep, 将切流策略变更为双写, 而为租户填写一个故意不命中的比如1, 秒, 启动流量回放, 朝着接入入口发送该租户的现网180秒, 记录内存SQL, 把策略里的租户改成真实ID回放不要断开, 再经过180秒, 记录, 然后再次重启接入清除内存基线, 将SQL改成「已完成/仅新缓存」, 再过180秒, 记录, 最后停止回放。一个租户大约 10 分钟6 个就是 一小时出头。难的点从来并不是在于「会不会去写那两句 SQL」, 而是在于: 不要遗漏步骤, 不要看错窗口, 不要在中途刷手机从而把窗口错过。二、如何进行编排呢: 首先要将「可重复」这一内容写进脚本之中, 之后再使得 Agent 去执行 1. 把人工制定的标准作业程序固化成为自动化脚本。我们没有让模型, 通过「临场发挥点点鼠标」这种方式, 因为那样实在是太悬了。即便嫌麻烦, 也必须先把流程写成可重复入口, 举例如下:python3 bench_gray_memory.py --uids-file bench_uids.txt这里的 uid 就是租户 / 客户标识习惯叫法没改。脚本里写死这些约定倘若不按照这种方式去做, 那么 Agent 极易自行创立出一套针对压测语义的内容, 而后你面对最终结果时候无法进行账目的核对。将其与 SOP进行对齐是极为麻烦的事情, 不过相比于返工而言倒是省力一些。2. 长任务丢后台用「输出匹配」叫醒 Agent确确实实能够使体验呈现出仿佛是存在其他人正在一同与其推行同步进展这样子情形的, 乃是其后台所具备的命令方面的能力:后台运行着压测进程, 另外开启且持续写入.log文件, 同时启动一个tail -F去盯着日志, 并给其挂上匹配规则, 比如:日志当中命中了关键字, 进而系统唤醒了Agent, 然后Agent去读取状态, 最后用两三句话推送给你。并非模型于聊天之中随意揣测进度这般, 而是任务自身吐出能够被观测到的信号, 随后系统将 Agent 唤醒进行汇报。将其与传统的「人力 tail -f 加上自己抄录至群聊里」相比较, 其中的差别在于唤醒以及摘要被纳入了对话流程, 如此你能够去从事其他的事情, 只是偶尔瞅一眼推送便可以。同类机制, 还能够运用在, /loop定时检查当中, 亦可用于CI结束通知, 在PR里, 冲突以及红灯需要一同盯着, 这些思路, 大致是相同的。3. 结果尽量落成文件别只剩聊天记录跑完后我们落了几层最好是有可能再三运用于工程方面资产事项的源自Agent的产出成果。聊天记录进行翻页的过程实在是饱含折磨令人痛苦不已。三、实现机制第一次就挂了反而把边界讲清楚了自动化第一次跑改库那一步直接爆了。缘由显得比较“工程化”: SQL当中的表名反引号 , 当被放入bash -lc... 之际被视作命令替换, bash出现报错 : not found, MySQL语句也遭到截断。那时我凝视着日志大约沉默了三秒——此类坑与人们是否运用AI并无关联, 纯粹是shell转义在作祟。修法同样很土修好重跑6 个租户全流程才跑通。所以我真正所想着重指出的是, 不会使得 shell 转义朝着正确的方向改变, 它能够在身处的切实环境中将出现的难题彻底展现出来, 随后辅助你迅速除去那些问题, 紧接着继续执行。效率源自封闭的循环内所具备的条件, 这些具备的条件是「缩短检查出问题—修复问题—再次尝试执行」所成之序列, 并非是源自「始终不会遭遇失败状况 」中的条件所致。在首次实施便能顺利通过的情况? 那绝对是不符合常理的。另一个边界也很典型目标由「长得像 」转变为「数据与口径为一套」, 如此这般才称得上是提效, 截图党的那些小心思, 凉了便凉了。四、能力边界一张表就够了擅长不擅长 / 做不到把已对齐的 SOP 写成脚本并执行替你拍板「该怎么切流、算不算达标」长任务后台跑 关键字进度推送没信号时猜进度查 / 落盘 / 画直接截你本机浏览器当前页修 bash/SQL/容器类具体故障保证第一次编排就零缺陷并行查日志、改代码、写文档绕过权限、审批和变更规范说白了它适合高强度执行和值守不适合替你拍架构板子。什么该测、怎样去判、窗口时长几何, 你得对齐清晰, 如此它方可吃掉那些重复劳动。五、效率提升到底花在哪里以这次压测粗算人的时间环节纯人工有 编排后对齐场景与口径仍需要省不掉仍需要写/改自动化脚本1数小时对话式迭代通常更快6 租户 × 三场景执行~70 分钟全程值守可去做别的事节点被推送叫醒抄 / 整理表易错、重复、眼神疲劳落盘 ÷3 出最终表中途失败重跑心态先崩一半再重来修一点从断点语义重跑真正省下的通常不是「思考业务」的时间而是那种最无聊的值守时间, 也就是盯着秒表、盯着面板的时间, 进行誊写, 并且要对齐时间, 这里的时间包括表、窗口、租户ID, 还要完成小故障的修复闭环, 此中有反引号、容器、权限。倘若你一年之中所具备的价值在于「设计压测」以及「解读结果」这二者, 那么将值守交付给 Agent 的话, 性价比便会相当之高。人应当去思索数字呈现那般模样的缘由, 而并非面对着 180 秒的倒计时处于发呆状态。六、给想试的人的最小操作建议有类似长流程的话可以按这个顺序来先将 SOP场景、SQL、窗口、指标口径进行对齐, 而后写进文档或者注释当中, 要是懒得写的话, 也至少自己念上一遍之后再进行脚本化通过一个入口命令跑完整个流程, 接着交给 Agent 后台去执行, 并且要明确表述: 「在后台运行当日志呈现 END uid 或者 ERROR 的时候主动告知我」, 其结果要求进行落盘CSV 或者 JSON 格式, 要是需要展示的话就重新查找, 绘制图表时要保留人工门禁, 还有更改切流策略、重启集群以及对现网存在副作用的动作, 那些动作的指标口径需要你先做出决定。对关键字进行检索的话: 后台的Shell, 加上输出匹配的通知, 以及“/loop”, 还有“Hooks /”。这样就够用了, 不要一开始就堆砌一堆概念。七、结尾这次压测对我最大的启发不是某个模型答对了题而是当任务能够被描绘成可进行观测的状态机, 其流程为重启后续接改配置改配置后续承接打流, 打流后续跟着等窗, 等窗后续伴随采指标进而进入下一状态, 那样便能够以执行者、值守者以及记录者的身份, 将一小时的机械流程压缩成先对齐, 对齐过后启动, 启动之后偶尔去看一眼推送相关内容, 看过推送之后收取所产生的结果。它省下的是重复劳动它逼你做的是把流程讲清楚烦但有用它暴露的是环境里真实的坑。要是你同样在进行缓存迁移、正在做灰度验证、还在搞长稳回放, 不妨选取一个「步骤清晰然而非常耗时间」的任务尝试一回——关键之处不在于让 AI 为你承担责任, 而是使它为你留意那些原本不应当由人一直盯着的时钟。完WWw.msslke.cN/post/47946.htmlWWw.msslke.cN/post/2478.htmlWWw.msslke.cN/post/46630.htmlWWw.msslke.cN/post/33020.htmlWWw.msslke.cN/post/6210.htmlWWw.msslke.cN/post/33080.htmlWWw.msslke.cN/post/33616.htmlWWw.msslke.cN/post/37392.htmlWWw.msslke.cN/post/15086.htmlWWw.msslke.cN/post/32152.htmlWWw.msslke.cN/post/19868.htmlWWw.msslke.cN/post/32473.htmlWWw.msslke.cN/post/42832.htmlWWw.msslke.cN/post/2480.htmlWWw.msslke.cN/post/45140.htmlWWw.msslke.cN/post/14919.htmlWWw.msslke.cN/post/33972.htmlWWw.msslke.cN/post/45513.htmlWWw.msslke.cN/post/41578.htmlWWw.msslke.cN/post/21948.htmlWWw.msslke.cN/post/4379.htmlWWw.msslke.cN/post/32032.htmlWWw.msslke.cN/post/43207.htmlWWw.msslke.cN/post/35957.htmlWWw.msslke.cN/post/11274.htmlWWw.msslke.cN/post/30897.htmlWWw.msslke.cN/post/2345.htmlWWw.msslke.cN/post/28788.htmlWWw.msslke.cN/post/11054.htmlWWw.msslke.cN/post/5916.htmlWWw.msslke.cN/post/11093.htmlWWw.msslke.cN/post/12667.htmlWWw.msslke.cN/post/15694.htmlWWw.msslke.cN/post/35301.htmlWWw.msslke.cN/post/17897.htmlWWw.msslke.cN/post/15564.htmlWWw.msslke.cN/post/42603.htmlWWw.msslke.cN/post/31558.htmlWWw.msslke.cN/post/26797.htmlWWw.msslke.cN/post/48508.htmlWWw.msslke.cN/post/17484.htmlWWw.msslke.cN/post/20999.htmlWWw.msslke.cN/post/47047.htmlWWw.msslke.cN/post/42663.htmlWWw.msslke.cN/post/2279.htmlWWw.msslke.cN/post/1343.htmlWWw.msslke.cN/post/39503.htmlWWw.msslke.cN/post/3360.htmlWWw.msslke.cN/post/28426.htmlWWw.msslke.cN/post/34472.htmlWWw.msslke.cN/post/36546.htmlWWw.msslke.cN/post/46224.htmlWWw.msslke.cN/post/2325.htmlWWw.msslke.cN/post/29856.htmlWWw.msslke.cN/post/8839.htmlWWw.msslke.cN/post/11982.htmlWWw.msslke.cN/post/12123.htmlWWw.msslke.cN/post/41852.htmlWWw.msslke.cN/post/9599.htmlWWw.msslke.cN/post/17651.htmlWWw.msslke.cN/post/35456.htmlWWw.msslke.cN/post/24473.htmlWWw.msslke.cN/post/4915.htmlWWw.msslke.cN/post/21207.htmlWWw.msslke.cN/post/7842.htmlWWw.msslke.cN/post/39993.htmlWWw.msslke.cN/post/31447.htmlWWw.msslke.cN/post/439.htmlWWw.msslke.cN/post/7589.htmlWWw.msslke.cN/post/31426.htmlWWw.msslke.cN/post/45698.htmlWWw.msslke.cN/post/36065.htmlWWw.msslke.cN/post/15512.htmlWWw.msslke.cN/post/15927.htmlWWw.msslke.cN/post/11498.htmlWWw.msslke.cN/post/47224.htmlWWw.msslke.cN/post/36394.htmlWWw.msslke.cN/post/4201.htmlWWw.msslke.cN/post/33273.htmlWWw.msslke.cN/post/47717.htmlWWw.msslke.cN/post/6904.htmlWWw.msslke.cN/post/42701.htmlWWw.msslke.cN/post/11559.htmlWWw.msslke.cN/post/19581.htmlWWw.msslke.cN/post/34443.htmlWWw.msslke.cN/post/14989.htmlWWw.msslke.cN/post/21159.htmlWWw.msslke.cN/post/42020.htmlWWw.msslke.cN/post/29760.htmlWWw.msslke.cN/post/46607.htmlWWw.msslke.cN/post/43935.htmlWWw.msslke.cN/post/7023.htmlWWw.msslke.cN/post/14406.htmlWWw.msslke.cN/post/20872.htmlWWw.msslke.cN/post/9270.htmlWWw.msslke.cN/post/14694.htmlWWw.msslke.cN/post/45504.htmlWWw.msslke.cN/post/30427.htmlWWw.msslke.cN/post/5790.htmlWWw.msslke.cN/post/30500.htmlWWw.msslke.cN/post/29420.htmlWWw.msslke.cN/post/44692.htmlWWw.msslke.cN/post/37159.htmlWWw.msslke.cN/post/41140.htmlWWw.msslke.cN/post/29829.htmlWWw.msslke.cN/post/28201.htmlWWw.msslke.cN/post/2271.htmlWWw.msslke.cN/post/21379.htmlWWw.msslke.cN/post/32006.htmlWWw.msslke.cN/post/6766.htmlWWw.msslke.cN/post/21767.htmlWWw.msslke.cN/post/11499.htmlWWw.msslke.cN/post/3911.htmlWWw.msslke.cN/post/29308.htmlWWw.msslke.cN/post/23615.htmlWWw.msslke.cN/post/23007.htmlWWw.msslke.cN/post/28899.htmlWWw.msslke.cN/post/6913.htmlWWw.msslke.cN/post/12318.htmlWWw.msslke.cN/post/12472.htmlWWw.msslke.cN/post/17062.htmlWWw.msslke.cN/post/5322.htmlWWw.msslke.cN/post/235.htmlWWw.msslke.cN/post/15674.htmlWWw.msslke.cN/post/48382.htmlWWw.msslke.cN/post/18996.htmlWWw.msslke.cN/post/28071.htmlWWw.msslke.cN/post/6296.htmlWWw.msslke.cN/post/36209.htmlWWw.msslke.cN/post/40772.htmlWWw.msslke.cN/post/16198.htmlWWw.msslke.cN/post/23776.htmlWWw.msslke.cN/post/14810.htmlWWw.msslke.cN/post/10902.htmlWWw.msslke.cN/post/43415.htmlWWw.msslke.cN/post/39955.htmlWWw.msslke.cN/post/40797.htmlWWw.msslke.cN/post/21496.htmlWWw.msslke.cN/post/1198.htmlWWw.msslke.cN/post/44737.htmlWWw.msslke.cN/post/10512.htmlWWw.msslke.cN/post/41897.htmlWWw.msslke.cN/post/14282.htmlWWw.msslke.cN/post/32493.htmlWWw.msslke.cN/post/1764.htmlWWw.msslke.cN/post/6582.htmlWWw.msslke.cN/post/40178.htmlWWw.msslke.cN/post/10657.htmlWWw.msslke.cN/post/12649.htmlWWw.msslke.cN/post/4554.htmlWWw.msslke.cN/post/34359.htmlWWw.msslke.cN/post/32169.htmlWWw.msslke.cN/post/3085.htmlWWw.msslke.cN/post/30095.htmlWWw.msslke.cN/post/11458.htmlWWw.msslke.cN/post/19436.htmlWWw.msslke.cN/post/3752.htmlWWw.msslke.cN/post/6116.htmlWWw.msslke.cN/post/15977.htmlWWw.msslke.cN/post/35418.htmlWWw.msslke.cN/post/22710.htmlWWw.msslke.cN/post/44524.htmlWWw.msslke.cN/post/1056.htmlWWw.msslke.cN/post/31532.htmlWWw.msslke.cN/post/31869.htmlWWw.msslke.cN/post/1758.htmlWWw.msslke.cN/post/22609.htmlWWw.msslke.cN/post/36311.htmlWWw.msslke.cN/post/24131.htmlWWw.msslke.cN/post/35927.htmlWWw.msslke.cN/post/40318.htmlWWw.msslke.cN/post/31308.htmlWWw.msslke.cN/post/14383.htmlWWw.msslke.cN/post/47911.htmlWWw.msslke.cN/post/39974.htmlWWw.msslke.cN/post/37818.htmlWWw.msslke.cN/post/24173.htmlWWw.msslke.cN/post/47408.htmlWWw.msslke.cN/post/42818.htmlWWw.msslke.cN/post/19406.htmlWWw.msslke.cN/post/25108.htmlWWw.msslke.cN/post/10993.htmlWWw.msslke.cN/post/1848.htmlWWw.msslke.cN/post/23753.htmlWWw.msslke.cN/post/1876.htmlWWw.msslke.cN/post/6637.htmlWWw.msslke.cN/post/8100.htmlWWw.msslke.cN/post/12511.htmlWWw.msslke.cN/post/29580.htmlWWw.msslke.cN/post/33524.htmlWWw.msslke.cN/post/48443.htmlWWw.msslke.cN/post/38289.htmlWWw.msslke.cN/post/20627.htmlWWw.msslke.cN/post/18673.htmlWWw.msslke.cN/post/2317.htmlWWw.msslke.cN/post/14795.htmlWWw.msslke.cN/post/5188.htmlWWw.msslke.cN/post/29531.htmlWWw.msslke.cN/post/7637.htmlWWw.msslke.cN/post/6054.htmlWWw.msslke.cN/post/24726.htmlWWw.msslke.cN/post/37561.htmlWWw.msslke.cN/post/33719.htmlWWw.msslke.cN/post/41470.htmlWWw.msslke.cN/post/28107.htmlWWw.msslke.cN/post/24744.htmlWWw.msslke.cN/post/20568.htmlWWw.msslke.cN/post/11484.htmlWWw.msslke.cN/post/6546.htmlWWw.msslke.cN/post/15077.htmlWWw.msslke.cN/post/2194.htmlWWw.msslke.cN/post/9699.htmlWWw.msslke.cN/post/39853.htmlWWw.msslke.cN/post/10259.htmlWWw.msslke.cN/post/11124.htmlWWw.msslke.cN/post/18133.htmlWWw.msslke.cN/post/48044.htmlWWw.msslke.cN/post/27322.htmlWWw.msslke.cN/post/46678.htmlWWw.msslke.cN/post/17309.htmlWWw.msslke.cN/post/19714.htmlWWw.msslke.cN/post/25977.htmlWWw.msslke.cN/post/3105.htmlWWw.msslke.cN/post/38983.htmlWWw.msslke.cN/post/36980.htmlWWw.msslke.cN/post/35575.htmlWWw.msslke.cN/post/33381.htmlWWw.msslke.cN/post/43096.htmlWWw.msslke.cN/post/40020.htmlWWw.msslke.cN/post/41695.htmlWWw.msslke.cN/post/32976.htmlWWw.msslke.cN/post/6070.htmlWWw.msslke.cN/post/35167.htmlWWw.msslke.cN/post/25348.htmlWWw.msslke.cN/post/8289.htmlWWw.msslke.cN/post/8956.htmlWWw.msslke.cN/post/14935.htmlWWw.msslke.cN/post/39901.htmlWWw.msslke.cN/post/44116.htmlWWw.msslke.cN/post/29459.htmlWWw.msslke.cN/post/2956.htmlWWw.msslke.cN/post/46243.htmlWWw.msslke.cN/post/30340.htmlWWw.msslke.cN/post/5341.htmlWWw.msslke.cN/post/32933.htmlWWw.msslke.cN/post/10555.htmlWWw.msslke.cN/post/5013.htmlWWw.msslke.cN/post/12659.htmlWWw.msslke.cN/post/20905.htmlWWw.msslke.cN/post/39502.htmlWWw.msslke.cN/post/9815.htmlWWw.msslke.cN/post/46365.htmlWWw.msslke.cN/post/8595.htmlWWw.msslke.cN/post/44557.htmlWWw.msslke.cN/post/26459.htmlWWw.msslke.cN/post/48088.htmlWWw.msslke.cN/post/19786.htmlWWw.msslke.cN/post/18601.htmlWWw.msslke.cN/post/1286.htmlWWw.msslke.cN/post/23749.htmlWWw.msslke.cN/post/6351.htmlWWw.msslke.cN/post/5267.htmlWWw.msslke.cN/post/5409.htmlWWw.msslke.cN/post/12102.htmlWWw.msslke.cN/post/30677.htmlWWw.msslke.cN/post/35735.htmlWWw.msslke.cN/post/16730.htmlWWw.msslke.cN/post/27556.htmlWWw.msslke.cN/post/25079.htmlWWw.msslke.cN/post/18835.htmlWWw.msslke.cN/post/37208.htmlWWw.msslke.cN/post/12227.htmlWWw.msslke.cN/post/17444.htmlWWw.msslke.cN/post/21220.htmlWWw.msslke.cN/post/27390.htmlWWw.msslke.cN/post/2222.htmlWWw.msslke.cN/post/27611.htmlWWw.msslke.cN/post/4061.htmlWWw.msslke.cN/post/29416.htmlWWw.msslke.cN/post/16945.htmlWWw.msslke.cN/post/206.htmlWWw.msslke.cN/post/20655.htmlWWw.msslke.cN/post/36273.htmlWWw.msslke.cN/post/30422.htmlWWw.msslke.cN/post/16530.htmlWWw.msslke.cN/post/29742.htmlWWw.msslke.cN/post/7462.htmlWWw.msslke.cN/post/45643.htmlWWw.msslke.cN/post/12766.htmlWWw.msslke.cN/post/7388.htmlWWw.msslke.cN/post/38449.htmlWWw.msslke.cN/post/43867.htmlWWw.msslke.cN/post/32140.htmlWWw.msslke.cN/post/15419.htmlWWw.msslke.cN/post/27885.htmlWWw.msslke.cN/post/14779.htmlWWw.msslke.cN/post/44872.htmlWWw.msslke.cN/post/2414.htmlWWw.msslke.cN/post/10647.htmlWWw.msslke.cN/post/25457.html