'success',
'duration_ms' => round($duration, 2),
'ops_per_sec' => number_format($ops, 0, ',', '.'),
'raw_ops' => $ops
];
}
function benchmarkMemory() {
$start = microtime(true);
$startMem = memory_get_usage();
$arr = [];
for ($i = 0; $i < 50000; $i++) {
$arr['key_' . $i] = [
'id' => $i,
'val' => $i * 1.5,
'studio' => 'WebenPCStudio'
];
}
ksort($arr);
$serialized = serialize($arr);
$unserialized = unserialize($serialized);
unset($arr, $serialized, $unserialized);
$duration = (microtime(true) - $start) * 1000;
$peakMem = (memory_get_peak_usage() - $startMem) / (1024 * 1024);
$throughput = round(150000 / (max(0.001, $duration) / 1000));
return [
'status' => 'success',
'duration_ms' => round($duration, 2),
'peak_mem_mb' => round(max(0.1, $peakMem), 2),
'ops_per_sec' => number_format($throughput, 0, ',', '.'),
'raw_ops' => $throughput
];
}
function benchmarkDiskIO() {
$tempDir = sys_get_temp_dir();
$tempFile = tempnam($tempDir, 'wpc_bench_');
if (!$tempFile) {
return ['status' => 'error', 'message' => 'Kan tijdelijk bestand niet aanmaken'];
}
$chunkSize = 64 * 1024; // 64 KB
$chunks = 48; // ~3 MB totaal
$dummyData = str_repeat('WPCStudio2026_TEST_STRING_ABCD!', 2048); // 64 KB
// Write test
$writeStart = microtime(true);
$fp = fopen($tempFile, 'wb');
if (!$fp) {
@unlink($tempFile);
return ['status' => 'error', 'message' => 'Kan bestand niet openen'];
}
for ($i = 0; $i < $chunks; $i++) {
fwrite($fp, $dummyData);
}
fflush($fp);
fclose($fp);
$writeTime = max(0.0005, microtime(true) - $writeStart);
// Read test
$readStart = microtime(true);
$fp = fopen($tempFile, 'rb');
if ($fp) {
while (!feof($fp)) {
fread($fp, $chunkSize);
}
fclose($fp);
}
$readTime = max(0.0005, microtime(true) - $readStart);
$totalMB = ($chunks * $chunkSize) / (1024 * 1024);
$writeSpeed = round($totalMB / $writeTime, 1);
$readSpeed = round($totalMB / $readTime, 1);
@unlink($tempFile);
return [
'status' => 'success',
'file_size_mb' => round($totalMB, 2),
'write_speed_mb_s' => $writeSpeed,
'read_speed_mb_s' => $readSpeed,
'write_time_ms' => round($writeTime * 1000, 1),
'read_time_ms' => round($readTime * 1000, 1)
];
}
function benchmarkStringJSON() {
$start = microtime(true);
$data = [];
for ($i = 0; $i < 15000; $i++) {
$data[] = [
'id' => $i,
'email' => "user{$i}@webenpcstudio.nl",
'tags' => ['git', 'php', 'speed', 'server'],
'active' => ($i % 2 === 0)
];
}
$json = json_encode($data);
$decoded = json_decode($json, true);
preg_match_all('/[a-zA-Z0-9._%+-]+@webenpcstudio\.nl/', $json, $matches);
$duration = (microtime(true) - $start) * 1000;
$throughput = round(15000 / (max(0.001, $duration) / 1000));
return [
'status' => 'success',
'duration_ms' => round($duration, 2),
'records_per_sec' => number_format($throughput, 0, ',', '.'),
'json_size_kb' => round(strlen($json) / 1024, 1),
'raw_ops' => $throughput
];
}
function benchmarkDatabase() {
if (!extension_loaded('pdo_sqlite')) {
return [
'status' => 'skipped',
'message' => 'PDO SQLite niet beschikbaar',
'tps' => 0,
'duration_ms' => 0
];
}
try {
$start = microtime(true);
$pdo = new PDO('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT, val REAL)');
$pdo->beginTransaction();
$stmt = $pdo->prepare('INSERT INTO test (name, val) VALUES (?, ?)');
for ($i = 0; $i < 2500; $i++) {
$stmt->execute(['item_' . $i, mt_rand(1, 1000) / 10]);
}
$pdo->commit();
$stmt2 = $pdo->query('SELECT AVG(val), COUNT(*) FROM test WHERE val > 500');
$stmt2->fetch();
$duration = (microtime(true) - $start) * 1000;
$tps = round(2500 / (max(0.001, $duration) / 1000));
return [
'status' => 'success',
'duration_ms' => round($duration, 2),
'tps' => number_format($tps, 0, ',', '.'),
'records' => 2500,
'raw_tps' => $tps
];
} catch (Exception $e) {
return [
'status' => 'error',
'message' => $e->getMessage()
];
}
}
function getOpcacheInfo() {
if (function_exists('opcache_get_status') && ($status = @opcache_get_status(false))) {
$mem = $status['memory_usage'] ?? [];
return [
'enabled' => true,
'used_mb' => round(($mem['used_memory'] ?? 0) / (1024 * 1024), 1),
'free_mb' => round(($mem['free_memory'] ?? 0) / (1024 * 1024), 1),
'hit_rate' => round($status['opcache_statistics']['opcache_hit_rate'] ?? 0, 1) . '%',
'jit' => !empty($status['jit']['enabled']) ? 'Actief' : 'Inactief'
];
}
return [
'enabled' => false,
'message' => 'Niet geactiveerd'
];
}
// ==========================================
// API Routing voor AJAX Verzoeken
// ==========================================
if (isset($_GET['action'])) {
header('Content-Type: application/json; charset=utf-8');
// 1. Snelle Ping
if ($_GET['action'] === 'ping') {
echo json_encode([
'status' => 'pong',
'timestamp' => microtime(true),
'server_time' => date('H:i:s.u')
]);
exit;
}
// 2. Afzonderlijke Benchmark Acties
if ($_GET['action'] === 'bench_cpu') {
echo json_encode(benchmarkCPU());
exit;
}
if ($_GET['action'] === 'bench_memory') {
echo json_encode(benchmarkMemory());
exit;
}
if ($_GET['action'] === 'bench_disk') {
echo json_encode(benchmarkDiskIO());
exit;
}
if ($_GET['action'] === 'bench_string') {
echo json_encode(benchmarkStringJSON());
exit;
}
if ($_GET['action'] === 'bench_db') {
echo json_encode(benchmarkDatabase());
exit;
}
// 3. Volledige Server Benchmark Suite
if ($_GET['action'] === 'bench_all') {
$cpu = benchmarkCPU();
$mem = benchmarkMemory();
$disk = benchmarkDiskIO();
$str = benchmarkStringJSON();
$db = benchmarkDatabase();
$opcache = getOpcacheInfo();
// Bereken gewogen Server Score (0-100)
$score = 0;
// CPU Score (max 25)
$cpuOps = $cpu['raw_ops'] ?? 0;
$score += min(25, round(($cpuOps / 150000) * 25));
// Memory Score (max 20)
$memOps = $mem['raw_ops'] ?? 0;
$score += min(20, round(($memOps / 200000) * 20));
// Disk Score (max 25)
$writeSpd = $disk['write_speed_mb_s'] ?? 0;
$score += min(25, round(($writeSpd / 300) * 25));
// String/JSON Score (max 15)
$strOps = $str['raw_ops'] ?? 0;
$score += min(15, round(($strOps / 35000) * 15));
// DB / OPcache Score (max 15)
if ($db['status'] === 'success') {
$dbTps = $db['raw_tps'] ?? 0;
$score += min(15, round(($dbTps / 20000) * 15));
} else {
$score += ($opcache['enabled'] ? 12 : 8);
}
$finalScore = max(35, min(100, $score));
// Grade toekenning
if ($finalScore >= 90) {
$grade = 'A+';
$rating = 'Superieur (Enterprise Snelheid)';
$color = '#34d399';
} elseif ($finalScore >= 80) {
$grade = 'A';
$rating = 'Uitstekend (Zeer Snelle Server)';
$color = '#38bdf8';
} elseif ($finalScore >= 70) {
$grade = 'B';
$rating = 'Goed (Solide Hosting)';
$color = '#fbbf24';
} else {
$grade = 'C';
$rating = 'Voldoende (Basis Hosting)';
$color = '#f87171';
}
echo json_encode([
'status' => 'success',
'score' => $finalScore,
'grade' => $grade,
'rating' => $rating,
'color' => $color,
'cpu' => $cpu,
'memory' => $mem,
'disk' => $disk,
'string_json' => $str,
'db' => $db,
'opcache' => $opcache,
'timestamp' => date('d-m-Y H:i:s')
]);
exit;
}
// 4. Server Specificaties & Audit
if ($_GET['action'] === 'server_specs') {
echo json_encode([
'php_version' => PHP_VERSION,
'sapi' => php_sapi_name(),
'os' => PHP_OS_FAMILY . ' (' . PHP_OS . ')',
'architecture' => (PHP_INT_SIZE * 8) . '-bit',
'memory_limit' => ini_get('memory_limit'),
'max_execution_time' => ini_get('max_execution_time') . 's',
'upload_max_filesize' => ini_get('upload_max_filesize'),
'post_max_size' => ini_get('post_max_size'),
'opcache' => getOpcacheInfo(),
'server_software' => $_SERVER['SERVER_SOFTWARE'] ?? 'Onbekend',
'extensions' => [
'curl' => extension_loaded('curl'),
'openssl' => extension_loaded('openssl'),
'pdo_mysql' => extension_loaded('pdo_mysql'),
'pdo_sqlite' => extension_loaded('pdo_sqlite'),
'mbstring' => extension_loaded('mbstring'),
'gd' => extension_loaded('gd'),
'zip' => extension_loaded('zip')
]
]);
exit;
}
echo json_encode(['status' => 'error', 'message' => 'Onbekend verzoek']);
exit;
}
date_default_timezone_set('Europe/Amsterdam');
$serverTime = date('H:i:s');
$phpVersion = PHP_VERSION;
$serverSoftware = $_SERVER['SERVER_SOFTWARE'] ?? 'Apache / Nginx';
?>
Web & PC Studio - Webserver Benchmark & Dev Lab
⚡
Web & PC Studio
🔈 Geluid: Uit
Webserver Performance Suite
Voer diepgaande diagnostische server benchmarks uit om CPU-rekenkracht, Disk I/O schrijf/leessnelheid, geheugenbandbreedte en gelijktijdige request-capaciteit van www.webenpcstudio.nl te meten.
⚡ Volledige Webserver Benchmark
Test in één geautomatiseerde cyclus de CPU, NVMe/SSD Disk I/O, RAM doorvoer, JSON parsing en in-memory SQLite database.
▶ Start Volledige Benchmark
📋 Kopieer Rapport
--
/ 100
Klaar
Klik start voor meting
Rekenkundige algoritmes en cryptografische hashing op de webserver CPU.
▶ Test Alleen CPU
Fysieke schrijf- en leessnelheid naar de tijdelijke serveropslag (SSD/NVMe).
▶ Test Alleen Disk I/O
Allocatie, manipulatie en serialisatie van complexe datastructuren in het werkgeheugen.
▶ Test Alleen RAM
JSON encoding, decoding en RegEx parsing op gestructureerde data.
▶ Test Alleen String
2.500 transacties met inserts, indexeringen en aggregatiequeries.
▶ Test Alleen Database
Server Software:
= htmlspecialchars($serverSoftware); ?>
PHP Memory Limit:
= ini_get('memory_limit'); ?>
Max Execution Time:
= ini_get('max_execution_time'); ?>s
OPcache Status:
Detecteren...
🔄 Ververs Specs
Kies het aantal calls en klik op "Start Burst".
Requests Per Seconde
-- RPS