aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms-public.gathering.org
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly@.no>2016-03-26 03:48:12 +0100
committerKristian Lyngstol <kly@kly@.no>2016-03-26 03:48:12 +0100
commit004f4efcfd0779f4307b90fed139dc87d01ad0b9 (patch)
treef63bef356ae23f63e81e79d54c2cc911c4937004 /web/nms-public.gathering.org
parent25409cdc01450279ce56b78ce962956a9990a175 (diff)
NMS: Various performance tweaks
Diffstat (limited to 'web/nms-public.gathering.org')
-rwxr-xr-xweb/nms-public.gathering.org/api/public/dhcp-summary7
-rwxr-xr-xweb/nms-public.gathering.org/api/public/ping6
2 files changed, 4 insertions, 9 deletions
diff --git a/web/nms-public.gathering.org/api/public/dhcp-summary b/web/nms-public.gathering.org/api/public/dhcp-summary
index dd643b2..a0e5609 100755
--- a/web/nms-public.gathering.org/api/public/dhcp-summary
+++ b/web/nms-public.gathering.org/api/public/dhcp-summary
@@ -5,16 +5,11 @@ use warnings;
use nms::web;
nms::web::setwhen('2h');
-my $q = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp;");
-$q->execute();
-while (my $ref = $q->fetchrow_hashref()) {
- $nms::web::json{'dhcp'}{'total'} = $ref;
-}
my $q2 = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp where $nms::web::when;");
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
- $nms::web::json{'dhcp'}{'recent'} = $ref;
+ $nms::web::json{'dhcp'} = $ref;
}
$nms::web::cc{'max-age'} = "10";
$nms::web::cc{'stale-while-revalidate'} = "15";
diff --git a/web/nms-public.gathering.org/api/public/ping b/web/nms-public.gathering.org/api/public/ping
index ba572af..db46b00 100755
--- a/web/nms-public.gathering.org/api/public/ping
+++ b/web/nms-public.gathering.org/api/public/ping
@@ -4,7 +4,7 @@ use strict;
use warnings;
use nms::web;
-#nms::web::setwhen('1s');
+nms::web::setwhen('10s');
my $q = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) (now() - time) as age,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE time in (select max(time) from ping where "
. $nms::web::when . " group by switch)");
@@ -32,6 +32,6 @@ while ( my $ref = $lq->fetchrow_hashref() ) {
$nms::web::json{'linknets'}{$ref->{'linknet'}} = [ $ref->{'latency1_ms'}, $ref->{'latency2_ms'} ];
}
-$nms::web::cc{'max-age'} = "1";
-$nms::web::cc{'stale-while-revalidate'} = "5";
+$nms::web::cc{'max-age'} = "2";
+$nms::web::cc{'stale-while-revalidate'} = "15";
finalize_output();