diff --git a/analysis/mb5_pd_ablation/fig1_reuse_d1024_o128.json b/analysis/mb5_pd_ablation/fig1_reuse_d1024_o128.json new file mode 100644 index 0000000..9c21d4e --- /dev/null +++ b/analysis/mb5_pd_ablation/fig1_reuse_d1024_o128.json @@ -0,0 +1 @@ +[{"name": "reuse_p18432_d1024_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 2.011140084010549, "e2e_p90": 6.595956567587561, "e2e_p99": 13.843295609399851, "e2e_mean": 3.1182714335319965, "ttft_p90": 5.735121128271566, "tpot_p99": 0.007805189969399431, "tps": 274.4217808266656, "wall": 179.11114727094537, "pu": 41.73809523809524, "du": 24.771825396825395, "apc": 0.8289473684210527}, {"name": "reuse_p18432_d1024_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 1.2469783920387272, "e2e_p90": 3.5110186243895436, "e2e_p99": 5.371424139904558, "e2e_mean": 1.8077833487527641, "ttft_p90": 2.6449656961078287, "tpot_p99": 0.008740999029887894, "tps": 427.0965500477582, "wall": 115.0840483129723, "pu": 31.495454545454546, "du": 58.32272727272727, "apc": 0.8289473684210527}, {"name": "reuse_p18432_d1024_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.5855289729661308, "e2e_p90": 3.5929854729911312, "e2e_p99": 5.639228541038465, "e2e_mean": 1.9572647203356912, "ttft_p90": 2.3784743072232226, "tpot_p99": 0.014603613033605647, "tps": 396.0826187284008, "wall": 124.09532172302715, "pu": 21.093220338983052, "du": 82.70338983050847, "apc": 0.8289473684210527}, {"name": "reuse_p18432_d1024_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.3775086904934142, "e2e_p90": 3.1152419353893483, "e2e_p99": 7.911835642378456, "e2e_mean": 1.8861664114436583, "ttft_p90": 1.989750977011863, "tpot_p99": 0.04218796803300668, "tps": 419.48032182196613, "wall": 117.17355366400443, "pu": 41.058035714285715, "du": null, "apc": 0.8289473684210527}, {"name": "reuse_p2048_d1024_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.792972255992936, "e2e_p90": 0.9489053479628637, "e2e_p99": 1.637123176814641, "e2e_mean": 0.8399674154458504, "ttft_p90": 0.25993717868113886, "tpot_p99": 0.005669725780525634, "tps": 791.8028909214946, "wall": 62.07605524500832, "pu": 31.716666666666665, "du": 66.96666666666667, "apc": 0.5833333333333334}, {"name": "reuse_p2048_d1024_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.8240640689909924, "e2e_p90": 0.9465674142818898, "e2e_p99": 1.4786975827836435, "e2e_mean": 0.8572143532189026, "ttft_p90": 0.23996333410032095, "tpot_p99": 0.006090612034991707, "tps": 783.216723293919, "wall": 62.75657622999279, "pu": 15.566666666666666, "du": 82.11666666666666, "apc": 0.5833333333333334}, {"name": "reuse_p2048_d1024_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 0.9896964269864839, "e2e_p90": 1.1497688122093677, "e2e_p99": 1.787693639339414, "e2e_mean": 1.0255024050854142, "ttft_p90": 0.2459226590231992, "tpot_p99": 0.008264087546006299, "tps": 691.4021770340051, "wall": 71.09031708701514, "pu": 8.740196078431373, "du": 95.52941176470588, "apc": 0.5833333333333334}, {"name": "reuse_p2048_d1024_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 0.9049637360149063, "e2e_p90": 1.2046391166280954, "e2e_p99": 1.5656454849703014, "e2e_mean": 0.9364410856549815, "ttft_p90": 0.2209109389339573, "tpot_p99": 0.010840669604821322, "tps": 697.8220171948692, "wall": 70.43629863898968, "pu": 39.75735294117647, "du": null, "apc": 0.5833333333333334}, {"name": "reuse_p38912_d1024_o128_2P+6D_rep1", "arm": "2P+6D", "n": 348, "req": 384, "e2e_p50": 5.966376932017738, "e2e_p90": 41.55034995879979, "e2e_p99": 67.95094630374655, "e2e_mean": 17.63732494259318, "ttft_p90": 40.65220642983333, "tpot_p99": 0.00965455187338873, "tps": 31.074994331197068, "wall": 1433.4354988210252, "pu": 29.08110119047619, "du": 3.8563988095238093, "apc": 0.003541386023109088}, {"name": "reuse_p38912_d1024_o128_4P+4D_rep1", "arm": "4P+4D", "n": 331, "req": 384, "e2e_p50": 1.8283151049981825, "e2e_p90": 21.967222570965532, "e2e_p99": 463.6285565488564, "e2e_mean": 32.049094769653685, "ttft_p90": 20.93402343802154, "tpot_p99": 0.010148854255877936, "tps": 22.304023016957444, "wall": 1899.5676236429717, "pu": 6.330527497194164, "du": 4.0412457912457915, "apc": 0.3941685392519007}, {"name": "reuse_p38912_d1024_o128_6P+2D_rep1", "arm": "6P+2D", "n": 331, "req": 384, "e2e_p50": 1.5403626519837417, "e2e_p90": 8.17470415995922, "e2e_p99": 15.978965973359298, "e2e_mean": 3.262189171190994, "ttft_p90": 7.065585554984864, "tpot_p99": 0.018555945050481002, "tps": 46.7175532998922, "wall": 906.8968087440007, "pu": 7.588627450980392, "du": 14.944705882352942, "apc": 0.8538197197991012}, {"name": "reuse_p38912_d1024_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 2.0001139829983003, "e2e_p90": 7.92033636061824, "e2e_p99": 17.198196112165586, "e2e_mean": 3.6551371743582117, "ttft_p90": 6.314943998103264, "tpot_p99": 0.11950804649024022, "tps": 240.1072077908529, "wall": 204.70855686604045, "pu": 41.98711340206186, "du": null, "apc": 0.8525641025641025}, {"name": "reuse_p4096_d1024_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.8382689229911193, "e2e_p90": 1.1122795563715044, "e2e_p99": 2.1025787757901724, "e2e_mean": 0.9100473551948198, "ttft_p90": 0.44005942158401007, "tpot_p99": 0.005548434369893942, "tps": 741.2065308688034, "wall": 66.31350096495589, "pu": 29.515625, "du": 64.26041666666667, "apc": 0.7}, {"name": "reuse_p4096_d1024_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.845705887011718, "e2e_p90": 1.0994400390714874, "e2e_p99": 1.7404719427420072, "e2e_mean": 0.9025246042629078, "ttft_p90": 0.3965871149906888, "tpot_p99": 0.00621245443521207, "tps": 753.8055854507271, "wall": 65.20514168200316, "pu": 17.241935483870968, "du": 89.73387096774194, "apc": 0.7}, {"name": "reuse_p4096_d1024_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.041008985514054, "e2e_p90": 1.2969930486229715, "e2e_p99": 2.009561244166107, "e2e_mean": 1.0891431775930869, "ttft_p90": 0.4054622187104541, "tpot_p99": 0.007866649039696508, "tps": 662.7457211326365, "wall": 74.16419062804198, "pu": 10.566666666666666, "du": 97.14285714285714, "apc": 0.7}, {"name": "reuse_p4096_d1024_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 0.9978507100022398, "e2e_p90": 1.376642303710105, "e2e_p99": 1.8764825401920837, "e2e_mean": 1.0177971177561933, "ttft_p90": 0.3318765960051678, "tpot_p99": 0.012630984430049199, "tps": 663.862182067196, "wall": 74.03946380398702, "pu": 38.21071428571429, "du": null, "apc": 0.7}, {"name": "reuse_p512_d1024_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.7468664619955234, "e2e_p90": 0.8154127431334928, "e2e_p99": 1.4249815517506803, "e2e_mean": 0.7755074385066413, "ttft_p90": 0.15653720167465504, "tpot_p99": 0.005882820960814427, "tps": 836.3744558932802, "wall": 58.76793540699873, "pu": 22.75, "du": 68.125, "apc": 0.2916666666666667}, {"name": "reuse_p512_d1024_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.8027036284911446, "e2e_p90": 0.8790760690986644, "e2e_p99": 1.2941429702786267, "e2e_mean": 0.8199292982858424, "ttft_p90": 0.14772663660696708, "tpot_p99": 0.006057956323456606, "tps": 805.372620261493, "wall": 61.03013532300247, "pu": 13.181034482758621, "du": 76.17241379310344, "apc": 0.2916666666666667}, {"name": "reuse_p512_d1024_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 0.9647596840222832, "e2e_p90": 1.053520446305629, "e2e_p99": 1.528927146314527, "e2e_mean": 0.9760259314924346, "ttft_p90": 0.15018326903227716, "tpot_p99": 0.007652870517977565, "tps": 717.9133965889113, "wall": 68.46508260403061, "pu": 6.55050505050505, "du": 94.60606060606061, "apc": 0.2916666666666667}, {"name": "reuse_p512_d1024_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 0.8443412214983255, "e2e_p90": 1.1002090520923957, "e2e_p99": 1.4714346799789941, "e2e_mean": 0.8751813448542028, "ttft_p90": 0.18448241882724686, "tpot_p99": 0.009217632268207137, "tps": 737.9202829911662, "wall": 66.60882094304543, "pu": 39.22265625, "du": null, "apc": 0.2916666666666667}, {"name": "reuse_p8192_d1024_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.9952880369964987, "e2e_p90": 1.638875626219669, "e2e_p99": 3.3932996814849328, "e2e_mean": 1.182382257353917, "ttft_p90": 0.9387523760029581, "tpot_p99": 0.00642865186423342, "tps": 614.0489008999317, "wall": 80.04574216803303, "pu": 48.36842105263158, "du": 49.6578947368421, "apc": 0.7777777777777778}, {"name": "reuse_p8192_d1024_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.9673103050154168, "e2e_p90": 1.6615959092101547, "e2e_p99": 2.7100385388941506, "e2e_mean": 1.122088482831714, "ttft_p90": 0.8661944593768566, "tpot_p99": 0.007023902694157537, "tps": 636.3849652635973, "wall": 77.23626842699014, "pu": 26.216216216216218, "du": 73.3108108108108, "apc": 0.7777777777777778}, {"name": "reuse_p8192_d1024_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.1928778715082444, "e2e_p90": 1.806718060915591, "e2e_p99": 2.9189987593132543, "e2e_mean": 1.307137680928766, "ttft_p90": 0.8438458036922384, "tpot_p99": 0.009671045643947548, "tps": 571.1298010568557, "wall": 86.06099683302455, "pu": 13.861788617886178, "du": 94.15853658536585, "apc": 0.7777777777777778}, {"name": "reuse_p8192_d1024_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.1058233095391188, "e2e_p90": 2.0377895820070986, "e2e_p99": 2.6251585837343008, "e2e_mean": 1.2416493104550075, "ttft_p90": 0.7047733141400385, "tpot_p99": 0.018370147039870898, "tps": 565.7217537746836, "wall": 86.88370152295101, "pu": 41.207317073170735, "du": null, "apc": 0.7777777777777778}] diff --git a/analysis/mb5_pd_ablation/fig1_reuse_d2048_o128.json b/analysis/mb5_pd_ablation/fig1_reuse_d2048_o128.json new file mode 100644 index 0000000..032b5ce --- /dev/null +++ b/analysis/mb5_pd_ablation/fig1_reuse_d2048_o128.json @@ -0,0 +1 @@ +[{"name": "reuse_p18432_d2048_o128_2P+6D_rep1", "arm": "2P+6D", "n": 0, "req": 384, "e2e_p50": null, "e2e_p90": null, "e2e_p99": null, "e2e_mean": null, "ttft_p90": null, "tpot_p99": null, "tps": 0.0, "wall": 500.0238099139533, "pu": 7.442796610169491, "du": 0.0, "apc": 0.5504807692307693}, {"name": "reuse_p18432_d2048_o128_4P+4D_rep1", "arm": "4P+4D", "n": 0, "req": 384, "e2e_p50": null, "e2e_p90": null, "e2e_p99": null, "e2e_mean": null, "ttft_p90": null, "tpot_p99": null, "tps": 0.0, "wall": 500.0241022160044, "pu": 7.969279661016949, "du": 0.0, "apc": 0.4124119304837952}, {"name": "reuse_p18432_d2048_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.597727442975156, "e2e_p90": 3.8423233716050165, "e2e_p99": 5.946185397276423, "e2e_mean": 2.1024188470485874, "ttft_p90": 2.594332438148558, "tpot_p99": 0.014465094759590983, "tps": 378.11492013389045, "wall": 129.9922255979618, "pu": 26.701612903225808, "du": 81.08064516129032, "apc": 0.7875}, {"name": "reuse_p18432_d2048_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.7018155964906327, "e2e_p90": 3.876369076193077, "e2e_p99": 7.142674320546252, "e2e_mean": 2.1840314005736823, "ttft_p90": 2.1786344624473712, "tpot_p99": 0.03983575570474082, "tps": 369.2181586612368, "wall": 133.12454668595456, "pu": 42.442460317460316, "du": null, "apc": 0.7875}, {"name": "reuse_p2048_d2048_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.8702527615241706, "e2e_p90": 1.0261618579854257, "e2e_p99": 1.7815040894789855, "e2e_mean": 0.9216887839597803, "ttft_p90": 0.37184600940672674, "tpot_p99": 0.00531729997127449, "tps": 739.561895750781, "wall": 66.46096869296161, "pu": 42.046875, "du": 64.90104166666667, "apc": 0.4375}, {"name": "reuse_p2048_d2048_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.9034653444832657, "e2e_p90": 1.0732842879777307, "e2e_p99": 1.7153989363042639, "e2e_mean": 0.9481709641428703, "ttft_p90": 0.3279811007028911, "tpot_p99": 0.006350442920380646, "tps": 727.0453582087905, "wall": 67.6051355600357, "pu": 24.71875, "du": 78.4140625, "apc": 0.4375}, {"name": "reuse_p2048_d2048_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.0671798489929643, "e2e_p90": 1.2583458551147486, "e2e_p99": 1.8928272985597145, "e2e_mean": 1.1038180056437643, "ttft_p90": 0.3353222259087488, "tpot_p99": 0.008093095353775196, "tps": 658.7111050415339, "wall": 74.61844748602016, "pu": 15.444444444444445, "du": 96.48611111111111, "apc": 0.4375}, {"name": "reuse_p2048_d2048_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.0099046650284436, "e2e_p90": 1.403463970933808, "e2e_p99": 1.9772926643601396, "e2e_mean": 1.0592681981953926, "ttft_p90": 0.3512645903218072, "tpot_p99": 0.011878674168755692, "tps": 637.5511369696022, "wall": 77.09499230701476, "pu": 38.972972972972975, "du": null, "apc": 0.4375}, {"name": "reuse_p38912_d2048_o128_2P+6D_rep1", "arm": "2P+6D", "n": 0, "req": 384, "e2e_p50": null, "e2e_p90": null, "e2e_p99": null, "e2e_mean": null, "ttft_p90": null, "tpot_p99": null, "tps": 0.0, "wall": 500.109733818972, "pu": 8.895744680851063, "du": 0.0, "apc": 0.7069767441860465}, {"name": "reuse_p38912_d2048_o128_4P+4D_rep1", "arm": "4P+4D", "n": 19, "req": 384, "e2e_p50": 8.589444032986648, "e2e_p90": 27.915465352416504, "e2e_p99": 28.366348578078906, "e2e_mean": 13.736264503263795, "ttft_p90": 26.597048029780854, "tpot_p99": 0.012102746355822164, "tps": 4.86343652912101, "wall": 500.0579292929615, "pu": 4.287234042553192, "du": 1.3297872340425532, "apc": 0.76}, {"name": "reuse_p38912_d2048_o128_6P+2D_rep1", "arm": "6P+2D", "n": 367, "req": 384, "e2e_p50": 2.2283155800541863, "e2e_p90": 9.522073879209366, "e2e_p99": 21.179028030608304, "e2e_mean": 4.37911018002772, "ttft_p90": 8.025956917623997, "tpot_p99": 0.018388294600606633, "tps": 97.75392348851425, "wall": 480.55360156996176, "pu": 18.72197640117994, "du": 31.74778761061947, "apc": 0.83125}, {"name": "reuse_p38912_d2048_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 2.5377507034572773, "e2e_p90": 8.48644620324485, "e2e_p99": 23.11029849225888, "e2e_mean": 4.287540712224351, "ttft_p90": 6.662501206889283, "tpot_p99": 0.12405163028898951, "tps": 202.86541371579986, "wall": 242.28871299303137, "pu": 37.78399122807018, "du": null, "apc": 0.83125}, {"name": "reuse_p4096_d2048_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.9403678920061793, "e2e_p90": 1.3765556774975263, "e2e_p99": 2.223834651577637, "e2e_mean": 1.0481886899786634, "ttft_p90": 0.6951776356203481, "tpot_p99": 0.005652166551770092, "tps": 676.2238276411496, "wall": 72.68599240499316, "pu": 44.628571428571426, "du": 56.67619047619048, "apc": 0.5833333333333334}, {"name": "reuse_p4096_d2048_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.933273567003198, "e2e_p90": 1.19254511789768, "e2e_p99": 1.9197397668258063, "e2e_mean": 0.9934309769355423, "ttft_p90": 0.48482207448687403, "tpot_p99": 0.006479399048977194, "tps": 704.4073580750398, "wall": 69.77780603303108, "pu": 28.62878787878788, "du": 86.50757575757575, "apc": 0.5833333333333334}, {"name": "reuse_p4096_d2048_o128_6P+2D_rep1", "arm": "6P+2D", "n": 82, "req": 384, "e2e_p50": 1.9051678330288269, "e2e_p90": 5.428465517004953, "e2e_p99": 6.899000353141454, "e2e_mean": 2.8002093829528327, "ttft_p90": 4.15596770622069, "tpot_p99": 0.013283818648503837, "tps": 20.99105592369273, "wall": 500.02248758496717, "pu": 1.8764124293785311, "du": 3.419491525423729, "apc": 0.5788113695090439}, {"name": "reuse_p4096_d2048_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.145786852488527, "e2e_p90": 1.7778903291677124, "e2e_p99": 2.219522972920677, "e2e_mean": 1.1847675088301912, "ttft_p90": 0.5011492442048621, "tpot_p99": 0.014808055440112447, "tps": 584.2097378547378, "wall": 84.13416760304244, "pu": 36.628125, "du": null, "apc": 0.5833333333333334}, {"name": "reuse_p512_d2048_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 0.8357307700207457, "e2e_p90": 0.9345466257887891, "e2e_p99": 1.6236903413617998, "e2e_mean": 0.867049211952235, "ttft_p90": 0.28156024306081234, "tpot_p99": 0.005549601508573975, "tps": 772.9495392094975, "wall": 63.590179574035574, "pu": 34.4, "du": 64.77777777777777, "apc": 0.175}, {"name": "reuse_p512_d2048_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 0.8685456210223492, "e2e_p90": 0.9515164563606959, "e2e_p99": 1.4229793156281814, "e2e_mean": 0.8936527385265739, "ttft_p90": 0.21474569473066368, "tpot_p99": 0.006214100767071836, "tps": 761.8182639550365, "wall": 64.51932478597155, "pu": 18.016129032258064, "du": 81.63709677419355, "apc": 0.175}, {"name": "reuse_p512_d2048_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.064892176509602, "e2e_p90": 1.153052446676884, "e2e_p99": 1.531589741804638, "e2e_mean": 1.070551099629938, "ttft_p90": 0.23582011537509967, "tpot_p99": 0.007750524568135896, "tps": 667.8236536468205, "wall": 73.60026817198377, "pu": 8.876190476190477, "du": 92.81428571428572, "apc": 0.175}, {"name": "reuse_p512_d2048_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 0.98292404046515, "e2e_p90": 1.314295787154697, "e2e_p99": 1.7231975731498097, "e2e_mean": 0.9991093327666931, "ttft_p90": 0.34203003942966437, "tpot_p99": 0.010019689613378492, "tps": 664.7666224795696, "wall": 73.93873028201051, "pu": 40.739285714285714, "du": null, "apc": 0.175}, {"name": "reuse_p8192_d2048_o128_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 1.227345287508797, "e2e_p90": 2.1255404052266385, "e2e_p99": 3.508073750929325, "e2e_mean": 1.4636097900368743, "ttft_p90": 1.4201186655962372, "tpot_p99": 0.006487326852717862, "tps": 513.1391061059077, "wall": 95.78689173195744, "pu": 54.34782608695652, "du": 41.78260869565217, "apc": 0.7}, {"name": "reuse_p8192_d2048_o128_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 1.0309503950120416, "e2e_p90": 1.806706921494333, "e2e_p99": 2.7563181719661243, "e2e_mean": 1.2135527645268667, "ttft_p90": 1.0876598956412638, "tpot_p99": 0.006993451918086668, "tps": 600.3784995590349, "wall": 81.86835477303248, "pu": 26.28846153846154, "du": 78.27564102564102, "apc": 0.7}, {"name": "reuse_p8192_d2048_o128_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 1.2513171324972063, "e2e_p90": 1.9010370597010477, "e2e_p99": 2.9169839132187194, "e2e_mean": 1.3710599802317727, "ttft_p90": 0.9651577884971629, "tpot_p99": 0.009227863290451657, "tps": 547.5620167304908, "wall": 89.7651745339972, "pu": 19.189922480620154, "du": 92.96511627906976, "apc": 0.7}, {"name": "reuse_p8192_d2048_o128_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.3169660340063274, "e2e_p90": 2.2136766588897445, "e2e_p99": 3.0296990163286686, "e2e_mean": 1.4168819271167195, "ttft_p90": 0.8181633891130331, "tpot_p99": 0.019182177199455072, "tps": 509.5195788549742, "wall": 96.46734304196434, "pu": 39.01358695652174, "du": null, "apc": 0.7}] diff --git a/analysis/mb5_pd_ablation/fig1_reuse_fixed.json b/analysis/mb5_pd_ablation/fig1_reuse_fixed.json new file mode 100644 index 0000000..e03db98 --- /dev/null +++ b/analysis/mb5_pd_ablation/fig1_reuse_fixed.json @@ -0,0 +1 @@ +[{"name": "reuse_p18432_d2048_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 2.533020637521986, "e2e_p90": 5.85391353177838, "e2e_p99": 13.18415429443412, "e2e_mean": 3.502040037624132, "ttft_p90": 4.246971374610439, "tpot_p99": 0.007761271612152603, "tps": 490.8994507324649, "wall": 200.2528213330079, "pu": 51.829787234042556, "du": 48.47872340425532, "apc": 0.7875}, {"name": "reuse_p18432_d2048_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 2.327055490517523, "e2e_p90": 4.852692579611903, "e2e_p99": 12.918203760247179, "e2e_mean": 3.1448965869362837, "ttft_p90": 3.0742682195210365, "tpot_p99": 0.00903629884385851, "tps": 526.2705626745112, "wall": 186.79365135001717, "pu": 26.928977272727273, "du": 70.5028409090909, "apc": 0.7875}, {"name": "reuse_p18432_d2048_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 3.1278362965094857, "e2e_p90": 4.839138368546264, "e2e_p99": 7.14371296691534, "e2e_mean": 3.424949068415723, "ttft_p90": 2.517161613609642, "tpot_p99": 0.012816217731421942, "tps": 514.6500556526703, "wall": 191.01134629303124, "pu": 18.974074074074075, "du": 95.7611111111111, "apc": 0.7875}, {"name": "reuse_p18432_d2048_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 2.692243392491946, "e2e_p90": 5.5457493721274655, "e2e_p99": 8.494194235785404, "e2e_mean": 3.2005772834381787, "ttft_p90": 2.1673677822982427, "tpot_p99": 0.030382820091552715, "tps": 528.3289416764078, "wall": 186.06589994498063, "pu": 45.94602272727273, "du": null, "apc": 0.7875}, {"name": "reuse_p2048_d2048_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 1.5452155300008599, "e2e_p90": 1.7081896169576791, "e2e_p99": 2.45207904072362, "e2e_mean": 1.6013075451828627, "ttft_p90": 0.34778050871100274, "tpot_p99": 0.005669485672979671, "tps": 996.0242196356846, "wall": 98.69639519002521, "pu": 23.893617021276597, "du": 88.177304964539, "apc": 0.4375}, {"name": "reuse_p2048_d2048_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 1.6793917149771005, "e2e_p90": 1.818927331600571, "e2e_p99": 2.323814849504852, "e2e_mean": 1.7090580133658477, "ttft_p90": 0.31593548320815895, "tpot_p99": 0.006266038190100945, "tps": 946.6728525267378, "wall": 103.84157498297282, "pu": 22.26530612244898, "du": 97.3265306122449, "apc": 0.4375}, {"name": "reuse_p2048_d2048_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 2.156280273484299, "e2e_p90": 2.297612584318267, "e2e_p99": 2.835462462223368, "e2e_mean": 2.157636388411902, "ttft_p90": 0.33686318337568083, "tpot_p99": 0.008273487242621223, "tps": 783.5302862115615, "wall": 125.46292304195231, "pu": 8.175, "du": 96.54166666666667, "apc": 0.4375}, {"name": "reuse_p2048_d2048_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.8087456520006526, "e2e_p90": 2.3159401921962854, "e2e_p99": 3.069265903531341, "e2e_mean": 1.8344004751229477, "ttft_p90": 0.30347971800365486, "tpot_p99": 0.010619336528881619, "tps": 837.246318714222, "wall": 117.41347534494707, "pu": 44.792410714285715, "du": null, "apc": 0.4375}, {"name": "reuse_p38912_d2048_2P+6D_rep1", "arm": "2P+6D", "n": 361, "req": 384, "e2e_p50": 6.57530459103873, "e2e_p90": 47.03490046202205, "e2e_p99": 448.50315178359153, "e2e_mean": 29.01171956352752, "ttft_p90": 45.17827109998325, "tpot_p99": 0.009629647705758752, "tps": 51.92238624874325, "wall": 1779.88737954502, "pu": 27.959832134292565, "du": 6.306754596322942, "apc": 0.8698754011405736}, {"name": "reuse_p38912_d2048_4P+4D_rep1", "arm": "4P+4D", "n": 327, "req": 384, "e2e_p50": 3.1876551050227135, "e2e_p90": 11.449897833599248, "e2e_p99": 29.874143838356257, "e2e_mean": 5.742165601527495, "ttft_p90": 9.523732434178246, "tpot_p99": 0.0121669072732512, "tps": 61.0543739943618, "wall": 1371.1056968290359, "pu": 9.472395023328149, "du": 10.68040435458787, "apc": 0.3990417067856459}, {"name": "reuse_p38912_d2048_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 4.693941325997002, "e2e_p90": 11.446271817904197, "e2e_p99": 25.98846597966217, "e2e_mean": 6.425895827477082, "ttft_p90": 7.717594898125389, "tpot_p99": 0.024569422919093177, "tps": 291.58829267237684, "wall": 337.1328769720276, "pu": 26.540880503144653, "du": 79.52830188679245, "apc": 0.83125}, {"name": "reuse_p38912_d2048_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 3.804246386018349, "e2e_p90": 9.94819127159426, "e2e_p99": 20.41812537532541, "e2e_mean": 5.546197232348732, "ttft_p90": 6.640114219562383, "tpot_p99": 0.06730832396853975, "tps": 322.8433493800264, "wall": 304.4944248929969, "pu": 45.20192307692308, "du": null, "apc": 0.83125}, {"name": "reuse_p4096_d2048_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 1.6006885370006785, "e2e_p90": 1.8821295853122137, "e2e_p99": 3.0432000186893857, "e2e_mean": 1.6879496743948341, "ttft_p90": 0.5026261055085341, "tpot_p99": 0.005706233633389954, "tps": 950.5167565946713, "wall": 103.42163809103658, "pu": 48.04081632653061, "du": 80.17006802721089, "apc": 0.5833333333333334}, {"name": "reuse_p4096_d2048_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 1.7440840654890053, "e2e_p90": 1.985663170699263, "e2e_p99": 2.674550873187256, "e2e_mean": 1.7983998170934683, "ttft_p90": 0.4889643796952441, "tpot_p99": 0.00646362871355286, "tps": 906.9274927042811, "wall": 108.3923475589836, "pu": 15.769607843137255, "du": 93.76470588235294, "apc": 0.5833333333333334}, {"name": "reuse_p4096_d2048_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 2.2896783250034787, "e2e_p90": 2.580035507993307, "e2e_p99": 3.2560947993275495, "e2e_mean": 2.329391661541498, "ttft_p90": 0.5062051271961536, "tpot_p99": 0.009080472360109436, "tps": 731.5427124539008, "wall": 134.37902985903202, "pu": 9.973958333333334, "du": 97.59375, "apc": 0.5833333333333334}, {"name": "reuse_p4096_d2048_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.904530945525039, "e2e_p90": 2.7650697994977236, "e2e_p99": 3.504905357128009, "e2e_mean": 1.9890683890278826, "ttft_p90": 0.41231827571755275, "tpot_p99": 0.012474335152598777, "tps": 782.9542862351619, "wall": 125.55522299098084, "pu": 46.62076271186441, "du": null, "apc": 0.5833333333333334}, {"name": "reuse_p512_d2048_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 1.5259871140005998, "e2e_p90": 1.6426021346589548, "e2e_p99": 2.4021258947759634, "e2e_mean": 1.565941817816262, "ttft_p90": 0.2866207461862359, "tpot_p99": 0.005887627696034079, "tps": 1007.858853784255, "wall": 97.53746730595594, "pu": 19.58695652173913, "du": 83.34057971014492, "apc": 0.175}, {"name": "reuse_p512_d2048_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 1.6439885564905126, "e2e_p90": 1.7445397889125163, "e2e_p99": 2.1885562700900483, "e2e_mean": 1.665460689239353, "ttft_p90": 0.21324421370518393, "tpot_p99": 0.006212426621711119, "tps": 966.5616230201254, "wall": 101.7048449459835, "pu": 8.515625, "du": 97.02083333333333, "apc": 0.175}, {"name": "reuse_p512_d2048_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 2.059083105996251, "e2e_p90": 2.20597213053843, "e2e_p99": 2.5390614521381236, "e2e_mean": 2.0654355626335623, "ttft_p90": 0.23428239471977577, "tpot_p99": 0.008075011566733285, "tps": 810.9640468666952, "wall": 121.21869074198185, "pu": 6.916666666666667, "du": 96.86206896551724, "apc": 0.175}, {"name": "reuse_p512_d2048_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 1.7308740815205965, "e2e_p90": 2.19734079890186, "e2e_p99": 2.574364611047204, "e2e_mean": 1.753096249226625, "ttft_p90": 0.2771356365934479, "tpot_p99": 0.009422459370876646, "tps": 875.0118823136878, "wall": 112.34590293798828, "pu": 46.7122641509434, "du": null, "apc": 0.175}, {"name": "reuse_p8192_d2048_2P+6D_rep1", "arm": "2P+6D", "n": 384, "req": 384, "e2e_p50": 1.7981248289870564, "e2e_p90": 2.62749446813832, "e2e_p99": 4.4945996468386165, "e2e_mean": 2.0330339767545715, "ttft_p90": 1.1596759190259036, "tpot_p99": 0.00635605895942004, "tps": 807.5382123177835, "wall": 121.73293907399056, "pu": 39.69298245614035, "du": 75.94152046783626, "apc": 0.7}, {"name": "reuse_p8192_d2048_4P+4D_rep1", "arm": "4P+4D", "n": 384, "req": 384, "e2e_p50": 1.8958783995185513, "e2e_p90": 2.529831808601739, "e2e_p99": 3.6714393736550135, "e2e_mean": 2.0412568975771137, "ttft_p90": 0.941303398378659, "tpot_p99": 0.0067997743117020415, "tps": 812.6337799219408, "wall": 120.9696205459768, "pu": 23.42543859649123, "du": 91.20614035087719, "apc": 0.7}, {"name": "reuse_p8192_d2048_6P+2D_rep1", "arm": "6P+2D", "n": 384, "req": 384, "e2e_p50": 2.4744975224894006, "e2e_p90": 3.0726254384964706, "e2e_p99": 4.066428293744687, "e2e_mean": 2.5728964008159587, "ttft_p90": 0.9646674327901564, "tpot_p99": 0.009585995291005914, "tps": 667.4391764241245, "wall": 147.28533096704632, "pu": 10.345238095238095, "du": 95.71428571428571, "apc": 0.7}, {"name": "reuse_p8192_d2048_8C-proxy_rep1", "arm": "colo", "n": 384, "req": 384, "e2e_p50": 2.1906960625201464, "e2e_p90": 3.31940173432813, "e2e_p99": 4.419624262939906, "e2e_mean": 2.272983053012316, "ttft_p90": 0.798827746004099, "tpot_p99": 0.014866376486218845, "tps": 697.1272118347367, "wall": 141.01300068502314, "pu": 48.098880597014926, "du": null, "apc": 0.7}] diff --git a/figs/mb5_pd_ablation/reuse_compare_AB.png b/figs/mb5_pd_ablation/reuse_compare_AB.png new file mode 100644 index 0000000..d0ab7f2 Binary files /dev/null and b/figs/mb5_pd_ablation/reuse_compare_AB.png differ diff --git a/figs/mb5_pd_ablation/reuse_compare_ABC.png b/figs/mb5_pd_ablation/reuse_compare_ABC.png new file mode 100644 index 0000000..533e01f Binary files /dev/null and b/figs/mb5_pd_ablation/reuse_compare_ABC.png differ diff --git a/microbench/fresh_setup/backfill_d2048o128.sh b/microbench/fresh_setup/backfill_d2048o128.sh new file mode 100644 index 0000000..086729b --- /dev/null +++ b/microbench/fresh_setup/backfill_d2048o128.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Backfill the d2048/o128 reuse arms that vLLM startup-flaked out (transient +# "Engine core initialization failed", intermittent). Retry up to 4x each with a +# clean teardown between attempts; HEALTH_MAX_TRIES=180 so a crashed launch fails +# in ~6min (not 10) before retrying. Then re-aggregate the figure JSON. +cd /home/admin/cpfs/wjh/agentic-kv-fresh +export MB5_VENV=$PWD/.venv_dash0 +export HEALTH_MAX_TRIES=180 +VPY=$MB5_VENV/bin/python +DELTA=2048; OL=128; N=8; THINK=0.5; TURNS=8; NSESS=48 +MISS="${MISS:-4096:6P+2D 18432:6P+2D 38912:8C-proxy 38912:6P+2D}" +echo "=== BACKFILL START $(date) miss='$MISS' ===" +for pc in $MISS; do + pfx=${pc%%:*}; cfg=${pc##*:} + tag="reuse_p${pfx}_d${DELTA}_o${OL}"; trace="traces_synth/${tag}.jsonl" + $VPY scripts/gen_synthetic_trace.py --out "$trace" --mode regular --qps "$NSESS" --duration-s 1 \ + --turns "$TURNS" --prefix-len "$pfx" --delta-len "$DELTA" --output-len "$OL" --seed 42 >/dev/null 2>&1 + dur=""; [ "$cfg" != "8C-proxy" ] && dur=500 + ok=0 + for attempt in 1 2 3 4; do + echo "[backfill] $tag $cfg attempt=$attempt $(date +%T)" + MB5_P_ROUTING=session MB5_COLO_ROUTING=session \ + REPLAY_MAX_INFLIGHT=$N REPLAY_INTER_TURN_THINK_S=$THINK REPLAY_NO_REALIZED_PREFIX=1 REPLAY_MAX_DURATION="$dur" \ + CONFIGS="$cfg" REPS=1 TRACE="$trace" RUN_TAG="$tag" \ + bash scripts/mb5_run_gpu.sh >/dev/null 2>&1 + if [ -f "mb5_runs/${tag}_${cfg}_rep1/replay_metrics.summary.json" ]; then + echo " OK $cfg pfx=$pfx attempt=$attempt"; ok=1; break; fi + echo " FAILED attempt=$attempt; cleanup+retry" + MB5_VENV=$PWD/.venv_dash0 bash scripts/mb5_launch.sh stop >/dev/null 2>&1; sleep 5 + done + [ $ok = 0 ] && echo "[backfill] GAVE UP $tag $cfg" +done +dirs=(); for d in mb5_runs/reuse_*_d2048_o128_*_rep1; do [ -f "$d/replay_metrics.summary.json" ] && dirs+=("$d"); done +$VPY scripts/fig_agg.py --json "${dirs[@]}" > analysis/mb5_pd_ablation/fig1_reuse_d2048_o128.json +echo "=== BACKFILL DONE dirs=${#dirs[@]}/24 $(date) ===" diff --git a/microbench/fresh_setup/fig_agg.py b/microbench/fresh_setup/fig_agg.py index f8497f6..c5296e2 100644 --- a/microbench/fresh_setup/fig_agg.py +++ b/microbench/fresh_setup/fig_agg.py @@ -100,11 +100,13 @@ def main(): continue s = json.load(open(sp)) arm, pg, dg, ports = arm_of(run.name) - lat = s.get("latency_stats_s", {}) - ttft = s.get("ttft_stats_s", {}) - tpot = s.get("tpot_stats_s", {}) + # `or {}` because a fully-collapsed arm (0 successes) writes these as null, + # and dict.get(k, {}) returns null (not {}) when the key exists with value null. + lat = s.get("latency_stats_s") or {} + ttft = s.get("ttft_stats_s") or {} + tpot = s.get("tpot_stats_s") or {} wall = s.get("wall_clock_s") or 1.0 - out = s.get("actual_output_tokens_stats", {}) + out = s.get("actual_output_tokens_stats") or {} n = s.get("success_count", 0); req = s.get("request_count", 0) tot_out = out.get("count", 0) * out.get("mean", 0) tps = tot_out / wall diff --git a/microbench/fresh_setup/mb5_run_gpu.sh b/microbench/fresh_setup/mb5_run_gpu.sh new file mode 100755 index 0000000..503b685 --- /dev/null +++ b/microbench/fresh_setup/mb5_run_gpu.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +# Orchestrator for MB5: for each CONFIG × rep, bring up the stack, run a +# trace replay against it, collect KV snapshots and replayer metrics, +# tear down. +# +# Designed to be run on dash1 (or any host with cpfs mounted at +# /home/admin/cpfs/wjh/). +# +# Env vars (with defaults): +# CONFIGS : space-separated MB5 configs (default: "8C 6P+2D 4P+4D 2P+6D") +# REPS : reps per config (default: 3) +# TRACE : trace JSONL path +# (default: /home/admin/cpfs/wjh/agentic-kv/traces/w600_r0.0015_st30.jsonl) +# RUN_TAG : output root tag (default: $(date +%Y%m%d_%H%M%S)) +# REQUEST_LIMIT : optional, cap replay requests (default: none) + +set -eo pipefail + +FRESH_ROOT="/home/admin/cpfs/wjh/agentic-kv-fresh" +# MB5_VENV lets a second host use an isolated venv clone (see mb5_launch.sh). +VENV="${MB5_VENV:-${FRESH_ROOT}/.venv}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +LAUNCH="${SCRIPT_DIR}/mb5_launch.sh" +REPLAYER_DIR="${FRESH_ROOT}/replayer" + +CONFIGS="${CONFIGS:-8C 6P+2D 4P+4D 2P+6D}" +REPS="${REPS:-3}" +TRACE="${TRACE:-/home/admin/cpfs/wjh/agentic-kv/traces/w600_r0.0015_st30.jsonl}" +RUN_TAG="${RUN_TAG:-$(date +%Y%m%d_%H%M%S)}" +MODEL_NAME="${MODEL_NAME:-/home/admin/cpfs/wjh/models/Qwen/Qwen3-Coder-30B-A3B-Instruct}" +REQUEST_LIMIT_ARG="" +if [ -n "${REQUEST_LIMIT:-}" ]; then + REQUEST_LIMIT_ARG="--request-limit ${REQUEST_LIMIT}" +fi + +OUT_ROOT="${FRESH_ROOT}/mb5_runs/${RUN_TAG}" +mkdir -p "${OUT_ROOT}" +echo "[mb5-run] RUN_TAG=${RUN_TAG}" +echo "[mb5-run] OUT_ROOT=${OUT_ROOT}" +echo "[mb5-run] CONFIGS=${CONFIGS}" +echo "[mb5-run] REPS=${REPS}" +echo "[mb5-run] TRACE=${TRACE}" + +run_one() { + local config="$1" rep="$2" + local label="${RUN_TAG}_${config}_rep${rep}" + local rundir="${FRESH_ROOT}/mb5_runs/${label}" + echo "" + echo "======== ${config} rep${rep} ========" + + # Launch + if ! CONFIG="${config}" RUN_LABEL="${RUN_TAG}_${config}_rep${rep}" \ + bash "${LAUNCH}" start > "${OUT_ROOT}/${config}_rep${rep}_launch.log" 2>&1; then + echo "[mb5-run] LAUNCH FAILED for ${config} rep${rep}; see ${OUT_ROOT}/${config}_rep${rep}_launch.log" + return 1 + fi + + # Extract ENDPOINTS line emitted by mb5_launch.sh + local endpoints + endpoints=$(grep "^ENDPOINTS=" "${OUT_ROOT}/${config}_rep${rep}_launch.log" | tail -1 | cut -d= -f2-) + if [ -z "${endpoints}" ]; then + echo "[mb5-run] ERROR: no ENDPOINTS in launch log" + bash "${LAUNCH}" stop > /dev/null 2>&1 || true + return 1 + fi + echo "[mb5-run] endpoints: ${endpoints}" + + # Replay + source "${VENV}/bin/activate" + local replay_out="${rundir}/replay_metrics.jsonl" + mkdir -p "$(dirname "${replay_out}")" + # per-GPU utilization timeseries over the replay window (2s sampling) + bash "${FRESH_ROOT}/microbench/fresh_setup/gpu_monitor.sh" "${rundir}/gpu_util.csv" 2 >/dev/null 2>&1 & + local GPU_MON=$! + local t0 + t0=$(date +%s.%N) + if ! PYTHONPATH="${FRESH_ROOT}" python -m replayer \ + --endpoint "${endpoints}" \ + --trace "${TRACE}" \ + --output "${replay_out}" \ + --model "${MODEL_NAME}" \ + ${REQUEST_LIMIT_ARG} \ + > "${OUT_ROOT}/${config}_rep${rep}_replay.log" 2>&1; then + local t1 + t1=$(date +%s.%N) + local wall=$(python -c "print(${t1} - ${t0})") + echo "[mb5-run] REPLAY FAILED after ${wall} s; see ${OUT_ROOT}/${config}_rep${rep}_replay.log" + kill "${GPU_MON}" 2>/dev/null || true + bash "${LAUNCH}" stop > /dev/null 2>&1 || true + return 1 + fi + local t1 + t1=$(date +%s.%N) + local wall_clock_s + wall_clock_s=$(python -c "print(${t1} - ${t0})") + echo "[mb5-run] replay done in ${wall_clock_s}s" + echo "${wall_clock_s}" > "${rundir}/wall_clock_s.txt" + kill "${GPU_MON}" 2>/dev/null || true + printf '{"t_start_unix":%s,"t_end_unix":%s}\n' "${t0}" "${t1}" > "${rundir}/run_window.json" + + # Per-instance prefix-cache counters, scraped from each backend BEFORE + # teardown. For PD this is the only honest reuse signal: producer ports + # (the low ones) show cross-turn prefix-cache hits; the consumer's + # per-request cached_tokens is meaningless (it counts transferred KV). + { + for p in 8000 8001 8002 8003 8004 8005 8006 8007; do + m=$(curl -s --noproxy '*' "http://127.0.0.1:${p}/metrics" 2>/dev/null) || continue + q=$(printf '%s' "$m" | awk '/^vllm:prefix_cache_queries_total/{print $2; exit}') + h=$(printf '%s' "$m" | awk '/^vllm:prefix_cache_hits_total/{print $2; exit}') + [ -n "${q}" ] && echo "port=${p} queries=${q} hits=${h}" + done + } > "${rundir}/instance_apc.txt" 2>/dev/null || true + + # Stop launch (cleans up vllm + proxy; reverts patch on last call) + CONFIG="${config}" RUN_LABEL="${RUN_TAG}_${config}_rep${rep}" \ + bash "${LAUNCH}" stop > "${OUT_ROOT}/${config}_rep${rep}_stop.log" 2>&1 || true + + sleep 10 # cooldown so GPUs settle before next config + echo "[mb5-run] DONE ${config} rep${rep}" +} + +# Quick check that the launch script and replayer are reachable +if [ ! -f "${LAUNCH}" ]; then echo "missing ${LAUNCH}"; exit 1; fi +if [ ! -d "${REPLAYER_DIR}" ]; then echo "missing ${REPLAYER_DIR}"; exit 1; fi +if [ ! -f "${TRACE}" ]; then echo "missing trace ${TRACE}"; exit 1; fi + +# Iterate +failures=0 +for config in ${CONFIGS}; do + for ((rep=1; rep<=REPS; rep++)); do + if ! run_one "${config}" "${rep}"; then + failures=$((failures+1)) + fi + done +done + +# Final patch revert (defensive — mb5_launch.sh stop also reverts) +python "${SCRIPT_DIR}/instrument_kv_snapshot.py" --revert --venv "${VENV}" 2>/dev/null || true + +echo "" +echo "======== ALL CONFIGS DONE ========" +echo "failures: ${failures}" +echo "results under: ${FRESH_ROOT}/mb5_runs/${RUN_TAG}_*" +echo "to plot: python plot_kv_pool_timeline.py --run-tag ${RUN_TAG}" diff --git a/microbench/fresh_setup/plot_pd_crossover.py b/microbench/fresh_setup/plot_pd_crossover.py new file mode 100644 index 0000000..1ec489c --- /dev/null +++ b/microbench/fresh_setup/plot_pd_crossover.py @@ -0,0 +1,184 @@ +"""Render the three PD-vs-colo crossover figures from fig_agg JSON dumps. + +Inputs (produced by `fig_agg.py --json`): + analysis/mb5_pd_ablation/fig1_reuse_fixed.json reuse axis (N=8, FIXED real + prefill delta=2048; vary cached prefix -> reuse = pfx/(pfx+delta). + Controlled-variable: real new-prefill work is constant across the sweep, + only the cached fraction (and total context) grows. Supersedes the old + fig1.json, which held input=8192 and sliced prefix out of it so delta + shrank 15x as reuse rose — a confound, not a pure reuse axis.) + analysis/mb5_pd_ablation/fig2.json shape axis (N=8, reuse~70%) + analysis/mb5_pd_ablation/fig3_conc32k.json concurrency (in32768/out128, + reuse~0.984 = 32256 resident + 512 real new-prefill per turn; retuned + 2026-05-31 to the agentic corner so PD pays the full-context per-turn + KV-transfer tax while colo keeps it resident; vary N by step 8 up to the + mean-E2E<=10s SLO ceiling) + +Each figure overlays colo + the three PD ratios and marks the PD-best advantage. +All three share the corrected (uncontaminated, e13391e-gated-off) stack. +""" +from __future__ import annotations + +import json +import re +from pathlib import Path + +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt + +ROOT = Path(__file__).resolve().parents[2] +DATA = ROOT / "analysis" / "mb5_pd_ablation" +OUT = ROOT / "figs" / "mb5_pd_ablation" +OUT.mkdir(parents=True, exist_ok=True) + +PD_ARMS = ["2P+6D", "4P+4D", "6P+2D"] +STYLE = { + "colo": dict(color="k", marker="o", lw=2.4, ls="-", label="colo (8×kv_both)"), + "2P+6D": dict(color="#1f77b4", marker="s", lw=1.6, ls="--", label="PD 2P+6D"), + "4P+4D": dict(color="#2ca02c", marker="^", lw=1.6, ls="--", label="PD 4P+4D"), + "6P+2D": dict(color="#ff7f0e", marker="v", lw=1.6, ls="--", label="PD 6P+2D"), +} + + +def load(name): + return json.load(open(DATA / name)) + + +def by_axis(rows, keyfn): + """Group rows -> {axis_val: {arm: row}}.""" + out = {} + for r in rows: + k = keyfn(r["name"]) + if k is None: + continue + out.setdefault(k, {})[r["arm"]] = r + return out + + +def pd_best(armmap, metric="e2e_p90"): + vals = [(a, armmap[a][metric]) for a in PD_ARMS + if a in armmap and armmap[a].get(metric) is not None] + return min(vals, key=lambda t: t[1]) if vals else (None, None) + + +def series(grp, xs, arm, metric): + return [grp[x][arm].get(metric) if arm in grp[x] else None for x in xs] + + +# ---------- Fig 1: reuse axis ---------- +def _reuse_pct(name): + """Reuse % from a `reuse_p{pfx}_d{delta}_{arm}` run name: pfx/(pfx+delta).""" + m = re.search(r"_p(\d+)_d(\d+)", name) + if not m: + return None + pfx, delta = int(m.group(1)), int(m.group(2)) + return round(pfx / (pfx + delta) * 100) + + +def fig_reuse(): + g = by_axis(load("fig1_reuse_fixed.json"), _reuse_pct) + xs = sorted(g) + reuse = xs + fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11, 4.2)) + for arm in ["colo", *PD_ARMS]: + ax1.plot(reuse, series(g, xs, arm, "e2e_p90"), **STYLE[arm]) + ax1.set_xlabel("intra-session KV reuse (%) [fixed real prefill, delta=2048]") + ax1.set_ylabel("E2E latency p90 (s)") + ax1.set_title("(a) E2E-p90 vs reuse (N=8, delta=2048/out256)") + ax1.legend(fontsize=8); ax1.grid(alpha=.3) + + adv, putil = [], [] + for x in xs: + co = g[x]["colo"]["e2e_p90"]; _, b = pd_best(g[x]) + adv.append(co / b if b else None) + a = pd_best(g[x])[0] + putil.append(g[x][a].get("pu") if a else None) + ax2.plot(reuse, adv, color="purple", marker="D", lw=2, label="PD-best advantage (colo/PD)") + ax2.axhline(1.0, color="grey", ls=":", lw=1) + ax2.set_xlabel("intra-session KV reuse (%)"); ax2.set_ylabel("advantage (>1 = PD wins)") + ax2b = ax2.twinx() + ax2b.plot(reuse, putil, color="brown", marker="x", lw=1.4, ls="-.", label="PD-best prefill-GPU util") + ax2b.set_ylabel("prefill-GPU util (%)", color="brown"); ax2b.tick_params(axis="y", colors="brown") + ax2.set_title("(b) advantage erodes; prefill GPUs go idle") + l1, la1 = ax2.get_legend_handles_labels(); l2, la2 = ax2b.get_legend_handles_labels() + ax2.legend(l1 + l2, la1 + la2, fontsize=8, loc="center right"); ax2.grid(alpha=.3) + fig.suptitle("Fig 1 — Reuse axis (fixed real prefill delta=2048): PD's edge vs rising cache reuse", + fontsize=11, y=1.02) + fig.tight_layout(); p = OUT / "fig1_reuse_axis.png"; fig.savefig(p, dpi=130, bbox_inches="tight") + print("wrote", p) + + +# ---------- Fig 2: shape axis ---------- +def fig_shape(): + g = by_axis(load("fig2.json"), + lambda n: ((int(m.group(1)), int(m.group(2))) + if (m := re.search(r"_in(\d+)_out(\d+)_", n)) else None)) + xs = sorted(g, key=lambda t: t[0]) # ascending input + labels = [f"in{i}\nout{o}" for i, o in xs] + xi = list(range(len(xs))) + fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11, 4.2)) + for arm in ["colo", *PD_ARMS]: + ax1.plot(xi, series(g, xs, arm, "e2e_p90"), **STYLE[arm]) + ax1.set_xticks(xi); ax1.set_xticklabels(labels, fontsize=7) + ax1.set_xlabel("shape (decode-heavy → prefill-heavy)"); ax1.set_ylabel("E2E latency p90 (s)") + ax1.set_title("(a) E2E-p90 vs shape (N=8, reuse~70%)") + ax1.legend(fontsize=8); ax1.grid(alpha=.3) + + adv, comp = [], [] + for x in xs: + co = g[x]["colo"]["e2e_p90"]; a, b = pd_best(g[x]) + adv.append(co / b if b else None) + # completion of the worst PD arm (exposes catastrophic ratio) + worst = min((g[x][arm]["n"] / g[x][arm]["req"]) for arm in PD_ARMS if arm in g[x]) + comp.append(worst * 100) + ax2.plot(xi, adv, color="purple", marker="D", lw=2, label="PD-best advantage (colo/PD)") + ax2.axhline(1.0, color="grey", ls=":", lw=1) + ax2.set_xticks(xi); ax2.set_xticklabels(labels, fontsize=7) + ax2.set_xlabel("shape"); ax2.set_ylabel("advantage (>1 = PD wins)") + ax2b = ax2.twinx() + ax2b.plot(xi, comp, color="red", marker="x", lw=1.4, ls="-.", label="worst-PD-arm completion %") + ax2b.set_ylabel("worst PD completion (%)", color="red"); ax2b.tick_params(axis="y", colors="red") + ax2b.set_ylim(80, 101) + ax2.set_title("(b) advantage peaks mid-sweep; wrong ratio catastrophic at prefill extreme") + l1, la1 = ax2.get_legend_handles_labels(); l2, la2 = ax2b.get_legend_handles_labels() + ax2.legend(l1 + l2, la1 + la2, fontsize=8, loc="lower left"); ax2.grid(alpha=.3) + fig.suptitle("Fig 2 — Shape axis: PD wins decode-heavy, ties prefill-heavy; optimal ratio rotates", + fontsize=11, y=1.02) + fig.tight_layout(); p = OUT / "fig2_shape_axis.png"; fig.savefig(p, dpi=130, bbox_inches="tight") + print("wrote", p) + + +# ---------- Fig 3: concurrency axis ---------- +def fig_conc(): + g = by_axis(load("fig3_conc32k.json"), + lambda n: (int(m.group(1)) if (m := re.search(r"_N(\d+)_", n)) else None)) + xs = sorted(g) + fig, axes = plt.subplots(1, 3, figsize=(15, 4.2)) + ax1, ax2, ax3 = axes + for arm in ["colo", *PD_ARMS]: + ax1.plot(xs, series(g, xs, arm, "e2e_mean"), **STYLE[arm]) + ax1.axhline(10.0, color="red", ls=":", lw=1, label="SLO (mean E2E 10s)") + ax1.set_yscale("log"); ax1.set_xticks(xs); ax1.set_xticklabels(xs, fontsize=7) + ax1.set_xlabel("concurrent sessions N"); ax1.set_ylabel("E2E latency mean (s, log)") + ax1.set_title("(a) mean-E2E vs concurrency"); ax1.legend(fontsize=8); ax1.grid(alpha=.3, which="both") + + for arm in ["colo", *PD_ARMS]: + ax2.plot(xs, series(g, xs, arm, "tps"), **STYLE[arm]) + ax2.set_xticks(xs); ax2.set_xticklabels(xs, fontsize=7) + ax2.set_xlabel("concurrent sessions N"); ax2.set_ylabel("throughput (tok/s)") + ax2.set_title("(b) TPS: colo scales, PD plateaus/drops"); ax2.legend(fontsize=8); ax2.grid(alpha=.3) + + for arm in ["colo", *PD_ARMS]: + ax3.plot(xs, [v * 100 if v is not None else None for v in series(g, xs, arm, "apc")], **STYLE[arm]) + ax3.set_xticks(xs); ax3.set_xticklabels(xs, fontsize=7) + ax3.set_xlabel("concurrent sessions N"); ax3.set_ylabel("producer prefix-cache hit-rate (%)") + ax3.set_title("(c) APC vs concurrency"); ax3.legend(fontsize=8); ax3.grid(alpha=.3) + fig.suptitle("Fig 3 — Concurrency axis (in32768/out128, reuse~0.984): sweep N by 8 to the 10s-SLO ceiling", + fontsize=11, y=1.02) + fig.tight_layout(); p = OUT / "fig3_concurrency_axis.png"; fig.savefig(p, dpi=130, bbox_inches="tight") + print("wrote", p) + + +if __name__ == "__main__": + fig_reuse(); fig_shape(); fig_conc() diff --git a/microbench/fresh_setup/run_campaign.sh b/microbench/fresh_setup/run_campaign.sh new file mode 100644 index 0000000..9da633a --- /dev/null +++ b/microbench/fresh_setup/run_campaign.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Unattended serial PD-ablation campaign: reuse sweep -> conc sweep. +# STRICTLY one driver at a time (the hard lesson): each inner driver brings up and +# tears down its own vLLM per config via scripts/mb5_run_gpu.sh, and the two sweeps +# run sequentially (reuse fully finishes + tears down before conc starts). We verify +# GPUs are clear between sweeps. NO set -e here: a sub-sweep nonzero must NOT skip the +# other sweep; rc is captured and reported. Detached launch writes a DONE marker. +cd /home/admin/cpfs/wjh/agentic-kv-fresh +export MB5_VENV="${MB5_VENV:-/home/admin/cpfs/wjh/agentic-kv-fresh/.venv_dash0}" +FS=microbench/fresh_setup + +echo "=== CAMPAIGN START $(date) ===" + +echo "=== [1/2] REUSE SWEEP (fixed real prefill delta=2048, out=256, reuse 20-95%, N=8) $(date) ===" +bash "$FS/run_reuse_fixed.sh"; rc_reuse=$? +echo "=== reuse sweep rc=$rc_reuse $(date) ===" + +sleep 15 +echo "--- GPU mem after reuse sweep (expect ~0 before conc) ---" +nvidia-smi --query-gpu=index,memory.used --format=csv,noheader | head -8 + +echo "=== [2/2] CONC SWEEP (in=32768 reuse=0.984, balanced N grid 8 16 32 48 64 96 128) $(date) ===" +NLIST="8 16 32 48 64 96 128" bash "$FS/run_conc.sh"; rc_conc=$? +echo "=== conc sweep rc=$rc_conc $(date) ===" + +echo "=== CAMPAIGN DONE reuse_rc=$rc_reuse conc_rc=$rc_conc $(date) ===" diff --git a/microbench/fresh_setup/run_campaign2.sh b/microbench/fresh_setup/run_campaign2.sh new file mode 100644 index 0000000..bc893cc --- /dev/null +++ b/microbench/fresh_setup/run_campaign2.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Campaign 2 (2026-05-31): two extra reuse sweeps at out=128 (user request: +# delta=1024/out=128 and delta=2048/out=128), then the capped conc restart. +# STRICTLY one driver at a time; reuse sweeps run uncapped (mild collapse, matches +# the existing d2048/o256 sweep), conc runs with the PD-arm wall-cap. NO set -e. +cd /home/admin/cpfs/wjh/agentic-kv-fresh +export MB5_VENV="${MB5_VENV:-/home/admin/cpfs/wjh/agentic-kv-fresh/.venv_dash0}" +FS=microbench/fresh_setup + +echo "=== CAMPAIGN2 START $(date) ===" + +echo "=== [1/3] REUSE delta=1024 out=128 (reuse 0.33-0.97) $(date) ===" +DELTA=1024 OL=128 bash "$FS/run_reuse_fixed.sh"; rc1=$? +echo "=== reuse d1024 o128 rc=$rc1 $(date) ===" +sleep 12; nvidia-smi --query-gpu=index,memory.used --format=csv,noheader | head -8 + +echo "=== [2/3] REUSE delta=2048 out=128 (reuse 0.20-0.95) $(date) ===" +DELTA=2048 OL=128 bash "$FS/run_reuse_fixed.sh"; rc2=$? +echo "=== reuse d2048 o128 rc=$rc2 $(date) ===" +sleep 12; nvidia-smi --query-gpu=index,memory.used --format=csv,noheader | head -8 + +echo "=== [3/3] CONC capped (PD wall=${CONC_PD_MAXDUR:-600}s, colo uncapped), N 8..128 $(date) ===" +NLIST="8 16 32 48 64 96 128" bash "$FS/run_conc.sh"; rc3=$? +echo "=== conc rc=$rc3 $(date) ===" + +echo "=== CAMPAIGN2 DONE reuse_d1024_o128=$rc1 reuse_d2048_o128=$rc2 conc=$rc3 $(date) ===" diff --git a/microbench/fresh_setup/run_campaign3.sh b/microbench/fresh_setup/run_campaign3.sh new file mode 100644 index 0000000..9f09f1a --- /dev/null +++ b/microbench/fresh_setup/run_campaign3.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Campaign 3 (2026-05-31): the uncapped d2048/o128 reuse sweep stalled on a +# collapse-draining high-reuse PD arm (4P+4D @ reuse 0.90, ~1 req/several-min). +# Finish it by re-running ONLY the high-reuse points (0.90, 0.95) WITH the PD +# wall-cap (low-reuse arms already completed and are cap-insensitive). Then run +# the capped conc sweep. STRICTLY serial. NO set -e. +cd /home/admin/cpfs/wjh/agentic-kv-fresh +export MB5_VENV="${MB5_VENV:-/home/admin/cpfs/wjh/agentic-kv-fresh/.venv_dash0}" +FS=microbench/fresh_setup +echo "=== CAMPAIGN3 START $(date) ===" + +echo "=== [1/2] finish reuse d2048/o128: re-run pts pfx=18432,38912 (PD capped 500s) $(date) ===" +DELTA=2048 OL=128 PFXS="18432 38912" REUSE_PD_MAXDUR=500 bash "$FS/run_reuse_fixed.sh"; rc1=$? +echo "=== reuse d2048 o128 finish rc=$rc1 $(date) ===" +sleep 12; nvidia-smi --query-gpu=index,memory.used --format=csv,noheader | head -8 + +echo "=== [2/2] CONC capped (PD wall=600s, colo uncapped), N 8..128 $(date) ===" +NLIST="8 16 32 48 64 96 128" CONC_PD_MAXDUR=600 bash "$FS/run_conc.sh"; rc2=$? +echo "=== conc rc=$rc2 $(date) ===" +echo "=== CAMPAIGN3 DONE reuse_finish=$rc1 conc=$rc2 $(date) ===" diff --git a/microbench/fresh_setup/run_conc.sh b/microbench/fresh_setup/run_conc.sh new file mode 100644 index 0000000..e4d466f --- /dev/null +++ b/microbench/fresh_setup/run_conc.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# Concurrency axis, agentic-corner config. Supersedes old fig3 (in~8192/out256). +# RETUNED 2026-05-31 for realism (C2): hold total context in=32768 but shrink the +# real per-turn new-prefill to delta=512 and push reuse to 0.984 (real agentic +# reuse ->99.6%). prefix 32256 + delta 512. out=128. This is the corner that +# exposes PD's structural tax: colo keeps the 32k resident KV local, but PD must +# KV-transfer the whole 32k context every turn even though only 512 tokens are new +# (C2 PD-tax ~250-450x). Sweep closed-loop N by step 8 up to mean-E2E<=SLO ceiling. +# Wiring per memory project-mb5-pd-ablation-wiring: .venv_dash0, traces_synth/, +# CONFIG 8C-proxy + PD, MB5_P_ROUTING=session + MB5_COLO_ROUTING=session, +# N=REPLAY_MAX_INFLIGHT closed loop + REPLAY_INTER_TURN_THINK_S, +# REPLAY_NO_REALIZED_PREFIX=1. RUN ONLY ONE DRIVER AT A TIME (shared GPUs/ports). +set -eo pipefail +cd /home/admin/cpfs/wjh/agentic-kv-fresh +export MB5_VENV="${MB5_VENV:-/home/admin/cpfs/wjh/agentic-kv-fresh/.venv_dash0}" +VPY="$MB5_VENV/bin/python" + +PFX="${PFX:-32256}"; DELTA="${DELTA:-512}"; OL="${OL:-128}" # reuse=0.984, in=32768 +THINK="${THINK:-0.5}"; TURNS="${TURNS:-8}" +NSTART="${NSTART:-8}"; NSTEP="${NSTEP:-8}"; NMAX="${NMAX:-128}" +NLIST="${NLIST:-}" # explicit N grid (overrides NSTART/STEP/MAX), e.g. "8 16 32 48 64 96 128" +CONC_PD_MAXDUR="${CONC_PD_MAXDUR:-600}" # wall-deadline (s) for PD arms only; bounds collapsed-arm + # drain (un-run turns = failures). colo (8C-proxy) runs UNCAPPED + # so the headline reference is always fully measured. +SLO="${SLO:-10.0}" +SESS_PER_N="${SESS_PER_N:-4}" +CFGS="${CFGS:-8C-proxy 2P+6D 4P+4D 6P+2D}" +ONLY_N="${ONLY_N:-}" + +run_N() { + local N="$1"; local sess=$(( SESS_PER_N * N )) + local tag="conc32k_N${N}"; local trace="traces_synth/${tag}.jsonl" + "$VPY" scripts/gen_synthetic_trace.py --out "$trace" --mode regular \ + --qps "$sess" --duration-s 1 --turns "$TURNS" \ + --prefix-len "$PFX" --delta-len "$DELTA" --output-len "$OL" --seed 42 >/dev/null + echo "[conc32k] N=$N sess=$sess in=$((PFX+DELTA)) out=$OL -> $trace" + for cfg in $CFGS; do + echo " -> $cfg" + local dur=""; [ "$cfg" != "8C-proxy" ] && dur="$CONC_PD_MAXDUR" # colo uncapped + MB5_P_ROUTING=session MB5_COLO_ROUTING=session \ + REPLAY_MAX_INFLIGHT="$N" REPLAY_INTER_TURN_THINK_S="$THINK" REPLAY_NO_REALIZED_PREFIX=1 \ + REPLAY_MAX_DURATION="$dur" \ + CONFIGS="$cfg" REPS=1 TRACE="$trace" RUN_TAG="$tag" \ + bash scripts/mb5_run_gpu.sh >/dev/null 2>&1 || echo " [warn] ${tag}_${cfg} failed" >&2 + done + local d="mb5_runs/${tag}_8C-proxy_rep1" + if [ -f "$d/replay_metrics.summary.json" ]; then + "$VPY" scripts/fig_agg.py --json "$d" 2>/dev/null \ + | "$VPY" -c "import sys,json;r=json.load(sys.stdin);print(r[0].get('e2e_mean') if r else 'nan')" + else echo nan; fi +} + +if [ -n "$ONLY_N" ]; then + echo "[conc32k] SMOKE N=$ONLY_N cfgs='$CFGS'" + t0=$(date +%s); m=$(run_N "$ONLY_N"); t1=$(date +%s) + echo "[conc32k] SMOKE N=$ONLY_N colo mean-E2E=${m}s wall=$(( t1 - t0 ))s; compare:" + "$VPY" scripts/fig_agg.py mb5_runs/conc32k_N${ONLY_N}_*_rep1 2>&1 + exit 0 +fi + +if [ -n "$NLIST" ]; then NSEQ="$NLIST"; else NSEQ=$(seq "$NSTART" "$NSTEP" "$NMAX"); fi +for N in $NSEQ; do + echo "[conc32k] === N=$N ===" + m=$(run_N "$N"); echo "[conc32k] N=$N colo mean-E2E=${m}s" + over=$("$VPY" -c "print(1 if float('${m}')>${SLO} else 0)" 2>/dev/null || echo 0) + [ "$over" = "1" ] && { echo "[conc32k] colo crossed SLO ${SLO}s at N=$N -> stop"; break; } +done +dirs=(); for d in mb5_runs/conc32k_N*_rep1; do [ -d "$d" ] && dirs+=("$d"); done +"$VPY" scripts/fig_agg.py --json "${dirs[@]}" > analysis/mb5_pd_ablation/fig3_conc32k.json +echo "[conc32k] done -> analysis/mb5_pd_ablation/fig3_conc32k.json (${#dirs[@]} dirs)" diff --git a/microbench/fresh_setup/run_reuse_fixed.sh b/microbench/fresh_setup/run_reuse_fixed.sh new file mode 100644 index 0000000..9b9f9ae --- /dev/null +++ b/microbench/fresh_setup/run_reuse_fixed.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Reuse axis, DONE RIGHT (controlled variable). Supersedes old fig1. +# Hold REAL (uncached) prefill work constant: --delta-len = U fixed. +# Vary only --prefix-len = C -> reuse = C/(C+U). Context grows with reuse but +# the tokens that must actually be prefilled each turn stays = U. +# Old fig1 held input=8192 and sliced prefix out of it, so delta shrank 15x as +# reuse rose -> confounded "more reuse" with "less prefill". This fixes that. +# +# Wiring matches the corrected MB5 stack (see memory project-mb5-pd-ablation-wiring): +# .venv_dash0, traces_synth/, CONFIG 8C-proxy + PD, MB5_P_ROUTING=session, +# N injected via REPLAY_MAX_INFLIGHT (closed loop) + REPLAY_INTER_TURN_THINK_S, +# REPLAY_NO_REALIZED_PREFIX=1 (reuse governed by hash_ids, required for this sweep). +set -eo pipefail +cd /home/admin/cpfs/wjh/agentic-kv-fresh +export MB5_VENV="${MB5_VENV:-/home/admin/cpfs/wjh/agentic-kv-fresh/.venv_dash0}" +VPY="$MB5_VENV/bin/python" + +DELTA="${DELTA:-2048}" # fixed real prefill per turn (USER-CHOSEN) +OL="${OL:-256}" +N="${N:-8}" +THINK="${THINK:-0.5}" +TURNS="${TURNS:-8}" +NSESS="${NSESS:-48}" # number of sessions (closed-loop: arrival rate is + # irrelevant, only the count matters; ~6 waves at N=8) +PFXS="${PFXS:-512 2048 4096 8192 18432 38912}" # reuse .20 .50 .67 .80 .90 .95 +CFGS="${CFGS:-8C-proxy 2P+6D 4P+4D 6P+2D}" +REUSE_PD_MAXDUR="${REUSE_PD_MAXDUR:-500}" # wall-deadline (s) for PD arms only (colo uncapped): + # bounds the collapse-drain that stalls high-reuse PD arms + # (un-run turns = failures, honest completion%). 0/empty = off. +ONLY_PFX="${ONLY_PFX:-}" # smoke a single prefix then exit + +run_point() { # + local pfx="$1" + local reuse; reuse=$(python3 -c "print(f'{$pfx/($pfx+$DELTA):.3f}')") + local tag="reuse_p${pfx}_d${DELTA}_o${OL}" # _o${OL} so different output lens don't collide + local trace="traces_synth/${tag}.jsonl" + # Closed-loop: pass NSESS as qps with duration 1 so n_sessions = NSESS + # exactly (gen_regular: n_sessions = int(duration_s * session_qps)). + "$VPY" scripts/gen_synthetic_trace.py --out "$trace" --mode regular \ + --qps "$NSESS" --duration-s 1 --turns "$TURNS" \ + --prefix-len "$pfx" --delta-len "$DELTA" --output-len "$OL" --seed 42 >/dev/null + echo "[reuse] pfx=$pfx delta=$DELTA reuse=$reuse in=$((pfx+DELTA)) -> $trace" + for cfg in $CFGS; do + echo " -> $cfg" + # Both routings set to session so BOTH colo (kv_both) and PD producers + # pin a session's turns to one instance and reuse its prefix cache — the + # fair cache-aware comparison. P_ROUTING is ignored by colo, COLO_ROUTING + # by PD, so setting both is harmless and symmetric. + local dur=""; [ "$cfg" != "8C-proxy" ] && dur="$REUSE_PD_MAXDUR" # colo uncapped + MB5_P_ROUTING=session MB5_COLO_ROUTING=session \ + REPLAY_MAX_INFLIGHT="$N" REPLAY_INTER_TURN_THINK_S="$THINK" \ + REPLAY_NO_REALIZED_PREFIX=1 REPLAY_MAX_DURATION="$dur" \ + CONFIGS="$cfg" REPS=1 TRACE="$trace" RUN_TAG="$tag" \ + bash scripts/mb5_run_gpu.sh >/dev/null 2>&1 || echo " [warn] $cfg failed" >&2 + done +} + +if [ -n "$ONLY_PFX" ]; then + echo "[reuse] SMOKE pfx=$ONLY_PFX cfgs='$CFGS'" + t0=$(date +%s); run_point "$ONLY_PFX"; t1=$(date +%s) + echo "[reuse] SMOKE done wall=$(( t1 - t0 ))s; compare:" + "$VPY" scripts/fig_agg.py mb5_runs/reuse_p${ONLY_PFX}_d${DELTA}_o${OL}_*_rep1 + exit 0 +fi + +for pfx in $PFXS; do run_point "$pfx"; done +# Aggregate ONLY this sweep's dirs (matched by delta+output) so the three +# reuse figures (d2048/o256, d1024/o128, d2048/o128) never cross-contaminate. +dirs=(); for d in mb5_runs/reuse_*_d${DELTA}_o${OL}_*_rep1; do [ -d "$d" ] && dirs+=("$d"); done +OUTJSON="analysis/mb5_pd_ablation/fig1_reuse_d${DELTA}_o${OL}.json" +"$VPY" scripts/fig_agg.py --json "${dirs[@]}" > "$OUTJSON" +echo "[reuse] done -> $OUTJSON (${#dirs[@]} dirs)"