cache.php
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* Summary of caching
*/
require_once "WEB-INF/php/inc.php";
if ($server_id) {
$mbean_server = new MBeanServer($server_id);
if (! $mbean_server) {
$title = "Resin: Cache for server $server_id";
display_header("thread.php", $title, $server);
echo "<h3 class='fail'>Can't contact $server_id</h3>";
return;
}
}
else
$mbean_server = new MBeanServer();
if ($mbean_server) {
$resin = $mbean_server->lookup("resin:type=Resin");
$server = $mbean_server->lookup("resin:type=Server");
$block_cache = $mbean_server->lookup("resin:type=BlockManager");
$proxy_cache = $mbean_server->lookup("resin:type=ProxyCache");
}
$title = "Resin: Cache";
if (! empty($server->Id))
$title = $title . " for server " . $server->Id;
?>
<?php display_header("cache.php", $title, $server) ?>
<h2>Server: <?= $server->Id ?></h2>
<table class="data">
<tr title="Percentage of requests that have been served from the proxy cache:">
<th>Proxy cache miss ratio:</th>
<td><?= format_miss_ratio($proxy_cache->HitCountTotal,
$proxy_cache->MissCountTotal) ?></td>
</tr>
<tr title="Percentage of requests that have been served from the proxy cache:">
<th><?= info("Block cache miss ratio") ?>:</th>
<td><?= format_miss_ratio($block_cache->HitCountTotal,
$block_cache->MissCountTotal) ?></td>
</tr>
<!-- XXX: show how cacheable apps are: cacheable/non-cacheable -->
<tr>
<th>Invocation miss ratio:</th>
<td><?= format_miss_ratio($server->InvocationCacheHitCountTotal,
$server->InvocationCacheMissCountTotal) ?></td>
</tr>
</table>
<?php
if ($proxy_cache) {
$cacheable = $proxy_cache->getCacheableEntries(15);
echo "<h3>Cacheable Pages</h3>";
echo "<table class='data'>";
echo "<tr><th>Count</th><th>url</th></tr>\n";
foreach ($cacheable as $item) {
echo "<tr>";
echo "<td>{$item->hitCount}</td><td>{$item->url}</td>";
echo "</tr>\n";
}
echo "</table>";
$uncacheable = $proxy_cache->getUncacheableEntries(15);
echo "<h3>Uncacheable Pages</h3>";
echo "<table class='data'>";
echo "<tr><th>Count</th><th>url</th></tr>\n";
foreach ($uncacheable as $item) {
echo "<tr>";
echo "<td>{$item->missCount}</td><td>{$item->url}</td>";
echo "</tr>\n";
}
echo "</table>";
}
?>
<?php display_footer("cache.php"); ?>