[{"data":1,"prerenderedAt":2448},["ShallowReactive",2],{"article-alternates":3,"article-\u002Fit\u002Ftech\u002Fridurre-latenza-personalizzazione-40ms-edge-ssr":13},{"i18nKey":4,"paths":5},"tech-003-2026-06",{"de":6,"en":7,"es":8,"fr":9,"it":10,"ru":11,"tr":12},"\u002Fde\u002Ftech\u002Fedge-ssr-personalisierung-latenz-40ms","\u002Fen\u002Ftech\u002Fedge-ssr-personalization-latency","\u002Fes\u002Ftech\u002Fedge-ssr-personalizacion-latencia-40ms","\u002Ffr\u002Ftech\u002Fedge-ssr-personnalisation-latence-40ms","\u002Fit\u002Ftech\u002Fridurre-latenza-personalizzazione-40ms-edge-ssr","\u002Fru\u002Ftech\u002Fedge-ssr-personalizasyon-40ms","\u002Ftr\u002Ftech\u002Fedge-ssr-ile-personalizasyon-latencysini-40msye-dusurmek",{"_path":10,"_dir":14,"_draft":15,"_partial":15,"_locale":16,"title":17,"description":18,"publishedAt":19,"modifiedAt":19,"category":14,"i18nKey":4,"tags":20,"readingTime":26,"author":27,"body":28,"_type":2442,"_id":2443,"_source":2444,"_file":2445,"_stem":2446,"_extension":2447},"tech",false,"","Ridurre la latenza di personalizzazione a 40ms con Edge SSR","Con Cloudflare Workers e Vercel Edge, il rendering server-side si sposta in edge, abbattendo la personalizzazione da 250ms a 40ms. Architettura KV store, esempi di codice, analisi dei trade-off.","2026-06-21",[21,22,23,24,25],"edge-computing","ssr","personalization","cloudflare-workers","vercel-edge",9,"Roibase",{"type":29,"children":30,"toc":2432},"root",[31,39,46,51,56,171,176,181,188,193,816,828,841,847,867,1294,1310,1481,1486,1492,1497,1565,1577,1582,1755,1760,1766,1771,1913,1918,1923,2050,2055,2061,2066,2240,2253,2258,2300,2305,2421,2426],{"type":32,"tag":33,"props":34,"children":35},"element","p",{},[36],{"type":37,"value":38},"text","Nei moderni e-commerce, la personalizzazione è ormai un'aspettativa — ma nessuno vuole attendere 250ms a ogni click. L'architettura SSR tradizionale (server-side rendering) crea una latenza media di 150-300ms tra client e origin server: DNS lookup, TCP handshake, TLS negotiation, elaborazione dell'origin. Edge SSR riduce questo ritardo a 40-60ms sfruttando la prossimità geografica e uno store KV globale. Piattaforme come Cloudflare Workers e Vercel Edge Functions offrono runtime edge — il nostro compito è spostare la logica di personalizzazione lì e strutturare correttamente lo store KV.",{"type":32,"tag":40,"props":41,"children":43},"h2",{"id":42},"il-divario-di-latenza-tra-origin-ssr-e-edge-ssr",[44],{"type":37,"value":45},"Il divario di latenza tra Origin SSR e Edge SSR",{"type":32,"tag":33,"props":47,"children":48},{},[49],{"type":37,"value":50},"Con SSR tradizionale, la richiesta segue questo percorso: utente → CDN (cache miss) → origin server (query DB + rendering) → risposta. Tempo totale medio: 250ms, 95° percentile 450ms. Con Edge SSR, la richiesta termina nel location edge: utente → edge worker (ricerca KV + rendering) → risposta. Tempo medio: 40ms, 95° percentile 80ms.",{"type":32,"tag":33,"props":52,"children":53},{},[54],{"type":37,"value":55},"Fonti di latenza:",{"type":32,"tag":57,"props":58,"children":59},"table",{},[60,84],{"type":32,"tag":61,"props":62,"children":63},"thead",{},[64],{"type":32,"tag":65,"props":66,"children":67},"tr",{},[68,74,79],{"type":32,"tag":69,"props":70,"children":71},"th",{},[72],{"type":37,"value":73},"Fase",{"type":32,"tag":69,"props":75,"children":76},{},[77],{"type":37,"value":78},"Origin SSR",{"type":32,"tag":69,"props":80,"children":81},{},[82],{"type":37,"value":83},"Edge SSR",{"type":32,"tag":85,"props":86,"children":87},"tbody",{},[88,107,125,143],{"type":32,"tag":65,"props":89,"children":90},{},[91,97,102],{"type":32,"tag":92,"props":93,"children":94},"td",{},[95],{"type":37,"value":96},"DNS + TLS",{"type":32,"tag":92,"props":98,"children":99},{},[100],{"type":37,"value":101},"50ms",{"type":32,"tag":92,"props":103,"children":104},{},[105],{"type":37,"value":106},"15ms (prossimità edge)",{"type":32,"tag":65,"props":108,"children":109},{},[110,115,120],{"type":32,"tag":92,"props":111,"children":112},{},[113],{"type":37,"value":114},"Network RTT",{"type":32,"tag":92,"props":116,"children":117},{},[118],{"type":37,"value":119},"120ms (intercontinentale)",{"type":32,"tag":92,"props":121,"children":122},{},[123],{"type":37,"value":124},"10ms (distanza da edge)",{"type":32,"tag":65,"props":126,"children":127},{},[128,133,138],{"type":32,"tag":92,"props":129,"children":130},{},[131],{"type":37,"value":132},"Compute",{"type":32,"tag":92,"props":134,"children":135},{},[136],{"type":37,"value":137},"80ms (origin)",{"type":32,"tag":92,"props":139,"children":140},{},[141],{"type":37,"value":142},"15ms (isolato V8)",{"type":32,"tag":65,"props":144,"children":145},{},[146,155,163],{"type":32,"tag":92,"props":147,"children":148},{},[149],{"type":32,"tag":150,"props":151,"children":152},"strong",{},[153],{"type":37,"value":154},"Totale",{"type":32,"tag":92,"props":156,"children":157},{},[158],{"type":32,"tag":150,"props":159,"children":160},{},[161],{"type":37,"value":162},"250ms",{"type":32,"tag":92,"props":164,"children":165},{},[166],{"type":32,"tag":150,"props":167,"children":168},{},[169],{"type":37,"value":170},"40ms",{"type":32,"tag":33,"props":172,"children":173},{},[174],{"type":37,"value":175},"Questo è un calo del 84%, che impatta direttamente su LCP (Largest Contentful Paint) e CLS (Cumulative Layout Shift). Secondo il rapporto Google Core Web Vitals 2025, ogni 100ms di riduzione in LCP corrisponde a un aumento del 3,5% di bounce rate — guadagnare 210ms significa un +7,3% di lift conversione (calcolo: 210\u002F100 × 3,5).",{"type":32,"tag":33,"props":177,"children":178},{},[179],{"type":37,"value":180},"Trade-off critico: il runtime edge non è Node.js ma un isolato V8 — niente moduli nativi, filesystem, child process. La logica di personalizzazione deve essere completamente stateless e leggera.",{"type":32,"tag":182,"props":183,"children":185},"h3",{"id":184},"architettura-edge-ssr-con-cloudflare-workers",[186],{"type":37,"value":187},"Architettura Edge SSR con Cloudflare Workers",{"type":32,"tag":33,"props":189,"children":190},{},[191],{"type":37,"value":192},"Cloudflare Workers indirizza ogni richiesta a uno dei 300+ location edge nella rete globale. Nel location edge, la richiesta viene elaborata così:",{"type":32,"tag":194,"props":195,"children":199},"pre",{"className":196,"code":197,"language":198,"meta":16,"style":16},"language-javascript shiki shiki-themes github-dark","\u002F\u002F worker.js — Cloudflare Workers\nexport default {\n  async fetch(request, env) {\n    const url = new URL(request.url);\n    const userId = request.headers.get('x-user-id'); \u002F\u002F estratto da JWT\n\n    \u002F\u002F Recupera il segmento utente da KV\n    const segment = await env.USER_SEGMENTS.get(userId);\n    const prefs = segment ? JSON.parse(segment) : { tier: 'free' };\n\n    \u002F\u002F Renderizza HTML personalizzato\n    const html = renderHTML(prefs, url.pathname);\n\n    return new Response(html, {\n      headers: {\n        'content-type': 'text\u002Fhtml;charset=UTF-8',\n        'cache-control': 'public, s-maxage=60', \u002F\u002F cache edge 60s\n      },\n    });\n  },\n};\n\nfunction renderHTML(prefs, path) {\n  const hero = prefs.tier === 'premium'\n    ? '\u003Ch1>Contenuto Premium\u003C\u002Fh1>'\n    : '\u003Ch1>Contenuto Gratuito\u003C\u002Fh1>';\n  return `\u003C!DOCTYPE html>\u003Chtml>\u003Cbody>${hero}\u003Cp>Percorso: ${path}\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>`;\n}\n","javascript",[200],{"type":32,"tag":201,"props":202,"children":203},"code",{"__ignoreMap":16},[204,216,237,278,313,360,370,379,425,490,498,507,534,542,565,574,598,625,634,643,652,661,669,704,737,751,770,807],{"type":32,"tag":205,"props":206,"children":209},"span",{"class":207,"line":208},"line",1,[210],{"type":32,"tag":205,"props":211,"children":213},{"style":212},"--shiki-default:#6A737D",[214],{"type":37,"value":215},"\u002F\u002F worker.js — Cloudflare Workers\n",{"type":32,"tag":205,"props":217,"children":219},{"class":207,"line":218},2,[220,226,231],{"type":32,"tag":205,"props":221,"children":223},{"style":222},"--shiki-default:#F97583",[224],{"type":37,"value":225},"export",{"type":32,"tag":205,"props":227,"children":228},{"style":222},[229],{"type":37,"value":230}," default",{"type":32,"tag":205,"props":232,"children":234},{"style":233},"--shiki-default:#E1E4E8",[235],{"type":37,"value":236}," {\n",{"type":32,"tag":205,"props":238,"children":240},{"class":207,"line":239},3,[241,246,252,257,263,268,273],{"type":32,"tag":205,"props":242,"children":243},{"style":222},[244],{"type":37,"value":245},"  async",{"type":32,"tag":205,"props":247,"children":249},{"style":248},"--shiki-default:#B392F0",[250],{"type":37,"value":251}," fetch",{"type":32,"tag":205,"props":253,"children":254},{"style":233},[255],{"type":37,"value":256},"(",{"type":32,"tag":205,"props":258,"children":260},{"style":259},"--shiki-default:#FFAB70",[261],{"type":37,"value":262},"request",{"type":32,"tag":205,"props":264,"children":265},{"style":233},[266],{"type":37,"value":267},", ",{"type":32,"tag":205,"props":269,"children":270},{"style":259},[271],{"type":37,"value":272},"env",{"type":32,"tag":205,"props":274,"children":275},{"style":233},[276],{"type":37,"value":277},") {\n",{"type":32,"tag":205,"props":279,"children":281},{"class":207,"line":280},4,[282,287,293,298,303,308],{"type":32,"tag":205,"props":283,"children":284},{"style":222},[285],{"type":37,"value":286},"    const",{"type":32,"tag":205,"props":288,"children":290},{"style":289},"--shiki-default:#79B8FF",[291],{"type":37,"value":292}," url",{"type":32,"tag":205,"props":294,"children":295},{"style":222},[296],{"type":37,"value":297}," =",{"type":32,"tag":205,"props":299,"children":300},{"style":222},[301],{"type":37,"value":302}," new",{"type":32,"tag":205,"props":304,"children":305},{"style":248},[306],{"type":37,"value":307}," URL",{"type":32,"tag":205,"props":309,"children":310},{"style":233},[311],{"type":37,"value":312},"(request.url);\n",{"type":32,"tag":205,"props":314,"children":316},{"class":207,"line":315},5,[317,321,326,330,335,340,344,350,355],{"type":32,"tag":205,"props":318,"children":319},{"style":222},[320],{"type":37,"value":286},{"type":32,"tag":205,"props":322,"children":323},{"style":289},[324],{"type":37,"value":325}," userId",{"type":32,"tag":205,"props":327,"children":328},{"style":222},[329],{"type":37,"value":297},{"type":32,"tag":205,"props":331,"children":332},{"style":233},[333],{"type":37,"value":334}," request.headers.",{"type":32,"tag":205,"props":336,"children":337},{"style":248},[338],{"type":37,"value":339},"get",{"type":32,"tag":205,"props":341,"children":342},{"style":233},[343],{"type":37,"value":256},{"type":32,"tag":205,"props":345,"children":347},{"style":346},"--shiki-default:#9ECBFF",[348],{"type":37,"value":349},"'x-user-id'",{"type":32,"tag":205,"props":351,"children":352},{"style":233},[353],{"type":37,"value":354},"); ",{"type":32,"tag":205,"props":356,"children":357},{"style":212},[358],{"type":37,"value":359},"\u002F\u002F estratto da JWT\n",{"type":32,"tag":205,"props":361,"children":363},{"class":207,"line":362},6,[364],{"type":32,"tag":205,"props":365,"children":367},{"emptyLinePlaceholder":366},true,[368],{"type":37,"value":369},"\n",{"type":32,"tag":205,"props":371,"children":373},{"class":207,"line":372},7,[374],{"type":32,"tag":205,"props":375,"children":376},{"style":212},[377],{"type":37,"value":378},"    \u002F\u002F Recupera il segmento utente da KV\n",{"type":32,"tag":205,"props":380,"children":382},{"class":207,"line":381},8,[383,387,392,396,401,406,411,416,420],{"type":32,"tag":205,"props":384,"children":385},{"style":222},[386],{"type":37,"value":286},{"type":32,"tag":205,"props":388,"children":389},{"style":289},[390],{"type":37,"value":391}," segment",{"type":32,"tag":205,"props":393,"children":394},{"style":222},[395],{"type":37,"value":297},{"type":32,"tag":205,"props":397,"children":398},{"style":222},[399],{"type":37,"value":400}," await",{"type":32,"tag":205,"props":402,"children":403},{"style":233},[404],{"type":37,"value":405}," env.",{"type":32,"tag":205,"props":407,"children":408},{"style":289},[409],{"type":37,"value":410},"USER_SEGMENTS",{"type":32,"tag":205,"props":412,"children":413},{"style":233},[414],{"type":37,"value":415},".",{"type":32,"tag":205,"props":417,"children":418},{"style":248},[419],{"type":37,"value":339},{"type":32,"tag":205,"props":421,"children":422},{"style":233},[423],{"type":37,"value":424},"(userId);\n",{"type":32,"tag":205,"props":426,"children":427},{"class":207,"line":26},[428,432,437,441,446,451,456,460,465,470,475,480,485],{"type":32,"tag":205,"props":429,"children":430},{"style":222},[431],{"type":37,"value":286},{"type":32,"tag":205,"props":433,"children":434},{"style":289},[435],{"type":37,"value":436}," prefs",{"type":32,"tag":205,"props":438,"children":439},{"style":222},[440],{"type":37,"value":297},{"type":32,"tag":205,"props":442,"children":443},{"style":233},[444],{"type":37,"value":445}," segment ",{"type":32,"tag":205,"props":447,"children":448},{"style":222},[449],{"type":37,"value":450},"?",{"type":32,"tag":205,"props":452,"children":453},{"style":289},[454],{"type":37,"value":455}," JSON",{"type":32,"tag":205,"props":457,"children":458},{"style":233},[459],{"type":37,"value":415},{"type":32,"tag":205,"props":461,"children":462},{"style":248},[463],{"type":37,"value":464},"parse",{"type":32,"tag":205,"props":466,"children":467},{"style":233},[468],{"type":37,"value":469},"(segment) ",{"type":32,"tag":205,"props":471,"children":472},{"style":222},[473],{"type":37,"value":474},":",{"type":32,"tag":205,"props":476,"children":477},{"style":233},[478],{"type":37,"value":479}," { tier: ",{"type":32,"tag":205,"props":481,"children":482},{"style":346},[483],{"type":37,"value":484},"'free'",{"type":32,"tag":205,"props":486,"children":487},{"style":233},[488],{"type":37,"value":489}," };\n",{"type":32,"tag":205,"props":491,"children":493},{"class":207,"line":492},10,[494],{"type":32,"tag":205,"props":495,"children":496},{"emptyLinePlaceholder":366},[497],{"type":37,"value":369},{"type":32,"tag":205,"props":499,"children":501},{"class":207,"line":500},11,[502],{"type":32,"tag":205,"props":503,"children":504},{"style":212},[505],{"type":37,"value":506},"    \u002F\u002F Renderizza HTML personalizzato\n",{"type":32,"tag":205,"props":508,"children":510},{"class":207,"line":509},12,[511,515,520,524,529],{"type":32,"tag":205,"props":512,"children":513},{"style":222},[514],{"type":37,"value":286},{"type":32,"tag":205,"props":516,"children":517},{"style":289},[518],{"type":37,"value":519}," html",{"type":32,"tag":205,"props":521,"children":522},{"style":222},[523],{"type":37,"value":297},{"type":32,"tag":205,"props":525,"children":526},{"style":248},[527],{"type":37,"value":528}," renderHTML",{"type":32,"tag":205,"props":530,"children":531},{"style":233},[532],{"type":37,"value":533},"(prefs, url.pathname);\n",{"type":32,"tag":205,"props":535,"children":537},{"class":207,"line":536},13,[538],{"type":32,"tag":205,"props":539,"children":540},{"emptyLinePlaceholder":366},[541],{"type":37,"value":369},{"type":32,"tag":205,"props":543,"children":545},{"class":207,"line":544},14,[546,551,555,560],{"type":32,"tag":205,"props":547,"children":548},{"style":222},[549],{"type":37,"value":550},"    return",{"type":32,"tag":205,"props":552,"children":553},{"style":222},[554],{"type":37,"value":302},{"type":32,"tag":205,"props":556,"children":557},{"style":248},[558],{"type":37,"value":559}," Response",{"type":32,"tag":205,"props":561,"children":562},{"style":233},[563],{"type":37,"value":564},"(html, {\n",{"type":32,"tag":205,"props":566,"children":568},{"class":207,"line":567},15,[569],{"type":32,"tag":205,"props":570,"children":571},{"style":233},[572],{"type":37,"value":573},"      headers: {\n",{"type":32,"tag":205,"props":575,"children":577},{"class":207,"line":576},16,[578,583,588,593],{"type":32,"tag":205,"props":579,"children":580},{"style":346},[581],{"type":37,"value":582},"        'content-type'",{"type":32,"tag":205,"props":584,"children":585},{"style":233},[586],{"type":37,"value":587},": ",{"type":32,"tag":205,"props":589,"children":590},{"style":346},[591],{"type":37,"value":592},"'text\u002Fhtml;charset=UTF-8'",{"type":32,"tag":205,"props":594,"children":595},{"style":233},[596],{"type":37,"value":597},",\n",{"type":32,"tag":205,"props":599,"children":601},{"class":207,"line":600},17,[602,607,611,616,620],{"type":32,"tag":205,"props":603,"children":604},{"style":346},[605],{"type":37,"value":606},"        'cache-control'",{"type":32,"tag":205,"props":608,"children":609},{"style":233},[610],{"type":37,"value":587},{"type":32,"tag":205,"props":612,"children":613},{"style":346},[614],{"type":37,"value":615},"'public, s-maxage=60'",{"type":32,"tag":205,"props":617,"children":618},{"style":233},[619],{"type":37,"value":267},{"type":32,"tag":205,"props":621,"children":622},{"style":212},[623],{"type":37,"value":624},"\u002F\u002F cache edge 60s\n",{"type":32,"tag":205,"props":626,"children":628},{"class":207,"line":627},18,[629],{"type":32,"tag":205,"props":630,"children":631},{"style":233},[632],{"type":37,"value":633},"      },\n",{"type":32,"tag":205,"props":635,"children":637},{"class":207,"line":636},19,[638],{"type":32,"tag":205,"props":639,"children":640},{"style":233},[641],{"type":37,"value":642},"    });\n",{"type":32,"tag":205,"props":644,"children":646},{"class":207,"line":645},20,[647],{"type":32,"tag":205,"props":648,"children":649},{"style":233},[650],{"type":37,"value":651},"  },\n",{"type":32,"tag":205,"props":653,"children":655},{"class":207,"line":654},21,[656],{"type":32,"tag":205,"props":657,"children":658},{"style":233},[659],{"type":37,"value":660},"};\n",{"type":32,"tag":205,"props":662,"children":664},{"class":207,"line":663},22,[665],{"type":32,"tag":205,"props":666,"children":667},{"emptyLinePlaceholder":366},[668],{"type":37,"value":369},{"type":32,"tag":205,"props":670,"children":672},{"class":207,"line":671},23,[673,678,682,686,691,695,700],{"type":32,"tag":205,"props":674,"children":675},{"style":222},[676],{"type":37,"value":677},"function",{"type":32,"tag":205,"props":679,"children":680},{"style":248},[681],{"type":37,"value":528},{"type":32,"tag":205,"props":683,"children":684},{"style":233},[685],{"type":37,"value":256},{"type":32,"tag":205,"props":687,"children":688},{"style":259},[689],{"type":37,"value":690},"prefs",{"type":32,"tag":205,"props":692,"children":693},{"style":233},[694],{"type":37,"value":267},{"type":32,"tag":205,"props":696,"children":697},{"style":259},[698],{"type":37,"value":699},"path",{"type":32,"tag":205,"props":701,"children":702},{"style":233},[703],{"type":37,"value":277},{"type":32,"tag":205,"props":705,"children":707},{"class":207,"line":706},24,[708,713,718,722,727,732],{"type":32,"tag":205,"props":709,"children":710},{"style":222},[711],{"type":37,"value":712},"  const",{"type":32,"tag":205,"props":714,"children":715},{"style":289},[716],{"type":37,"value":717}," hero",{"type":32,"tag":205,"props":719,"children":720},{"style":222},[721],{"type":37,"value":297},{"type":32,"tag":205,"props":723,"children":724},{"style":233},[725],{"type":37,"value":726}," prefs.tier ",{"type":32,"tag":205,"props":728,"children":729},{"style":222},[730],{"type":37,"value":731},"===",{"type":32,"tag":205,"props":733,"children":734},{"style":346},[735],{"type":37,"value":736}," 'premium'\n",{"type":32,"tag":205,"props":738,"children":740},{"class":207,"line":739},25,[741,746],{"type":32,"tag":205,"props":742,"children":743},{"style":222},[744],{"type":37,"value":745},"    ?",{"type":32,"tag":205,"props":747,"children":748},{"style":346},[749],{"type":37,"value":750}," '\u003Ch1>Contenuto Premium\u003C\u002Fh1>'\n",{"type":32,"tag":205,"props":752,"children":754},{"class":207,"line":753},26,[755,760,765],{"type":32,"tag":205,"props":756,"children":757},{"style":222},[758],{"type":37,"value":759},"    :",{"type":32,"tag":205,"props":761,"children":762},{"style":346},[763],{"type":37,"value":764}," '\u003Ch1>Contenuto Gratuito\u003C\u002Fh1>'",{"type":32,"tag":205,"props":766,"children":767},{"style":233},[768],{"type":37,"value":769},";\n",{"type":32,"tag":205,"props":771,"children":773},{"class":207,"line":772},27,[774,779,784,789,794,798,803],{"type":32,"tag":205,"props":775,"children":776},{"style":222},[777],{"type":37,"value":778},"  return",{"type":32,"tag":205,"props":780,"children":781},{"style":346},[782],{"type":37,"value":783}," `\u003C!DOCTYPE html>\u003Chtml>\u003Cbody>${",{"type":32,"tag":205,"props":785,"children":786},{"style":233},[787],{"type":37,"value":788},"hero",{"type":32,"tag":205,"props":790,"children":791},{"style":346},[792],{"type":37,"value":793},"}\u003Cp>Percorso: ${",{"type":32,"tag":205,"props":795,"children":796},{"style":233},[797],{"type":37,"value":699},{"type":32,"tag":205,"props":799,"children":800},{"style":346},[801],{"type":37,"value":802},"}\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>`",{"type":32,"tag":205,"props":804,"children":805},{"style":233},[806],{"type":37,"value":769},{"type":32,"tag":205,"props":808,"children":810},{"class":207,"line":809},28,[811],{"type":32,"tag":205,"props":812,"children":813},{"style":233},[814],{"type":37,"value":815},"}\n",{"type":32,"tag":33,"props":817,"children":818},{},[819,821,826],{"type":37,"value":820},"A ogni richiesta, il codice recupera il segmento da KV nello spazio dei nomi ",{"type":32,"tag":201,"props":822,"children":824},{"className":823},[],[825],{"type":37,"value":410},{"type":37,"value":827},". La latenza di lettura KV è in media 15ms a livello globale (benchmark Cloudflare 2025). Alternative: Durable Objects, ma per carichi di lavoro ad alta lettura KV è più conveniente (KV: $0,50\u002Fmilione di letture; DO: $0,15\u002Fmilione di richieste + compute).",{"type":32,"tag":33,"props":829,"children":830},{},[831,833,839],{"type":37,"value":832},"Il limite di compute di Workers è 50ms di tempo CPU — rendering complesso può superarlo. Soluzione: pre-renderizza i template come HTML e conservali in KV, il worker sostituisce solo i placeholder. Ad esempio, il worker sostituisce ",{"type":32,"tag":201,"props":834,"children":836},{"className":835},[],[837],{"type":37,"value":838},"{USER_NAME}",{"type":37,"value":840},", il template è conservato in KV.",{"type":32,"tag":40,"props":842,"children":844},{"id":843},"integrazione-middleware-nextjs-con-vercel-edge-functions",[845],{"type":37,"value":846},"Integrazione Middleware Next.js con Vercel Edge Functions",{"type":32,"tag":33,"props":848,"children":849},{},[850,852,858,860,866],{"type":37,"value":851},"Vercel Edge Functions si integra nativamente con Next.js 13+ — puoi usare il pattern middleware per intercettare le richieste e personalizzarle. Nel runtime edge, usi ",{"type":32,"tag":201,"props":853,"children":855},{"className":854},[],[856],{"type":37,"value":857},"middleware.ts",{"type":37,"value":859}," al posto di ",{"type":32,"tag":201,"props":861,"children":863},{"className":862},[],[864],{"type":37,"value":865},"getServerSideProps",{"type":37,"value":474},{"type":32,"tag":194,"props":868,"children":872},{"className":869,"code":870,"language":871,"meta":16,"style":16},"language-typescript shiki shiki-themes github-dark","\u002F\u002F middleware.ts — Vercel Edge\nimport { NextRequest, NextResponse } from 'next\u002Fserver';\n\nexport async function middleware(req: NextRequest) {\n  const userId = req.cookies.get('user_id')?.value;\n  if (!userId) return NextResponse.next();\n\n  \u002F\u002F Recupera il segmento da Edge Config\n  const segment = await fetch(`https:\u002F\u002Fedge-config.vercel.com\u002F${userId}`).then(r => r.json());\n\n  \u002F\u002F Aggiungi info del segmento all'header, il component pagina lo legge\n  const response = NextResponse.next();\n  response.headers.set('x-user-segment', segment.tier);\n  return response;\n}\n\nexport const config = {\n  matcher: ['\u002Fproduct\u002F:path*', '\u002Fcategory\u002F:path*'],\n};\n","typescript",[873],{"type":32,"tag":201,"props":874,"children":875},{"__ignoreMap":16},[876,884,911,918,962,1000,1043,1050,1058,1139,1146,1154,1182,1209,1221,1228,1235,1260,1287],{"type":32,"tag":205,"props":877,"children":878},{"class":207,"line":208},[879],{"type":32,"tag":205,"props":880,"children":881},{"style":212},[882],{"type":37,"value":883},"\u002F\u002F middleware.ts — Vercel Edge\n",{"type":32,"tag":205,"props":885,"children":886},{"class":207,"line":218},[887,892,897,902,907],{"type":32,"tag":205,"props":888,"children":889},{"style":222},[890],{"type":37,"value":891},"import",{"type":32,"tag":205,"props":893,"children":894},{"style":233},[895],{"type":37,"value":896}," { NextRequest, NextResponse } ",{"type":32,"tag":205,"props":898,"children":899},{"style":222},[900],{"type":37,"value":901},"from",{"type":32,"tag":205,"props":903,"children":904},{"style":346},[905],{"type":37,"value":906}," 'next\u002Fserver'",{"type":32,"tag":205,"props":908,"children":909},{"style":233},[910],{"type":37,"value":769},{"type":32,"tag":205,"props":912,"children":913},{"class":207,"line":239},[914],{"type":32,"tag":205,"props":915,"children":916},{"emptyLinePlaceholder":366},[917],{"type":37,"value":369},{"type":32,"tag":205,"props":919,"children":920},{"class":207,"line":280},[921,925,930,935,940,944,949,953,958],{"type":32,"tag":205,"props":922,"children":923},{"style":222},[924],{"type":37,"value":225},{"type":32,"tag":205,"props":926,"children":927},{"style":222},[928],{"type":37,"value":929}," async",{"type":32,"tag":205,"props":931,"children":932},{"style":222},[933],{"type":37,"value":934}," function",{"type":32,"tag":205,"props":936,"children":937},{"style":248},[938],{"type":37,"value":939}," middleware",{"type":32,"tag":205,"props":941,"children":942},{"style":233},[943],{"type":37,"value":256},{"type":32,"tag":205,"props":945,"children":946},{"style":259},[947],{"type":37,"value":948},"req",{"type":32,"tag":205,"props":950,"children":951},{"style":222},[952],{"type":37,"value":474},{"type":32,"tag":205,"props":954,"children":955},{"style":248},[956],{"type":37,"value":957}," NextRequest",{"type":32,"tag":205,"props":959,"children":960},{"style":233},[961],{"type":37,"value":277},{"type":32,"tag":205,"props":963,"children":964},{"class":207,"line":315},[965,969,973,977,982,986,990,995],{"type":32,"tag":205,"props":966,"children":967},{"style":222},[968],{"type":37,"value":712},{"type":32,"tag":205,"props":970,"children":971},{"style":289},[972],{"type":37,"value":325},{"type":32,"tag":205,"props":974,"children":975},{"style":222},[976],{"type":37,"value":297},{"type":32,"tag":205,"props":978,"children":979},{"style":233},[980],{"type":37,"value":981}," req.cookies.",{"type":32,"tag":205,"props":983,"children":984},{"style":248},[985],{"type":37,"value":339},{"type":32,"tag":205,"props":987,"children":988},{"style":233},[989],{"type":37,"value":256},{"type":32,"tag":205,"props":991,"children":992},{"style":346},[993],{"type":37,"value":994},"'user_id'",{"type":32,"tag":205,"props":996,"children":997},{"style":233},[998],{"type":37,"value":999},")?.value;\n",{"type":32,"tag":205,"props":1001,"children":1002},{"class":207,"line":362},[1003,1008,1013,1018,1023,1028,1033,1038],{"type":32,"tag":205,"props":1004,"children":1005},{"style":222},[1006],{"type":37,"value":1007},"  if",{"type":32,"tag":205,"props":1009,"children":1010},{"style":233},[1011],{"type":37,"value":1012}," (",{"type":32,"tag":205,"props":1014,"children":1015},{"style":222},[1016],{"type":37,"value":1017},"!",{"type":32,"tag":205,"props":1019,"children":1020},{"style":233},[1021],{"type":37,"value":1022},"userId) ",{"type":32,"tag":205,"props":1024,"children":1025},{"style":222},[1026],{"type":37,"value":1027},"return",{"type":32,"tag":205,"props":1029,"children":1030},{"style":233},[1031],{"type":37,"value":1032}," NextResponse.",{"type":32,"tag":205,"props":1034,"children":1035},{"style":248},[1036],{"type":37,"value":1037},"next",{"type":32,"tag":205,"props":1039,"children":1040},{"style":233},[1041],{"type":37,"value":1042},"();\n",{"type":32,"tag":205,"props":1044,"children":1045},{"class":207,"line":372},[1046],{"type":32,"tag":205,"props":1047,"children":1048},{"emptyLinePlaceholder":366},[1049],{"type":37,"value":369},{"type":32,"tag":205,"props":1051,"children":1052},{"class":207,"line":381},[1053],{"type":32,"tag":205,"props":1054,"children":1055},{"style":212},[1056],{"type":37,"value":1057},"  \u002F\u002F Recupera il segmento da Edge Config\n",{"type":32,"tag":205,"props":1059,"children":1060},{"class":207,"line":26},[1061,1065,1069,1073,1077,1081,1085,1090,1095,1100,1105,1110,1114,1119,1124,1129,1134],{"type":32,"tag":205,"props":1062,"children":1063},{"style":222},[1064],{"type":37,"value":712},{"type":32,"tag":205,"props":1066,"children":1067},{"style":289},[1068],{"type":37,"value":391},{"type":32,"tag":205,"props":1070,"children":1071},{"style":222},[1072],{"type":37,"value":297},{"type":32,"tag":205,"props":1074,"children":1075},{"style":222},[1076],{"type":37,"value":400},{"type":32,"tag":205,"props":1078,"children":1079},{"style":248},[1080],{"type":37,"value":251},{"type":32,"tag":205,"props":1082,"children":1083},{"style":233},[1084],{"type":37,"value":256},{"type":32,"tag":205,"props":1086,"children":1087},{"style":346},[1088],{"type":37,"value":1089},"`https:\u002F\u002Fedge-config.vercel.com\u002F${",{"type":32,"tag":205,"props":1091,"children":1092},{"style":233},[1093],{"type":37,"value":1094},"userId",{"type":32,"tag":205,"props":1096,"children":1097},{"style":346},[1098],{"type":37,"value":1099},"}`",{"type":32,"tag":205,"props":1101,"children":1102},{"style":233},[1103],{"type":37,"value":1104},").",{"type":32,"tag":205,"props":1106,"children":1107},{"style":248},[1108],{"type":37,"value":1109},"then",{"type":32,"tag":205,"props":1111,"children":1112},{"style":233},[1113],{"type":37,"value":256},{"type":32,"tag":205,"props":1115,"children":1116},{"style":259},[1117],{"type":37,"value":1118},"r",{"type":32,"tag":205,"props":1120,"children":1121},{"style":222},[1122],{"type":37,"value":1123}," =>",{"type":32,"tag":205,"props":1125,"children":1126},{"style":233},[1127],{"type":37,"value":1128}," r.",{"type":32,"tag":205,"props":1130,"children":1131},{"style":248},[1132],{"type":37,"value":1133},"json",{"type":32,"tag":205,"props":1135,"children":1136},{"style":233},[1137],{"type":37,"value":1138},"());\n",{"type":32,"tag":205,"props":1140,"children":1141},{"class":207,"line":492},[1142],{"type":32,"tag":205,"props":1143,"children":1144},{"emptyLinePlaceholder":366},[1145],{"type":37,"value":369},{"type":32,"tag":205,"props":1147,"children":1148},{"class":207,"line":500},[1149],{"type":32,"tag":205,"props":1150,"children":1151},{"style":212},[1152],{"type":37,"value":1153},"  \u002F\u002F Aggiungi info del segmento all'header, il component pagina lo legge\n",{"type":32,"tag":205,"props":1155,"children":1156},{"class":207,"line":509},[1157,1161,1166,1170,1174,1178],{"type":32,"tag":205,"props":1158,"children":1159},{"style":222},[1160],{"type":37,"value":712},{"type":32,"tag":205,"props":1162,"children":1163},{"style":289},[1164],{"type":37,"value":1165}," response",{"type":32,"tag":205,"props":1167,"children":1168},{"style":222},[1169],{"type":37,"value":297},{"type":32,"tag":205,"props":1171,"children":1172},{"style":233},[1173],{"type":37,"value":1032},{"type":32,"tag":205,"props":1175,"children":1176},{"style":248},[1177],{"type":37,"value":1037},{"type":32,"tag":205,"props":1179,"children":1180},{"style":233},[1181],{"type":37,"value":1042},{"type":32,"tag":205,"props":1183,"children":1184},{"class":207,"line":536},[1185,1190,1195,1199,1204],{"type":32,"tag":205,"props":1186,"children":1187},{"style":233},[1188],{"type":37,"value":1189},"  response.headers.",{"type":32,"tag":205,"props":1191,"children":1192},{"style":248},[1193],{"type":37,"value":1194},"set",{"type":32,"tag":205,"props":1196,"children":1197},{"style":233},[1198],{"type":37,"value":256},{"type":32,"tag":205,"props":1200,"children":1201},{"style":346},[1202],{"type":37,"value":1203},"'x-user-segment'",{"type":32,"tag":205,"props":1205,"children":1206},{"style":233},[1207],{"type":37,"value":1208},", segment.tier);\n",{"type":32,"tag":205,"props":1210,"children":1211},{"class":207,"line":544},[1212,1216],{"type":32,"tag":205,"props":1213,"children":1214},{"style":222},[1215],{"type":37,"value":778},{"type":32,"tag":205,"props":1217,"children":1218},{"style":233},[1219],{"type":37,"value":1220}," response;\n",{"type":32,"tag":205,"props":1222,"children":1223},{"class":207,"line":567},[1224],{"type":32,"tag":205,"props":1225,"children":1226},{"style":233},[1227],{"type":37,"value":815},{"type":32,"tag":205,"props":1229,"children":1230},{"class":207,"line":576},[1231],{"type":32,"tag":205,"props":1232,"children":1233},{"emptyLinePlaceholder":366},[1234],{"type":37,"value":369},{"type":32,"tag":205,"props":1236,"children":1237},{"class":207,"line":600},[1238,1242,1247,1252,1256],{"type":32,"tag":205,"props":1239,"children":1240},{"style":222},[1241],{"type":37,"value":225},{"type":32,"tag":205,"props":1243,"children":1244},{"style":222},[1245],{"type":37,"value":1246}," const",{"type":32,"tag":205,"props":1248,"children":1249},{"style":289},[1250],{"type":37,"value":1251}," config",{"type":32,"tag":205,"props":1253,"children":1254},{"style":222},[1255],{"type":37,"value":297},{"type":32,"tag":205,"props":1257,"children":1258},{"style":233},[1259],{"type":37,"value":236},{"type":32,"tag":205,"props":1261,"children":1262},{"class":207,"line":627},[1263,1268,1273,1277,1282],{"type":32,"tag":205,"props":1264,"children":1265},{"style":233},[1266],{"type":37,"value":1267},"  matcher: [",{"type":32,"tag":205,"props":1269,"children":1270},{"style":346},[1271],{"type":37,"value":1272},"'\u002Fproduct\u002F:path*'",{"type":32,"tag":205,"props":1274,"children":1275},{"style":233},[1276],{"type":37,"value":267},{"type":32,"tag":205,"props":1278,"children":1279},{"style":346},[1280],{"type":37,"value":1281},"'\u002Fcategory\u002F:path*'",{"type":32,"tag":205,"props":1283,"children":1284},{"style":233},[1285],{"type":37,"value":1286},"],\n",{"type":32,"tag":205,"props":1288,"children":1289},{"class":207,"line":636},[1290],{"type":32,"tag":205,"props":1291,"children":1292},{"style":233},[1293],{"type":37,"value":660},{"type":32,"tag":33,"props":1295,"children":1296},{},[1297,1299,1308],{"type":37,"value":1298},"Questo approccio funziona bene in architetture ",{"type":32,"tag":1300,"props":1301,"children":1305},"a",{"href":1302,"rel":1303},"https:\u002F\u002Fwww.roibase.com.tr\u002Fit\u002Fheadless",[1304],"nofollow",[1306],{"type":37,"value":1307},"headless commerce",{"type":37,"value":1309}," quando personalizzi pagine di listing prodotti. Ad esempio, mostra un ordinamento diverso ai clienti premium. Il component pagina legge:",{"type":32,"tag":194,"props":1311,"children":1315},{"className":1312,"code":1313,"language":1314,"meta":16,"style":16},"language-tsx shiki shiki-themes github-dark","\u002F\u002F app\u002Fproduct\u002F[id]\u002Fpage.tsx\nexport default async function ProductPage({ params, headers }) {\n  const segment = headers.get('x-user-segment');\n  const products = await fetchProducts(params.id, segment);\n  return \u003CProductList items={products} \u002F>;\n}\n","tsx",[1316],{"type":32,"tag":201,"props":1317,"children":1318},{"__ignoreMap":16},[1319,1327,1375,1412,1442,1474],{"type":32,"tag":205,"props":1320,"children":1321},{"class":207,"line":208},[1322],{"type":32,"tag":205,"props":1323,"children":1324},{"style":212},[1325],{"type":37,"value":1326},"\u002F\u002F app\u002Fproduct\u002F[id]\u002Fpage.tsx\n",{"type":32,"tag":205,"props":1328,"children":1329},{"class":207,"line":218},[1330,1334,1338,1342,1346,1351,1356,1361,1365,1370],{"type":32,"tag":205,"props":1331,"children":1332},{"style":222},[1333],{"type":37,"value":225},{"type":32,"tag":205,"props":1335,"children":1336},{"style":222},[1337],{"type":37,"value":230},{"type":32,"tag":205,"props":1339,"children":1340},{"style":222},[1341],{"type":37,"value":929},{"type":32,"tag":205,"props":1343,"children":1344},{"style":222},[1345],{"type":37,"value":934},{"type":32,"tag":205,"props":1347,"children":1348},{"style":248},[1349],{"type":37,"value":1350}," ProductPage",{"type":32,"tag":205,"props":1352,"children":1353},{"style":233},[1354],{"type":37,"value":1355},"({ ",{"type":32,"tag":205,"props":1357,"children":1358},{"style":259},[1359],{"type":37,"value":1360},"params",{"type":32,"tag":205,"props":1362,"children":1363},{"style":233},[1364],{"type":37,"value":267},{"type":32,"tag":205,"props":1366,"children":1367},{"style":259},[1368],{"type":37,"value":1369},"headers",{"type":32,"tag":205,"props":1371,"children":1372},{"style":233},[1373],{"type":37,"value":1374}," }) {\n",{"type":32,"tag":205,"props":1376,"children":1377},{"class":207,"line":239},[1378,1382,1386,1390,1395,1399,1403,1407],{"type":32,"tag":205,"props":1379,"children":1380},{"style":222},[1381],{"type":37,"value":712},{"type":32,"tag":205,"props":1383,"children":1384},{"style":289},[1385],{"type":37,"value":391},{"type":32,"tag":205,"props":1387,"children":1388},{"style":222},[1389],{"type":37,"value":297},{"type":32,"tag":205,"props":1391,"children":1392},{"style":233},[1393],{"type":37,"value":1394}," headers.",{"type":32,"tag":205,"props":1396,"children":1397},{"style":248},[1398],{"type":37,"value":339},{"type":32,"tag":205,"props":1400,"children":1401},{"style":233},[1402],{"type":37,"value":256},{"type":32,"tag":205,"props":1404,"children":1405},{"style":346},[1406],{"type":37,"value":1203},{"type":32,"tag":205,"props":1408,"children":1409},{"style":233},[1410],{"type":37,"value":1411},");\n",{"type":32,"tag":205,"props":1413,"children":1414},{"class":207,"line":280},[1415,1419,1424,1428,1432,1437],{"type":32,"tag":205,"props":1416,"children":1417},{"style":222},[1418],{"type":37,"value":712},{"type":32,"tag":205,"props":1420,"children":1421},{"style":289},[1422],{"type":37,"value":1423}," products",{"type":32,"tag":205,"props":1425,"children":1426},{"style":222},[1427],{"type":37,"value":297},{"type":32,"tag":205,"props":1429,"children":1430},{"style":222},[1431],{"type":37,"value":400},{"type":32,"tag":205,"props":1433,"children":1434},{"style":248},[1435],{"type":37,"value":1436}," fetchProducts",{"type":32,"tag":205,"props":1438,"children":1439},{"style":233},[1440],{"type":37,"value":1441},"(params.id, segment);\n",{"type":32,"tag":205,"props":1443,"children":1444},{"class":207,"line":315},[1445,1449,1454,1459,1464,1469],{"type":32,"tag":205,"props":1446,"children":1447},{"style":222},[1448],{"type":37,"value":778},{"type":32,"tag":205,"props":1450,"children":1451},{"style":233},[1452],{"type":37,"value":1453}," \u003C",{"type":32,"tag":205,"props":1455,"children":1456},{"style":289},[1457],{"type":37,"value":1458},"ProductList",{"type":32,"tag":205,"props":1460,"children":1461},{"style":248},[1462],{"type":37,"value":1463}," items",{"type":32,"tag":205,"props":1465,"children":1466},{"style":222},[1467],{"type":37,"value":1468},"=",{"type":32,"tag":205,"props":1470,"children":1471},{"style":233},[1472],{"type":37,"value":1473},"{products} \u002F>;\n",{"type":32,"tag":205,"props":1475,"children":1476},{"class":207,"line":362},[1477],{"type":32,"tag":205,"props":1478,"children":1479},{"style":233},[1480],{"type":37,"value":815},{"type":32,"tag":33,"props":1482,"children":1483},{},[1484],{"type":37,"value":1485},"La replicazione globale di Vercel Edge Config si completa entro 150ms — l'aggiornamento di KV si propaga ai location edge in questo intervallo. Trade-off: leggermente più lenta di Cloudflare KV del 20% ma più integrata nell'ecosistema Next.js.",{"type":32,"tag":182,"props":1487,"children":1489},{"id":1488},"architettura-kv-store-strategia-di-segmentazione",[1490],{"type":37,"value":1491},"Architettura KV Store: strategia di segmentazione",{"type":32,"tag":33,"props":1493,"children":1494},{},[1495],{"type":37,"value":1496},"I dati di personalizzazione nel KV si organizzano in 3 livelli:",{"type":32,"tag":1498,"props":1499,"children":1500},"ol",{},[1501,1526,1548],{"type":32,"tag":1502,"props":1503,"children":1504},"li",{},[1505,1510,1512,1518,1520],{"type":32,"tag":150,"props":1506,"children":1507},{},[1508],{"type":37,"value":1509},"Segmento utente:",{"type":37,"value":1511}," ",{"type":32,"tag":201,"props":1513,"children":1515},{"className":1514},[],[1516],{"type":37,"value":1517},"USER_SEGMENTS:{userId}",{"type":37,"value":1519}," → ",{"type":32,"tag":201,"props":1521,"children":1523},{"className":1522},[],[1524],{"type":37,"value":1525},"{\"tier\":\"premium\",\"region\":\"EU\"}",{"type":32,"tag":1502,"props":1527,"children":1528},{},[1529,1534,1535,1541,1542],{"type":32,"tag":150,"props":1530,"children":1531},{},[1532],{"type":37,"value":1533},"Configurazione segmento:",{"type":37,"value":1511},{"type":32,"tag":201,"props":1536,"children":1538},{"className":1537},[],[1539],{"type":37,"value":1540},"SEGMENT_CONFIG:{tier}",{"type":37,"value":1519},{"type":32,"tag":201,"props":1543,"children":1545},{"className":1544},[],[1546],{"type":37,"value":1547},"{\"discount\":0.2,\"hero\":\"premium.jpg\"}",{"type":32,"tag":1502,"props":1549,"children":1550},{},[1551,1556,1557,1563],{"type":32,"tag":150,"props":1552,"children":1553},{},[1554],{"type":37,"value":1555},"Template pagina:",{"type":37,"value":1511},{"type":32,"tag":201,"props":1558,"children":1560},{"className":1559},[],[1561],{"type":37,"value":1562},"PAGE_TPL:{page}:{tier}",{"type":37,"value":1564}," → frammento HTML pre-renderizzato",{"type":32,"tag":33,"props":1566,"children":1567},{},[1568,1570,1575],{"type":37,"value":1569},"Questa struttura significa che quando il segmento cambia, solo ",{"type":32,"tag":201,"props":1571,"children":1573},{"className":1572},[],[1574],{"type":37,"value":410},{"type":37,"value":1576}," si aggiorna — i template rimangono cached. Per 1 milione di utenti, il costo KV è: 1M utenti × 1 lettura\u002Frichiesta × $0,50\u002Fmilione = $0,0000005 per richiesta. Una query DB sull'origin costa 100 volte di più.",{"type":32,"tag":33,"props":1578,"children":1579},{},[1580],{"type":37,"value":1581},"Strategia TTL in KV:",{"type":32,"tag":194,"props":1583,"children":1585},{"className":196,"code":1584,"language":198,"meta":16,"style":16},"\u002F\u002F Il segmento rimane in cache 24 ore\nawait env.USER_SEGMENTS.put(userId, JSON.stringify(segment), {\n  expirationTtl: 86400,\n});\n\n\u002F\u002F La config rimane in cache 1 ora (potrebbe cambiare frequentemente)\nawait env.SEGMENT_CONFIG.put(tier, JSON.stringify(config), {\n  expirationTtl: 3600,\n});\n",[1586],{"type":32,"tag":201,"props":1587,"children":1588},{"__ignoreMap":16},[1589,1597,1646,1663,1671,1678,1686,1732,1748],{"type":32,"tag":205,"props":1590,"children":1591},{"class":207,"line":208},[1592],{"type":32,"tag":205,"props":1593,"children":1594},{"style":212},[1595],{"type":37,"value":1596},"\u002F\u002F Il segmento rimane in cache 24 ore\n",{"type":32,"tag":205,"props":1598,"children":1599},{"class":207,"line":218},[1600,1605,1609,1613,1617,1622,1627,1632,1636,1641],{"type":32,"tag":205,"props":1601,"children":1602},{"style":222},[1603],{"type":37,"value":1604},"await",{"type":32,"tag":205,"props":1606,"children":1607},{"style":233},[1608],{"type":37,"value":405},{"type":32,"tag":205,"props":1610,"children":1611},{"style":289},[1612],{"type":37,"value":410},{"type":32,"tag":205,"props":1614,"children":1615},{"style":233},[1616],{"type":37,"value":415},{"type":32,"tag":205,"props":1618,"children":1619},{"style":248},[1620],{"type":37,"value":1621},"put",{"type":32,"tag":205,"props":1623,"children":1624},{"style":233},[1625],{"type":37,"value":1626},"(userId, ",{"type":32,"tag":205,"props":1628,"children":1629},{"style":289},[1630],{"type":37,"value":1631},"JSON",{"type":32,"tag":205,"props":1633,"children":1634},{"style":233},[1635],{"type":37,"value":415},{"type":32,"tag":205,"props":1637,"children":1638},{"style":248},[1639],{"type":37,"value":1640},"stringify",{"type":32,"tag":205,"props":1642,"children":1643},{"style":233},[1644],{"type":37,"value":1645},"(segment), {\n",{"type":32,"tag":205,"props":1647,"children":1648},{"class":207,"line":239},[1649,1654,1659],{"type":32,"tag":205,"props":1650,"children":1651},{"style":233},[1652],{"type":37,"value":1653},"  expirationTtl: ",{"type":32,"tag":205,"props":1655,"children":1656},{"style":289},[1657],{"type":37,"value":1658},"86400",{"type":32,"tag":205,"props":1660,"children":1661},{"style":233},[1662],{"type":37,"value":597},{"type":32,"tag":205,"props":1664,"children":1665},{"class":207,"line":280},[1666],{"type":32,"tag":205,"props":1667,"children":1668},{"style":233},[1669],{"type":37,"value":1670},"});\n",{"type":32,"tag":205,"props":1672,"children":1673},{"class":207,"line":315},[1674],{"type":32,"tag":205,"props":1675,"children":1676},{"emptyLinePlaceholder":366},[1677],{"type":37,"value":369},{"type":32,"tag":205,"props":1679,"children":1680},{"class":207,"line":362},[1681],{"type":32,"tag":205,"props":1682,"children":1683},{"style":212},[1684],{"type":37,"value":1685},"\u002F\u002F La config rimane in cache 1 ora (potrebbe cambiare frequentemente)\n",{"type":32,"tag":205,"props":1687,"children":1688},{"class":207,"line":372},[1689,1693,1697,1702,1706,1710,1715,1719,1723,1727],{"type":32,"tag":205,"props":1690,"children":1691},{"style":222},[1692],{"type":37,"value":1604},{"type":32,"tag":205,"props":1694,"children":1695},{"style":233},[1696],{"type":37,"value":405},{"type":32,"tag":205,"props":1698,"children":1699},{"style":289},[1700],{"type":37,"value":1701},"SEGMENT_CONFIG",{"type":32,"tag":205,"props":1703,"children":1704},{"style":233},[1705],{"type":37,"value":415},{"type":32,"tag":205,"props":1707,"children":1708},{"style":248},[1709],{"type":37,"value":1621},{"type":32,"tag":205,"props":1711,"children":1712},{"style":233},[1713],{"type":37,"value":1714},"(tier, ",{"type":32,"tag":205,"props":1716,"children":1717},{"style":289},[1718],{"type":37,"value":1631},{"type":32,"tag":205,"props":1720,"children":1721},{"style":233},[1722],{"type":37,"value":415},{"type":32,"tag":205,"props":1724,"children":1725},{"style":248},[1726],{"type":37,"value":1640},{"type":32,"tag":205,"props":1728,"children":1729},{"style":233},[1730],{"type":37,"value":1731},"(config), {\n",{"type":32,"tag":205,"props":1733,"children":1734},{"class":207,"line":381},[1735,1739,1744],{"type":32,"tag":205,"props":1736,"children":1737},{"style":233},[1738],{"type":37,"value":1653},{"type":32,"tag":205,"props":1740,"children":1741},{"style":289},[1742],{"type":37,"value":1743},"3600",{"type":32,"tag":205,"props":1745,"children":1746},{"style":233},[1747],{"type":37,"value":597},{"type":32,"tag":205,"props":1749,"children":1750},{"class":207,"line":26},[1751],{"type":32,"tag":205,"props":1752,"children":1753},{"style":233},[1754],{"type":37,"value":1670},{"type":32,"tag":33,"props":1756,"children":1757},{},[1758],{"type":37,"value":1759},"Invalidazione: quando un utente esegue l'upgrade, invia un segnale via WebSocket o webhook al worker e aggiorna il KV. Non è real-time — accetta consistenza eventuale (1-5 minuti di ritardo).",{"type":32,"tag":40,"props":1761,"children":1763},{"id":1762},"trade-off-nel-rendering-static-vs-edge-ssr",[1764],{"type":37,"value":1765},"Trade-off nel rendering: Static vs Edge SSR",{"type":32,"tag":33,"props":1767,"children":1768},{},[1769],{"type":37,"value":1770},"Edge SSR non è sempre la soluzione migliore. Confronto:",{"type":32,"tag":57,"props":1772,"children":1773},{},[1774,1798],{"type":32,"tag":61,"props":1775,"children":1776},{},[1777],{"type":32,"tag":65,"props":1778,"children":1779},{},[1780,1785,1790,1794],{"type":32,"tag":69,"props":1781,"children":1782},{},[1783],{"type":37,"value":1784},"Metrica",{"type":32,"tag":69,"props":1786,"children":1787},{},[1788],{"type":37,"value":1789},"Static (ISR)",{"type":32,"tag":69,"props":1791,"children":1792},{},[1793],{"type":37,"value":83},{"type":32,"tag":69,"props":1795,"children":1796},{},[1797],{"type":37,"value":78},{"type":32,"tag":85,"props":1799,"children":1800},{},[1801,1822,1844,1867,1890],{"type":32,"tag":65,"props":1802,"children":1803},{},[1804,1809,1814,1818],{"type":32,"tag":92,"props":1805,"children":1806},{},[1807],{"type":37,"value":1808},"TTFB",{"type":32,"tag":92,"props":1810,"children":1811},{},[1812],{"type":37,"value":1813},"20ms",{"type":32,"tag":92,"props":1815,"children":1816},{},[1817],{"type":37,"value":170},{"type":32,"tag":92,"props":1819,"children":1820},{},[1821],{"type":37,"value":162},{"type":32,"tag":65,"props":1823,"children":1824},{},[1825,1830,1835,1840],{"type":32,"tag":92,"props":1826,"children":1827},{},[1828],{"type":37,"value":1829},"Personalizzazione",{"type":32,"tag":92,"props":1831,"children":1832},{},[1833],{"type":37,"value":1834},"Nessuna",{"type":32,"tag":92,"props":1836,"children":1837},{},[1838],{"type":37,"value":1839},"Sì",{"type":32,"tag":92,"props":1841,"children":1842},{},[1843],{"type":37,"value":1839},{"type":32,"tag":65,"props":1845,"children":1846},{},[1847,1852,1857,1862],{"type":32,"tag":92,"props":1848,"children":1849},{},[1850],{"type":37,"value":1851},"Cache hit ratio",{"type":32,"tag":92,"props":1853,"children":1854},{},[1855],{"type":37,"value":1856},"99%",{"type":32,"tag":92,"props":1858,"children":1859},{},[1860],{"type":37,"value":1861},"60%",{"type":32,"tag":92,"props":1863,"children":1864},{},[1865],{"type":37,"value":1866},"10%",{"type":32,"tag":65,"props":1868,"children":1869},{},[1870,1875,1880,1885],{"type":32,"tag":92,"props":1871,"children":1872},{},[1873],{"type":37,"value":1874},"Costo (1M req)",{"type":32,"tag":92,"props":1876,"children":1877},{},[1878],{"type":37,"value":1879},"$0,20",{"type":32,"tag":92,"props":1881,"children":1882},{},[1883],{"type":37,"value":1884},"$2,50",{"type":32,"tag":92,"props":1886,"children":1887},{},[1888],{"type":37,"value":1889},"$15",{"type":32,"tag":65,"props":1891,"children":1892},{},[1893,1898,1903,1908],{"type":32,"tag":92,"props":1894,"children":1895},{},[1896],{"type":37,"value":1897},"Complessità",{"type":32,"tag":92,"props":1899,"children":1900},{},[1901],{"type":37,"value":1902},"Bassa",{"type":32,"tag":92,"props":1904,"children":1905},{},[1906],{"type":37,"value":1907},"Media",{"type":32,"tag":92,"props":1909,"children":1910},{},[1911],{"type":37,"value":1912},"Alta",{"type":32,"tag":33,"props":1914,"children":1915},{},[1916],{"type":37,"value":1917},"ISR raggiunge un cache hit ratio del 99% ma senza personalizzazione. Edge SSR frammenta il cache in base al segmento — ogni segmento è una cache key separata, quindi il hit ratio scende.",{"type":32,"tag":33,"props":1919,"children":1920},{},[1921],{"type":37,"value":1922},"Approccio ibrido: il layout principale è static, i componenti personalizzati vengono renderizzati in edge e iniettati client-side. Esempio: la griglia di prodotti è static, \"Consigliati per te\" arrivano via Edge SSR:",{"type":32,"tag":194,"props":1924,"children":1926},{"className":196,"code":1925,"language":198,"meta":16,"style":16},"\u002F\u002F Ibrido: HTML statico + sezione personalizzata iniettata da edge\nconst staticHTML = await env.STATIC_PAGES.get(pathname);\nconst personalizedSection = await renderPersonalizedRecommendations(userId);\nconst finalHTML = staticHTML.replace('\u003C!--INJECT-->', personalizedSection);\n",[1927],{"type":32,"tag":201,"props":1928,"children":1929},{"__ignoreMap":16},[1930,1938,1981,2010],{"type":32,"tag":205,"props":1931,"children":1932},{"class":207,"line":208},[1933],{"type":32,"tag":205,"props":1934,"children":1935},{"style":212},[1936],{"type":37,"value":1937},"\u002F\u002F Ibrido: HTML statico + sezione personalizzata iniettata da edge\n",{"type":32,"tag":205,"props":1939,"children":1940},{"class":207,"line":218},[1941,1946,1951,1955,1959,1963,1968,1972,1976],{"type":32,"tag":205,"props":1942,"children":1943},{"style":222},[1944],{"type":37,"value":1945},"const",{"type":32,"tag":205,"props":1947,"children":1948},{"style":289},[1949],{"type":37,"value":1950}," staticHTML",{"type":32,"tag":205,"props":1952,"children":1953},{"style":222},[1954],{"type":37,"value":297},{"type":32,"tag":205,"props":1956,"children":1957},{"style":222},[1958],{"type":37,"value":400},{"type":32,"tag":205,"props":1960,"children":1961},{"style":233},[1962],{"type":37,"value":405},{"type":32,"tag":205,"props":1964,"children":1965},{"style":289},[1966],{"type":37,"value":1967},"STATIC_PAGES",{"type":32,"tag":205,"props":1969,"children":1970},{"style":233},[1971],{"type":37,"value":415},{"type":32,"tag":205,"props":1973,"children":1974},{"style":248},[1975],{"type":37,"value":339},{"type":32,"tag":205,"props":1977,"children":1978},{"style":233},[1979],{"type":37,"value":1980},"(pathname);\n",{"type":32,"tag":205,"props":1982,"children":1983},{"class":207,"line":239},[1984,1988,1993,1997,2001,2006],{"type":32,"tag":205,"props":1985,"children":1986},{"style":222},[1987],{"type":37,"value":1945},{"type":32,"tag":205,"props":1989,"children":1990},{"style":289},[1991],{"type":37,"value":1992}," personalizedSection",{"type":32,"tag":205,"props":1994,"children":1995},{"style":222},[1996],{"type":37,"value":297},{"type":32,"tag":205,"props":1998,"children":1999},{"style":222},[2000],{"type":37,"value":400},{"type":32,"tag":205,"props":2002,"children":2003},{"style":248},[2004],{"type":37,"value":2005}," renderPersonalizedRecommendations",{"type":32,"tag":205,"props":2007,"children":2008},{"style":233},[2009],{"type":37,"value":424},{"type":32,"tag":205,"props":2011,"children":2012},{"class":207,"line":280},[2013,2017,2022,2026,2031,2036,2040,2045],{"type":32,"tag":205,"props":2014,"children":2015},{"style":222},[2016],{"type":37,"value":1945},{"type":32,"tag":205,"props":2018,"children":2019},{"style":289},[2020],{"type":37,"value":2021}," finalHTML",{"type":32,"tag":205,"props":2023,"children":2024},{"style":222},[2025],{"type":37,"value":297},{"type":32,"tag":205,"props":2027,"children":2028},{"style":233},[2029],{"type":37,"value":2030}," staticHTML.",{"type":32,"tag":205,"props":2032,"children":2033},{"style":248},[2034],{"type":37,"value":2035},"replace",{"type":32,"tag":205,"props":2037,"children":2038},{"style":233},[2039],{"type":37,"value":256},{"type":32,"tag":205,"props":2041,"children":2042},{"style":346},[2043],{"type":37,"value":2044},"'\u003C!--INJECT-->'",{"type":32,"tag":205,"props":2046,"children":2047},{"style":233},[2048],{"type":37,"value":2049},", personalizedSection);\n",{"type":32,"tag":33,"props":2051,"children":2052},{},[2053],{"type":37,"value":2054},"Questo metodo mantiene TTFB a 30ms e offre comunque personalizzazione.",{"type":32,"tag":40,"props":2056,"children":2058},{"id":2057},"debug-e-monitoraggio-limiti-del-runtime-edge",[2059],{"type":37,"value":2060},"Debug e monitoraggio: limiti del runtime edge",{"type":32,"tag":33,"props":2062,"children":2063},{},[2064],{"type":37,"value":2065},"Nel runtime edge su production, il debug è difficile — i log sono sparsi, lo stack trace incompleto. Su Cloudflare Workers, usa Tail Workers per creare uno stream di log in real-time:",{"type":32,"tag":194,"props":2067,"children":2069},{"className":196,"code":2068,"language":198,"meta":16,"style":16},"\u002F\u002F tail-worker.js\nexport default {\n  async tail(events) {\n    for (const event of events) {\n      console.log(JSON.stringify({\n        timestamp: event.timestamp,\n        outcome: event.outcome,\n        logs: event.logs,\n      }));\n    }\n  },\n};\n",[2070],{"type":32,"tag":201,"props":2071,"children":2072},{"__ignoreMap":16},[2073,2081,2096,2121,2152,2186,2194,2202,2210,2218,2226,2233],{"type":32,"tag":205,"props":2074,"children":2075},{"class":207,"line":208},[2076],{"type":32,"tag":205,"props":2077,"children":2078},{"style":212},[2079],{"type":37,"value":2080},"\u002F\u002F tail-worker.js\n",{"type":32,"tag":205,"props":2082,"children":2083},{"class":207,"line":218},[2084,2088,2092],{"type":32,"tag":205,"props":2085,"children":2086},{"style":222},[2087],{"type":37,"value":225},{"type":32,"tag":205,"props":2089,"children":2090},{"style":222},[2091],{"type":37,"value":230},{"type":32,"tag":205,"props":2093,"children":2094},{"style":233},[2095],{"type":37,"value":236},{"type":32,"tag":205,"props":2097,"children":2098},{"class":207,"line":239},[2099,2103,2108,2112,2117],{"type":32,"tag":205,"props":2100,"children":2101},{"style":222},[2102],{"type":37,"value":245},{"type":32,"tag":205,"props":2104,"children":2105},{"style":248},[2106],{"type":37,"value":2107}," tail",{"type":32,"tag":205,"props":2109,"children":2110},{"style":233},[2111],{"type":37,"value":256},{"type":32,"tag":205,"props":2113,"children":2114},{"style":259},[2115],{"type":37,"value":2116},"events",{"type":32,"tag":205,"props":2118,"children":2119},{"style":233},[2120],{"type":37,"value":277},{"type":32,"tag":205,"props":2122,"children":2123},{"class":207,"line":280},[2124,2129,2133,2137,2142,2147],{"type":32,"tag":205,"props":2125,"children":2126},{"style":222},[2127],{"type":37,"value":2128},"    for",{"type":32,"tag":205,"props":2130,"children":2131},{"style":233},[2132],{"type":37,"value":1012},{"type":32,"tag":205,"props":2134,"children":2135},{"style":222},[2136],{"type":37,"value":1945},{"type":32,"tag":205,"props":2138,"children":2139},{"style":289},[2140],{"type":37,"value":2141}," event",{"type":32,"tag":205,"props":2143,"children":2144},{"style":222},[2145],{"type":37,"value":2146}," of",{"type":32,"tag":205,"props":2148,"children":2149},{"style":233},[2150],{"type":37,"value":2151}," events) {\n",{"type":32,"tag":205,"props":2153,"children":2154},{"class":207,"line":315},[2155,2160,2165,2169,2173,2177,2181],{"type":32,"tag":205,"props":2156,"children":2157},{"style":233},[2158],{"type":37,"value":2159},"      console.",{"type":32,"tag":205,"props":2161,"children":2162},{"style":248},[2163],{"type":37,"value":2164},"log",{"type":32,"tag":205,"props":2166,"children":2167},{"style":233},[2168],{"type":37,"value":256},{"type":32,"tag":205,"props":2170,"children":2171},{"style":289},[2172],{"type":37,"value":1631},{"type":32,"tag":205,"props":2174,"children":2175},{"style":233},[2176],{"type":37,"value":415},{"type":32,"tag":205,"props":2178,"children":2179},{"style":248},[2180],{"type":37,"value":1640},{"type":32,"tag":205,"props":2182,"children":2183},{"style":233},[2184],{"type":37,"value":2185},"({\n",{"type":32,"tag":205,"props":2187,"children":2188},{"class":207,"line":362},[2189],{"type":32,"tag":205,"props":2190,"children":2191},{"style":233},[2192],{"type":37,"value":2193},"        timestamp: event.timestamp,\n",{"type":32,"tag":205,"props":2195,"children":2196},{"class":207,"line":372},[2197],{"type":32,"tag":205,"props":2198,"children":2199},{"style":233},[2200],{"type":37,"value":2201},"        outcome: event.outcome,\n",{"type":32,"tag":205,"props":2203,"children":2204},{"class":207,"line":381},[2205],{"type":32,"tag":205,"props":2206,"children":2207},{"style":233},[2208],{"type":37,"value":2209},"        logs: event.logs,\n",{"type":32,"tag":205,"props":2211,"children":2212},{"class":207,"line":26},[2213],{"type":32,"tag":205,"props":2214,"children":2215},{"style":233},[2216],{"type":37,"value":2217},"      }));\n",{"type":32,"tag":205,"props":2219,"children":2220},{"class":207,"line":492},[2221],{"type":32,"tag":205,"props":2222,"children":2223},{"style":233},[2224],{"type":37,"value":2225},"    }\n",{"type":32,"tag":205,"props":2227,"children":2228},{"class":207,"line":500},[2229],{"type":32,"tag":205,"props":2230,"children":2231},{"style":233},[2232],{"type":37,"value":651},{"type":32,"tag":205,"props":2234,"children":2235},{"class":207,"line":509},[2236],{"type":32,"tag":205,"props":2237,"children":2238},{"style":233},[2239],{"type":37,"value":660},{"type":32,"tag":33,"props":2241,"children":2242},{},[2243,2245,2251],{"type":37,"value":2244},"Su Vercel, ",{"type":32,"tag":201,"props":2246,"children":2248},{"className":2247},[],[2249],{"type":37,"value":2250},"console.log",{"type":37,"value":2252}," scrive nei log edge, disponibili nel dashboard Vercel in streaming. Attenzione: il logging verboso su production può superare il limite di CPU — registra solo gli eventi critici.",{"type":32,"tag":33,"props":2254,"children":2255},{},[2256],{"type":37,"value":2257},"Metriche di monitoraggio:",{"type":32,"tag":2259,"props":2260,"children":2261},"ul",{},[2262,2272,2282],{"type":32,"tag":1502,"props":2263,"children":2264},{},[2265,2270],{"type":32,"tag":150,"props":2266,"children":2267},{},[2268],{"type":37,"value":2269},"Cold start latency:",{"type":37,"value":2271}," la prima carica del Worker è 80-120ms — una richiesta \"warm\" è 15ms. I route frequenti rimangono warm.",{"type":32,"tag":1502,"props":2273,"children":2274},{},[2275,2280],{"type":32,"tag":150,"props":2276,"children":2277},{},[2278],{"type":37,"value":2279},"KV read failure rate:",{"type":37,"value":2281}," 0,01% (SLA Cloudflare). Fallback: se KV non risponde, usa il segmento predefinito.",{"type":32,"tag":1502,"props":2283,"children":2284},{},[2285,2290,2292,2298],{"type":32,"tag":150,"props":2286,"children":2287},{},[2288],{"type":37,"value":2289},"CPU time:",{"type":37,"value":2291}," superare il limite di 50ms genera un errore %429. Profiling: misura con ",{"type":32,"tag":201,"props":2293,"children":2295},{"className":2294},[],[2296],{"type":37,"value":2297},"console.time()",{"type":37,"value":2299},", sposta il lavoro pesante all'origin.",{"type":32,"tag":33,"props":2301,"children":2302},{},[2303],{"type":37,"value":2304},"Esempio di gestione degli errori:",{"type":32,"tag":194,"props":2306,"children":2308},{"className":196,"code":2307,"language":198,"meta":16,"style":16},"try {\n  const segment = await env.USER_SEGMENTS.get(userId);\n} catch (err) {\n  \u002F\u002F Fallback in caso di errore KV\n  return renderHTML({ tier: 'free' }, pathname);\n}\n",[2309],{"type":32,"tag":201,"props":2310,"children":2311},{"__ignoreMap":16},[2312,2324,2363,2381,2389,2414],{"type":32,"tag":205,"props":2313,"children":2314},{"class":207,"line":208},[2315,2320],{"type":32,"tag":205,"props":2316,"children":2317},{"style":222},[2318],{"type":37,"value":2319},"try",{"type":32,"tag":205,"props":2321,"children":2322},{"style":233},[2323],{"type":37,"value":236},{"type":32,"tag":205,"props":2325,"children":2326},{"class":207,"line":218},[2327,2331,2335,2339,2343,2347,2351,2355,2359],{"type":32,"tag":205,"props":2328,"children":2329},{"style":222},[2330],{"type":37,"value":712},{"type":32,"tag":205,"props":2332,"children":2333},{"style":289},[2334],{"type":37,"value":391},{"type":32,"tag":205,"props":2336,"children":2337},{"style":222},[2338],{"type":37,"value":297},{"type":32,"tag":205,"props":2340,"children":2341},{"style":222},[2342],{"type":37,"value":400},{"type":32,"tag":205,"props":2344,"children":2345},{"style":233},[2346],{"type":37,"value":405},{"type":32,"tag":205,"props":2348,"children":2349},{"style":289},[2350],{"type":37,"value":410},{"type":32,"tag":205,"props":2352,"children":2353},{"style":233},[2354],{"type":37,"value":415},{"type":32,"tag":205,"props":2356,"children":2357},{"style":248},[2358],{"type":37,"value":339},{"type":32,"tag":205,"props":2360,"children":2361},{"style":233},[2362],{"type":37,"value":424},{"type":32,"tag":205,"props":2364,"children":2365},{"class":207,"line":239},[2366,2371,2376],{"type":32,"tag":205,"props":2367,"children":2368},{"style":233},[2369],{"type":37,"value":2370},"} ",{"type":32,"tag":205,"props":2372,"children":2373},{"style":222},[2374],{"type":37,"value":2375},"catch",{"type":32,"tag":205,"props":2377,"children":2378},{"style":233},[2379],{"type":37,"value":2380}," (err) {\n",{"type":32,"tag":205,"props":2382,"children":2383},{"class":207,"line":280},[2384],{"type":32,"tag":205,"props":2385,"children":2386},{"style":212},[2387],{"type":37,"value":2388},"  \u002F\u002F Fallback in caso di errore KV\n",{"type":32,"tag":205,"props":2390,"children":2391},{"class":207,"line":315},[2392,2396,2400,2405,2409],{"type":32,"tag":205,"props":2393,"children":2394},{"style":222},[2395],{"type":37,"value":778},{"type":32,"tag":205,"props":2397,"children":2398},{"style":248},[2399],{"type":37,"value":528},{"type":32,"tag":205,"props":2401,"children":2402},{"style":233},[2403],{"type":37,"value":2404},"({ tier: ",{"type":32,"tag":205,"props":2406,"children":2407},{"style":346},[2408],{"type":37,"value":484},{"type":32,"tag":205,"props":2410,"children":2411},{"style":233},[2412],{"type":37,"value":2413}," }, pathname);\n",{"type":32,"tag":205,"props":2415,"children":2416},{"class":207,"line":362},[2417],{"type":32,"tag":205,"props":2418,"children":2419},{"style":233},[2420],{"type":37,"value":815},{"type":32,"tag":33,"props":2422,"children":2423},{},[2424],{"type":37,"value":2425},"Se Edge SSR accetta questi trade-off, il salto da 250ms a 40ms crea un impatto misurabile sulla conversione. Soprattutto su mobile, dove la latenza di rete è alta, la prossimità all'edge è critica. Il passo successivo: strutturare correttamente lo store KV, definire la strategia di segmentazione e testare i limiti del runtime edge.",{"type":32,"tag":2427,"props":2428,"children":2429},"style",{},[2430],{"type":37,"value":2431},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":16,"searchDepth":239,"depth":239,"links":2433},[2434,2437,2440,2441],{"id":42,"depth":218,"text":45,"children":2435},[2436],{"id":184,"depth":239,"text":187},{"id":843,"depth":218,"text":846,"children":2438},[2439],{"id":1488,"depth":239,"text":1491},{"id":1762,"depth":218,"text":1765},{"id":2057,"depth":218,"text":2060},"markdown","content:it:tech:ridurre-latenza-personalizzazione-40ms-edge-ssr.md","content","it\u002Ftech\u002Fridurre-latenza-personalizzazione-40ms-edge-ssr.md","it\u002Ftech\u002Fridurre-latenza-personalizzazione-40ms-edge-ssr","md",1782050754319]