Add /ultraresearch-local for structured research combining local codebase analysis with external knowledge via parallel agent swarms. Produces research briefs with triangulation, confidence ratings, and source quality assessment. New command: /ultraresearch-local with modes --quick, --local, --external, --fg. New agents: research-orchestrator (opus), docs-researcher, community-researcher, security-researcher, contrarian-researcher, gemini-bridge (all sonnet). New template: research-brief-template.md. Integration: --research flag in /ultraplan-local accepts pre-built research briefs (up to 3), enriches the interview and exploration phases. Planning orchestrator cross-references brief findings during synthesis. Design principle: Context Engineering — right information to right agent at right time. Research briefs are structured artifacts in the pipeline: ultraresearch → brief → ultraplan --research → plan → ultraexecute. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
566 lines
18 KiB
Markdown
566 lines
18 KiB
Markdown
# CDN and Edge Caching for AI Workloads
|
|
|
|
**Last updated:** 2026-02
|
|
**Status:** GA
|
|
**Category:** Performance & Scalability
|
|
|
|
---
|
|
|
|
## Introduksjon
|
|
|
|
Content Delivery Networks (CDN) og edge computing er etablerte teknologier for a akselerere webinnhold, men bruken i AI-kontekst krever en nyansert tilnaerming. AI-responser er dynamiske og ofte personaliserte, noe som gjor tradisjonell caching mer kompleks. Likevel finnes det betydelige muligheter for a redusere latens og kostnader ved a cache AI-relatert innhold pa riktig mate.
|
|
|
|
For norsk offentlig sektor, der brukere er geografisk spredt over hele landet, kan edge computing og smart caching redusere opplevd responstid betydelig. Azure Front Door med sine 118+ edge-lokasjoner og globale lastbalansering er den primaere tjenesten for dette formalet.
|
|
|
|
Denne referansen dekker strategier for a bruke Azure Front Door, CDN-caching og edge compute for AI-arbeidslaster, med fokus pa hva som kan og ikke bor caches, samt geografisk routing for optimal ytelse.
|
|
|
|
## Azure Front Door for AI-endepunkter
|
|
|
|
### Oversikt
|
|
|
|
Azure Front Door er en global CDN med lastbalansering, TLS-terminering og edge caching. For AI-arbeidslaster fungerer den som et intelligent lag mellom brukere og backend-tjenester:
|
|
|
|
| Funksjon | Beskrivelse | Relevans for AI |
|
|
|----------|-------------|-----------------|
|
|
| Global lastbalansering | Ruter trafikk til naermeste/friskeste backend | Multi-region AI-deployments |
|
|
| TLS-terminering | Terminerer SSL pa edge | Reduserer latens med ~50-100 ms |
|
|
| Edge caching | Cacher statisk og semi-statisk innhold | Embeddings, modellmetadata |
|
|
| WAF | Web Application Firewall | Beskytter AI-endepunkter |
|
|
| DDoS-beskyttelse | Layer 3/4/7 beskyttelse | Kritisk for publiserte AI-APIer |
|
|
| Traffic acceleration | Split TCP, anycast | 30-40% raskere for dynamisk innhold |
|
|
|
|
### Arkitektur: Front Door foran AI-tjenester
|
|
|
|
```
|
|
Innbygger (Tromso) --> Azure Front Door Edge (Oslo/Stockholm)
|
|
|
|
|
+---------+---------+
|
|
| |
|
|
Sweden Central North Europe
|
|
(AI-primaer) (AI-failover)
|
|
| |
|
|
Azure OpenAI Azure OpenAI
|
|
Container Apps Container Apps
|
|
```
|
|
|
|
### Front Door-konfigurasjon for AI
|
|
|
|
```bicep
|
|
resource frontDoor 'Microsoft.Cdn/profiles@2023-05-01' = {
|
|
name: 'fd-ai-services'
|
|
location: 'global'
|
|
sku: {
|
|
name: 'Premium_AzureFrontDoor' // Premium for WAF
|
|
}
|
|
}
|
|
|
|
resource aiEndpoint 'Microsoft.Cdn/profiles/afdEndpoints@2023-05-01' = {
|
|
parent: frontDoor
|
|
name: 'ai-api-endpoint'
|
|
location: 'global'
|
|
properties: {
|
|
enabledState: 'Enabled'
|
|
}
|
|
}
|
|
|
|
// Origin group med health probes
|
|
resource aiOriginGroup 'Microsoft.Cdn/profiles/originGroups@2023-05-01' = {
|
|
parent: frontDoor
|
|
name: 'ai-backends'
|
|
properties: {
|
|
loadBalancingSettings: {
|
|
sampleSize: 4
|
|
successfulSamplesRequired: 3
|
|
additionalLatencyInMilliseconds: 50
|
|
}
|
|
healthProbeSettings: {
|
|
probePath: '/health'
|
|
probeRequestType: 'HEAD'
|
|
probeProtocol: 'Https'
|
|
probeIntervalInSeconds: 30
|
|
}
|
|
sessionAffinityState: 'Disabled' // Viktig: Ingen session affinity for AI
|
|
}
|
|
}
|
|
|
|
// Primaer origin: Sweden Central
|
|
resource primaryOrigin 'Microsoft.Cdn/profiles/originGroups/origins@2023-05-01' = {
|
|
parent: aiOriginGroup
|
|
name: 'sweden-central'
|
|
properties: {
|
|
hostName: 'ai-service.swedencentral.azurecontainerapps.io'
|
|
httpPort: 80
|
|
httpsPort: 443
|
|
originHostHeader: 'ai-service.swedencentral.azurecontainerapps.io'
|
|
priority: 1
|
|
weight: 1000
|
|
}
|
|
}
|
|
|
|
// Failover origin: North Europe
|
|
resource failoverOrigin 'Microsoft.Cdn/profiles/originGroups/origins@2023-05-01' = {
|
|
parent: aiOriginGroup
|
|
name: 'north-europe'
|
|
properties: {
|
|
hostName: 'ai-service.northeurope.azurecontainerapps.io'
|
|
httpPort: 80
|
|
httpsPort: 443
|
|
originHostHeader: 'ai-service.northeurope.azurecontainerapps.io'
|
|
priority: 2
|
|
weight: 1000
|
|
}
|
|
}
|
|
```
|
|
|
|
## CDN Caching-regler for AI-responser
|
|
|
|
### Hva kan og bor caches?
|
|
|
|
| Innholdstype | Cachebar? | TTL | Begrunnelse |
|
|
|-------------|-----------|-----|-------------|
|
|
| Statiske assets (JS/CSS/bilder) | Ja | 1 dag - 1 uke | Standard CDN-bruk |
|
|
| AI-modellmetadata (tilgjengelige modeller) | Ja | 5-15 min | Endres sjelden |
|
|
| Embedding-resultater (identisk input) | Ja, med forsiktighet | 1-24 timer | Deterministisk output |
|
|
| Chat completion-responser | Nei | N/A | Dynamisk, personalisert |
|
|
| RAG-soekeresultater | Nei | N/A | Avhenger av kunnskapsbase |
|
|
| Streaming-responser (SSE) | Nei | N/A | Real-time, ikke cachebart |
|
|
| Health check-endepunkter | Nei | N/A | Ma vaere sanntid |
|
|
| Token-telling/estimat | Ja | 1-5 min | Stabil beregning |
|
|
|
|
### Cache-regler i Front Door
|
|
|
|
```bicep
|
|
// Route for statisk innhold (caching aktivert)
|
|
resource staticRoute 'Microsoft.Cdn/profiles/afdEndpoints/routes@2023-05-01' = {
|
|
parent: aiEndpoint
|
|
name: 'static-content'
|
|
properties: {
|
|
originGroup: { id: aiOriginGroup.id }
|
|
patternsToMatch: ['/static/*', '/assets/*', '/models/metadata']
|
|
supportedProtocols: ['Https']
|
|
cacheConfiguration: {
|
|
queryStringCachingBehavior: 'IgnoreQueryString'
|
|
compressionSettings: {
|
|
isCompressionEnabled: true
|
|
contentTypesToCompress: [
|
|
'application/json'
|
|
'text/javascript'
|
|
'text/css'
|
|
]
|
|
}
|
|
cacheBehavior: 'OverrideAlways'
|
|
cacheDuration: '01:00:00' // 1 time
|
|
}
|
|
}
|
|
}
|
|
|
|
// Route for AI API-endepunkter (caching deaktivert)
|
|
resource apiRoute 'Microsoft.Cdn/profiles/afdEndpoints/routes@2023-05-01' = {
|
|
parent: aiEndpoint
|
|
name: 'ai-api'
|
|
properties: {
|
|
originGroup: { id: aiOriginGroup.id }
|
|
patternsToMatch: ['/api/chat/*', '/api/completions/*']
|
|
supportedProtocols: ['Https']
|
|
cacheConfiguration: {
|
|
queryStringCachingBehavior: 'UseQueryString'
|
|
cacheBehavior: 'HonorOrigin' // Respekter Cache-Control fra backend
|
|
}
|
|
}
|
|
}
|
|
|
|
// Route for streaming-endepunkter (ingen caching, ingen buffering)
|
|
resource streamRoute 'Microsoft.Cdn/profiles/afdEndpoints/routes@2023-05-01' = {
|
|
parent: aiEndpoint
|
|
name: 'ai-stream'
|
|
properties: {
|
|
originGroup: { id: aiOriginGroup.id }
|
|
patternsToMatch: ['/api/chat/stream/*']
|
|
supportedProtocols: ['Https']
|
|
cacheConfiguration: {
|
|
cacheBehavior: 'Disabled'
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Backend Cache-Control headers
|
|
|
|
For korrekt cache-oppforsel ma backend sette riktige headers:
|
|
|
|
```python
|
|
from fastapi import FastAPI, Response
|
|
from fastapi.responses import JSONResponse
|
|
|
|
app = FastAPI()
|
|
|
|
@app.get("/models/metadata")
|
|
async def get_model_metadata():
|
|
"""Modellmetadata - kan caches."""
|
|
return JSONResponse(
|
|
content={"models": ["gpt-4o", "gpt-4o-mini"]},
|
|
headers={
|
|
"Cache-Control": "public, max-age=900", # 15 minutter
|
|
"Vary": "Accept-Encoding"
|
|
}
|
|
)
|
|
|
|
@app.post("/api/chat/completions")
|
|
async def chat_completions():
|
|
"""Chat completions - skal IKKE caches."""
|
|
response = await process_chat()
|
|
return JSONResponse(
|
|
content=response,
|
|
headers={
|
|
"Cache-Control": "no-store, no-cache, must-revalidate",
|
|
"Pragma": "no-cache"
|
|
}
|
|
)
|
|
|
|
@app.post("/api/embeddings")
|
|
async def get_embeddings(request: EmbeddingRequest):
|
|
"""Embeddings - kan caches for identiske inputs."""
|
|
# Generer cache key basert pa input
|
|
cache_key = hashlib.sha256(request.input.encode()).hexdigest()
|
|
|
|
return JSONResponse(
|
|
content=embedding_result,
|
|
headers={
|
|
"Cache-Control": "public, max-age=86400", # 24 timer
|
|
"ETag": f'"{cache_key}"',
|
|
"Vary": "Content-Type"
|
|
}
|
|
)
|
|
```
|
|
|
|
### Advarsel: Unnga caching av personlig innhold
|
|
|
|
```
|
|
ADVARSEL: Feilkonfigurert caching kan fore til personvernbrudd!
|
|
|
|
ALDRI cache:
|
|
- Chat-responser som inneholder personopplysninger
|
|
- Responser basert pa brukeridentitet
|
|
- API-kall med Authorization-header
|
|
- Streaming-endepunkter (SSE)
|
|
|
|
Azure Front Door cacher basert pa URL og query-parametre.
|
|
Hvis to brukere sender identisk request til et cachet endepunkt,
|
|
vil bruker B se bruker As respons.
|
|
|
|
For norsk offentlig sektor: Brudd pa personopplysningsloven (GDPR)
|
|
kan resultere i bot fra Datatilsynet.
|
|
```
|
|
|
|
## Semantic Caching for AI
|
|
|
|
### Tradisjonell cache vs. semantic cache
|
|
|
|
| Aspekt | Tradisjonell cache | Semantic cache |
|
|
|--------|-------------------|----------------|
|
|
| Match-kriterium | Eksakt URL/key | Semantisk likhet (vector) |
|
|
| Hit rate | Lav for AI (unik input) | Hoy (lignende sporsmaal matcher) |
|
|
| Infrastruktur | Standard CDN/Redis | Redis med RediSearch + embeddings |
|
|
| Kostnad | Lav | Moderat (embedding + Redis) |
|
|
| Latens ved hit | ~1 ms | ~5-20 ms |
|
|
| Relevans for AI | Begrenset | Hoy |
|
|
|
|
### Semantic Caching med Azure API Management
|
|
|
|
```xml
|
|
<!-- APIM policy for semantic caching -->
|
|
<policies>
|
|
<inbound>
|
|
<base />
|
|
<!-- Sjekk semantic cache for matche -->
|
|
<azure-openai-semantic-cache-lookup
|
|
score-threshold="0.8"
|
|
embeddings-backend-id="embeddings-backend"
|
|
embeddings-backend-auth="system-assigned" />
|
|
</inbound>
|
|
<backend>
|
|
<forward-request buffer-response="false" />
|
|
</backend>
|
|
<outbound>
|
|
<base />
|
|
<!-- Lagre respons i semantic cache -->
|
|
<azure-openai-semantic-cache-store duration="3600" />
|
|
</outbound>
|
|
</policies>
|
|
```
|
|
|
|
**Forutsetninger for semantic caching:**
|
|
1. Azure API Management (alle tiers)
|
|
2. Azure Managed Redis med RediSearch-modul
|
|
3. Azure OpenAI Embeddings-deployment
|
|
4. Managed identity-autentisering
|
|
|
|
### Nar bruke semantic caching
|
|
|
|
| Bruksomrade | Egnet? | Begrunnelse |
|
|
|-------------|--------|-------------|
|
|
| FAQ-chatbot for innbyggere | Ja | Mange lignende sporsmaal |
|
|
| Intern kunnskapsbase-SOK | Ja | Gjentakende sporsmaal |
|
|
| Dokumentanalyse (unik input) | Nei | Unik input per dokument |
|
|
| Kreativ innholdsgenerering | Nei | Variasjon er onskelig |
|
|
| Klassifisering med fast prompt | Ja | Identisk/lignende input |
|
|
| Ovesettelse | Delvis | Identiske setninger kan caches |
|
|
|
|
## Edge Compute for pre-prosessering
|
|
|
|
### Pre-prosessering pa edge
|
|
|
|
For AI-arbeidslaster kan visse operasjoner kjores naermere brukeren:
|
|
|
|
| Operasjon | Kjor pa edge? | Teknologi |
|
|
|-----------|--------------|-----------|
|
|
| Input-validering | Ja | Azure Functions / Container Apps |
|
|
| Token-telling (estimat) | Ja | tiktoken lokalt |
|
|
| PII-deteksjon (enkel) | Ja | Regex-basert filtrering |
|
|
| Rate limiting | Ja | APIM / Front Door WAF |
|
|
| Request routing | Ja | Front Door Rules Engine |
|
|
| Prompt assembly | Ja | Edge function |
|
|
| AI-inferens | Nei | Krever GPU/TPU i backend |
|
|
| RAG retrieval | Delvis | Embedding pa edge, sok i backend |
|
|
|
|
### Azure Functions pa Edge (med Container Apps)
|
|
|
|
```python
|
|
# Edge pre-processing function
|
|
import re
|
|
from typing import Optional
|
|
|
|
def pre_process_ai_request(
|
|
user_input: str,
|
|
max_input_length: int = 10000
|
|
) -> dict:
|
|
"""Pre-prosesser AI-request pa edge for lavere latens og sikkerhet."""
|
|
|
|
result = {
|
|
"processed_input": user_input,
|
|
"metadata": {},
|
|
"blocked": False
|
|
}
|
|
|
|
# 1. Inputvalidering
|
|
if len(user_input) > max_input_length:
|
|
result["processed_input"] = user_input[:max_input_length]
|
|
result["metadata"]["truncated"] = True
|
|
|
|
# 2. Enkel PII-deteksjon (pre-filtering)
|
|
pii_patterns = {
|
|
"fodselsnummer": r'\b\d{6}\s?\d{5}\b', # Norsk fodselsnummer
|
|
"kontonummer": r'\b\d{4}\.\d{2}\.\d{5}\b',
|
|
"telefonnummer": r'\b(?:\+47)?\s?\d{3}\s?\d{2}\s?\d{3}\b'
|
|
}
|
|
|
|
detected_pii = []
|
|
for pii_type, pattern in pii_patterns.items():
|
|
if re.search(pattern, user_input):
|
|
detected_pii.append(pii_type)
|
|
|
|
if detected_pii:
|
|
result["metadata"]["detected_pii"] = detected_pii
|
|
# Vurder a blokkere eller varsle basert pa policy
|
|
|
|
# 3. Token-estimat (uten full tiktoken)
|
|
estimated_tokens = len(user_input.split()) * 1.3
|
|
result["metadata"]["estimated_tokens"] = int(estimated_tokens)
|
|
|
|
return result
|
|
```
|
|
|
|
### Request Routing basert pa innhold
|
|
|
|
```xml
|
|
<!-- Front Door Rules Engine: Rut basert pa request-egenskaper -->
|
|
<rules>
|
|
<rule name="route-simple-queries">
|
|
<!-- Korte requests -> GPT-4o mini for lavest latens -->
|
|
<conditions>
|
|
<condition>
|
|
<matchVariable>RequestBody</matchVariable>
|
|
<operator>LengthLessThan</operator>
|
|
<matchValues>500</matchValues>
|
|
</condition>
|
|
</conditions>
|
|
<actions>
|
|
<routeConfigurationOverride>
|
|
<originGroup>/originGroups/fast-model-backends</originGroup>
|
|
</routeConfigurationOverride>
|
|
</actions>
|
|
</rule>
|
|
<rule name="route-complex-queries">
|
|
<!-- Lange requests -> GPT-4o for bedre kvalitet -->
|
|
<conditions>
|
|
<condition>
|
|
<matchVariable>RequestBody</matchVariable>
|
|
<operator>LengthGreaterThan</operator>
|
|
<matchValues>2000</matchValues>
|
|
</condition>
|
|
</conditions>
|
|
<actions>
|
|
<routeConfigurationOverride>
|
|
<originGroup>/originGroups/quality-model-backends</originGroup>
|
|
</routeConfigurationOverride>
|
|
</actions>
|
|
</rule>
|
|
</rules>
|
|
```
|
|
|
|
## Geografisk routing og optimalisering
|
|
|
|
### Trafikkruting for Norge
|
|
|
|
For norsk offentlig sektor med brukere over hele landet:
|
|
|
|
| Brukerplassering | Naermeste Edge PoP | Backend-region | Forventet latens |
|
|
|-----------------|-------------------|----------------|-----------------|
|
|
| Oslo/Ostlandet | Oslo/Stockholm | Sweden Central | 5-15 ms |
|
|
| Bergen/Vestland | Amsterdam/Stockholm | Sweden Central | 15-25 ms |
|
|
| Tromso/Nord-Norge | Stockholm | Sweden Central | 20-35 ms |
|
|
| Trondheim/Trondelag | Stockholm | Sweden Central | 15-25 ms |
|
|
|
|
### Multi-region deployment med Azure Front Door
|
|
|
|
```bicep
|
|
// Geografisk routing-konfigurasjon
|
|
resource routePolicy 'Microsoft.Cdn/profiles/afdEndpoints/routes@2023-05-01' = {
|
|
parent: aiEndpoint
|
|
name: 'geo-optimized-route'
|
|
properties: {
|
|
originGroup: { id: aiOriginGroup.id }
|
|
patternsToMatch: ['/api/*']
|
|
supportedProtocols: ['Https']
|
|
// Front Door bruker anycast for automatisk naermeste-edge-routing
|
|
// Backend-valg baseres pa latens + health probes
|
|
}
|
|
}
|
|
```
|
|
|
|
### Latensbasert routing
|
|
|
|
Azure Front Door velger automatisk backend med lavest latens:
|
|
|
|
```
|
|
1. Bruker i Tromso sender request
|
|
2. DNS resolver -> naermeste Front Door PoP (Stockholm)
|
|
3. Front Door maler latens til alle backends:
|
|
- Sweden Central: 10 ms
|
|
- North Europe: 35 ms
|
|
4. Request rutes til Sweden Central
|
|
5. Hvis Sweden Central er nede: automatisk failover til North Europe
|
|
```
|
|
|
|
### Health Probes for AI-backends
|
|
|
|
```python
|
|
# Health endpoint for AI-tjeneste
|
|
from fastapi import FastAPI
|
|
import time
|
|
|
|
app = FastAPI()
|
|
|
|
# Enkel health check
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "healthy", "timestamp": time.time()}
|
|
|
|
# Detaljert health check (for intern bruk, ikke via Front Door)
|
|
@app.get("/health/detailed")
|
|
async def detailed_health():
|
|
checks = {}
|
|
|
|
# Sjekk Azure OpenAI-tilgang
|
|
try:
|
|
response = await client.chat.completions.create(
|
|
model="gpt-4o-mini",
|
|
messages=[{"role": "user", "content": "ping"}],
|
|
max_tokens=1
|
|
)
|
|
checks["azure_openai"] = "healthy"
|
|
except Exception as e:
|
|
checks["azure_openai"] = f"unhealthy: {str(e)}"
|
|
|
|
# Sjekk vector store
|
|
try:
|
|
await search_client.search("test", top=1)
|
|
checks["search_index"] = "healthy"
|
|
except Exception:
|
|
checks["search_index"] = "unhealthy"
|
|
|
|
overall = "healthy" if all(v == "healthy" for v in checks.values()) else "degraded"
|
|
return {"status": overall, "checks": checks}
|
|
```
|
|
|
|
## DDoS-beskyttelse for AI-endepunkter
|
|
|
|
### Front Door + WAF for AI-APIer
|
|
|
|
AI-endepunkter er spesielt sarbare for misbruk pa grunn av hoye kostnader per request:
|
|
|
|
```bicep
|
|
resource wafPolicy 'Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2022-05-01' = {
|
|
name: 'waf-ai-protection'
|
|
location: 'global'
|
|
properties: {
|
|
policySettings: {
|
|
enabledState: 'Enabled'
|
|
mode: 'Prevention'
|
|
}
|
|
customRules: {
|
|
rules: [
|
|
{
|
|
name: 'RateLimitAIEndpoints'
|
|
priority: 100
|
|
ruleType: 'RateLimitRule'
|
|
rateLimitDurationInMinutes: 1
|
|
rateLimitThreshold: 100 // Maks 100 requests per minutt per IP
|
|
matchConditions: [
|
|
{
|
|
matchVariable: 'RequestUri'
|
|
operator: 'Contains'
|
|
matchValue: ['/api/chat', '/api/completions']
|
|
}
|
|
]
|
|
action: 'Block'
|
|
}
|
|
{
|
|
name: 'BlockLargePayloads'
|
|
priority: 200
|
|
ruleType: 'MatchRule'
|
|
matchConditions: [
|
|
{
|
|
matchVariable: 'RequestBody'
|
|
operator: 'GreaterThan'
|
|
matchValue: ['1048576'] // 1 MB maks request body
|
|
transforms: ['Trim']
|
|
}
|
|
]
|
|
action: 'Block'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## Ytelsesgevinster: Oppsummering
|
|
|
|
| Teknikk | Typisk latensreduksjon | Kostnadsreduksjon | Kompleksitet |
|
|
|---------|----------------------|-------------------|-------------|
|
|
| Front Door TLS-terminering | 50-100 ms | Ingen | Lav |
|
|
| Traffic acceleration (split TCP) | 30-40% dynamisk | Ingen | Lav |
|
|
| Static asset caching | 90%+ for assets | Redusert backend-trafikk | Lav |
|
|
| Semantic caching | 80-95% ved hit | Eliminerer AI-kall ved hit | Hoy |
|
|
| Edge pre-processing | 10-50 ms | Blokkerer unodvendige kall | Medium |
|
|
| Geographic routing | 10-40 ms | Ingen direkte | Lav |
|
|
| DDoS/rate limiting | Indirekte (beskyttelse) | Hindrer misbrukskostnader | Medium |
|
|
|
|
## For Cosmo
|
|
|
|
- **Azure Front Door er obligatorisk** for alle publiserte AI-endepunkter. Det gir TLS-terminering, DDoS-beskyttelse, geographic routing og traffic acceleration med minimal konfigurasjon.
|
|
- **Cache ALDRI chat completion-responser.** Feilkonfigurert caching kan lekke personopplysninger mellom brukere. Kun statisk innhold, modellmetadata og embeddings kan caches trygt.
|
|
- **Semantic caching via APIM + Redis** er den mest verdifulle cache-teknikken for AI. For FAQ-chatbots kan det eliminere 50-70% av backend-kall og redusere bade latens og kostnad.
|
|
- **Edge pre-processing** (PII-deteksjon, inputvalidering, token-estimat) reduserer unodvendig backend-trafikk og forbedrer sikkerhet. Implementer som en enkel middleware foran AI-endepunktet.
|
|
- **Rate limiting pa WAF-niva** er kritisk for AI-endepunkter fordi hvert kall har hoy kostnad. Sett restriktive grenser (50-200 requests/min per IP) og juster etter behov.
|