'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;
$chunks = 48; // ~3 MB
$dummyData = str_repeat('WPCStudio2026_TEST_STRING_ABCD!', 2048);
$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);
$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 actief',
'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'
];
}
// Routing voor AJAX verzoeken
if (isset($_GET['action'])) {
header('Content-Type: application/json; charset=utf-8');
if ($_GET['action'] === 'ping') {
echo json_encode([
'status' => 'pong',
'timestamp' => microtime(true),
'server_time' => date('H:i:s.u')
]);
exit;
}
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; }
if ($_GET['action'] === 'bench_all') {
$cpu = benchmarkCPU();
$mem = benchmarkMemory();
$disk = benchmarkDiskIO();
$str = benchmarkStringJSON();
$db = benchmarkDatabase();
$opcache = getOpcacheInfo();
$score = 0;
$score += min(25, round((($cpu['raw_ops'] ?? 0) / 150000) * 25));
$score += min(20, round((($mem['raw_ops'] ?? 0) / 200000) * 20));
$score += min(25, round((($disk['write_speed_mb_s'] ?? 0) / 300) * 25));
$score += min(15, round((($str['raw_ops'] ?? 0) / 35000) * 15));
if ($db['status'] === 'success') {
$score += min(15, round((($db['raw_tps'] ?? 0) / 20000) * 15));
} else {
$score += ($opcache['enabled'] ? 12 : 8);
}
$finalScore = max(35, min(100, $score));
if ($finalScore >= 90) {
$grade = 'A+'; $rating = 'Superieur (Enterprise Snelheid)'; $color = '#34d399';
} elseif ($finalScore >= 80) {
$grade = 'A'; $rating = 'Uitstekend (Snelle Server)'; $color = '#38bdf8';
} elseif ($finalScore >= 70) {
$grade = 'B'; $rating = 'Goed (Solide Webhosting)'; $color = '#fbbf24';
} else {
$grade = 'C'; $rating = 'Voldoende (Basis)'; $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;
}
echo json_encode(['status' => 'error', 'message' => 'Onbekend verzoek']);
exit;
}
date_default_timezone_set('Europe/Amsterdam');
$phpVersion = PHP_VERSION;
$serverSoftware = $_SERVER['SERVER_SOFTWARE'] ?? 'Apache / Nginx';
?>
Web & PC Studio - Webserver Benchmark
Webserver Performance Suite
Meet CPU rekenkracht, NVMe Disk I/O schrijf/leessnelheid, RAM geheugendoorvoer en gelijktijdige request-capaciteit van de server.
⥠Volledige Server Benchmark
Voert in ÊÊn geautomatiseerde cyclus alle 5 hardware- & softwaretests uit op server.webenpcstudio.nl.
--
/ 100
Klaar
Klik start voor meting
Eerste meting
0 eerdere benchmarks opgeslagen
Laatste meting
Rekenkundige algoritmes en cryptografische hashing cycli.
Fysieke schrijf- en leessnelheid naar server temp opslag (NVMe/SSD).
Allocatie, sorteren en serialisatie in PHP werkgeheugen.
JSON encoding, decoding en RegEx patroonvergelijking.
2.500 transacties met inserts, indexeringen en aggregaties.
| Webserver: |
= htmlspecialchars($serverSoftware); ?> |
| Memory Limit: |
= ini_get('memory_limit'); ?> |
| Execution Time: |
= ini_get('max_execution_time'); ?>s |
| OPcache: |
Actief |
Klik op "Start Burst" om gelijktijdige calls af te vuren.
Requests / Seconde
-- RPS