Gelişmiş Sunucu Yönetimi ve Optimizasyon Rehberi
1. Sunucu Performans Ayarı
Çekirdek Seviyesi Optimizasyon
-
Özel Ayarlı Çekirdekler: BBR2 tıkanıklık kontrolü ile Linux 6.x
-
TCP Yığını Ayarları:
# TCP maksimum tampon boyutlarını artır echo 'net.core.rmem_max=4194304' >> /etc/sysctl.conf echo 'net.core.wmem_max=4194304' >> /etc/sysctl.conf
-
Swappiness Ayarı: Veritabanı sunucuları için 10 olarak ayarlandı
Veritabanı Optimizasyonu
-
MySQL 8.0+ için Özel:
SET GLOBAL innodb_buffer_pool_size=12G; -- 16GB RAM sunucuları için SET GLOBAL innodb_io_capacity=2000; -- SSD/NVMe depolama için
-
PostgreSQL 14+ Ayarları:
ALTER SYSTEM SET shared_buffers = '4GB'; ALTER SYSTEM SET effective_cache_size = '12GB';
2. Gelişmiş Güvenlik Konfigürasyonları
Zero-Trust Uygulaması
-
Ağ Segmentasyonu:
-
DMZ'deki ön uç sunucular katı giriş kurallarıyla
-
Yalnızca beyaz listedeki IP'lerle özel VLAN'daki veritabanı sunucuları
-
-
Servisler arası Kimlik Doğrulama:
-
İç iletişim için karşılıklı TLS (mTLS)
-
Kimlik yönetimi için SPIFFE/SPIRE
-
Çalışma Zamanı Koruması:
# Runtime güvenlik için Falco kur ve yapılandır
curl -s https://falco.org/repo/falcosecurity-3672BA8F.asc | apt-key add -
echo "deb https://download.falco.org/packages/deb stable main" | tee -a /etc/apt/sources.list.d/falcosecurity.list
apt-get update && apt-get install -y falco
3. Konteyner ve Orkestrasyon Ayarları
Kubernetes Optimizasyonu
# Üretim için K8s manifest örneği
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: app
resources:
limits:
cpu: "2"
memory: "4Gi"
requests:
cpu: "1"
memory: "2Gi"
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
Servis Mesh Konfigürasyonu
# Istio optimize ayarları
istioctl install --set profile=default \
--set values.global.proxy.resources.limits.cpu=2000m \
--set values.global.proxy.resources.limits.memory=1024Mi
4. CI/CD Pipeline Entegrasyonu
GitOps İş Akışı
// Kesintisiz dağıtımlar için Jenkinsfile örneği
pipeline {
stages {
stage('Deploy') {
steps {
sh 'kubectl apply -f k8s/ --prune -l app=myapp'
timeout(time: 15, unit: 'MINUTES') {
input message: 'Üretimi onayla?'
}
}
}
}
post {
failure {
slackSend channel: '#alerts', message: "Build ${currentBuild.number} başarısız oldu!"
}
}
}
5. İzleme Yığını Dağıtımı
Gözlemlenebilirlik Paketi
# Prometheus + Grafana + Loki yığını version: '3' services: prometheus: image: prom/prometheus:v2.40.0 command: - '--config.file=/etc/prometheus/prometheus.yml' volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml grafana: image: grafana/grafana:9.3.2 ports: - "3000:3000"
Özel Metrik Toplama
# Örnek Python exporter, özel iş metrikleri için
from prometheus_client import start_http_server, Gauge
import random
REQUEST_LATENCY = Gauge('app_request_latency', 'Uygulama gecikmesi ms cinsinden')
if __name__ == '__main__':
start_http_server(8000)
while True:
REQUEST_LATENCY.set(random.randint(1, 100))
6. Felaket Kurtarma Protokolleri
Otomatik Failover Testi
# Chaos engineering betiği
#!/bin/bash
# Dayanıklılığı test etmek için düğümleri rastgele sonlandırma
NODES=$(kubectl get nodes -o jsonpath='{.items[*].metadata.name}')
TARGET=$(shuf -e -n1 $NODES)
echo "Düğüm $TARGET sonlandırılıyor"
gcloud compute instances delete $TARGET --zone=us-central1-a
7. Edge Computing Uzantıları
Gelişmiş CDN Kuralları
// Edge mantığı için Cloudflare Workers betiği
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
if (url.pathname.startsWith('/api/')) {
return new Response('Edge’de engellendi', { status: 403 })
}
return fetch(request)
}
8. Maliyet Optimizasyon Stratejileri
Spot Instance Otomasyonu
# AWS Spot Fleet konfigürasyonu resource "aws_spot_fleet_request" "workers" { iam_fleet_role = "arn:aws:iam::123456789012:role/spot-fleet" target_capacity = 10 allocation_strategy = "diversified" launch_specification { instance_type = "m5.large" ami = "ami-123456" spot_price = "0.05" } }