]> andersk Git - sql-web.git/blobdiff - tpl/index.php
show service stats on index
[sql-web.git] / tpl / index.php
index 22a3aa750d3d4bdd9d3b424777265ca6613e0929..26ce4e87b83f677f29dd5c699a36946b65b8c1c9 100644 (file)
@@ -1,60 +1,55 @@
 <?php
 include 'head.php';
-/*
-<strong>Important Notice:</strong><p> This is a beta service and is not yet ready for use in data intensive applications.
-
-<hr />
-
-<br />
-*/
 ?>
-<h2>About</h2>
-
-<p>
-This service provides <a href="http://www.mysql.com/">MySQL</a> databases to <a href="http://ca.mit.edu/">Athena account</a> holders.
-You must choose a MySQL password (independent of your Athena account) when you <a href="signup">Signup</a> and then use this interface to create and drop databases.
-All subsequent SQL commands can be issued from any host, client, and/or script of your choosing.
-</p>
-
-<h2>Backups</h2>
-
-<p>
-<strong>We strongly recommend you keep backups of your SQL schema and data.</strong>
-As you work with your SQL data, it is automatically saved on an additional secondary SQL server for restoration in the event of a server failure.
-Although we continually put forth our best efforts, we can make no guarantees on the reliability of the service and access to the data.
-</p>
-
-<h2>Quotas</h2>
-
-<p>
-By default, new users can create up to <strong>5 databases</strong>, consuming a total of <strong>25 megabytes</strong> of SQL data.
-The system will periodically check your database sizes and suspend creation of new data (INSERT statements) if your total usage exceeds your allotted quota.
-</p>
-
-<p>
-This service is not designed to store gratuitous amounts of information in the BLOB or BINARY formats. Extra quota space will not be allotted to users for this type of data.
-Users should instead store these types of data in AFS and use SQL tables only to catalogue it.
-</p>
 
 <p>
-<strong>Always use this interface to create and drop databases.</strong>
-Although you can drop any of your databases outside this interface, doing so will not relinquish your rights to that database and will therefore still count against your quota.
+This service provides <a target="_blank" href="http://dev.mysql.com/doc">MySQL</a> databases to <a target="_blank" href="http://ca.mit.edu/">MIT certificate</a> holders.
+You must choose a MySQL password (which should be different from your Athena account password) when you <a href="do/signup">sign up</a>, and
+then use this interface to create and drop databases.  All subsequent SQL commands can be issued from any host, client, and/or script of your choice;
+simply connect to the MySQL server at <b>sql.mit.edu</b> using your username and your new MySQL password.
+You may find it convenient to run scripts using the <a target="_blank" href="http://scripts.mit.edu/web">web script service</a> or
+<a target="_blank" href="http://scripts.mit.edu/cron">shortjobs service</a>.
 </p>
 
-<h2>Disclaimer</h2>
-
 <p>
-We reserve the right to suspend or terminate your MySQL account at any time and for any or no reason.
+All uses of this service must comply with the <a target="_blank" href="http://web.mit.edu/olh/Welcome/rules.html">MITnet rules of use</a>.
 </p>
 
 <p>
-We perform no query logging, schema or data backups, or any other backups otherwise generally available. You are solely responsible for performing backups of your data.
+This service has been designed with reliability in mind; we utilize RAID, live server mirroring and periodic offline backups to ensure data reliability.
+However, the SIPB MySQL service should not be used to host critical applications that cannot tolerate downtime.
+One nightly backup is available for your locker at <code>/mit/sql/backup/LOCKER_NAME</code>.  You should perform additional backups of your data using the <a href="http://scripts.mit.edu/cron">shortjobs service</a> or <a href="http://scripts.mit.edu/faq/10/how-can-i-back-up-or-restore-my-sql-data">phpMyAdmin</a>.
 </p>
 
-<p>
-We maintain general usage statistics of this service by the MIT community at large.
-</p>
+<div style="text-align:center; font-style: italic;">
+<?php
+if (!file_exists('/mit/sql/web_tmp/stat') || filemtime('/mit/sql/web_tmp/stat')+3600<time()) {
+       $x = fetchRows(DBSelect("SHOW STATUS WHERE Variable_name IN ('Questions','Uptime')"),'Variable_name');
+       $v = $x['Questions']['Value'];
+       $t = $x['Uptime']['Value'];
+       file_put_contents('/mit/sql/web_tmp/stat',implode("\n",array($v,$t)));
+} else {
+       $x = file_get_contents('/mit/sql/web_tmp/stat');
+       list($v, $t) = explode("\n", $x);
+}
+$qavg = $v/$t;
+$qunits = array('','k','M','G','T','P','E','Z','Y');
+while (count($qunits) && $v/1000>1) {
+       array_shift($qunits);
+       $v /= 1000;
+}
+printf('sql.mit.edu has served %.3f%s queries', $v, array_shift($qunits));
+
+$qunits = array('minutes', 'hours', 'days');
+$qdiv = array(60, 60, 24);
+while (count($qdiv) && $t/$qdiv[0]>0) {
+       $t /= array_shift($qdiv);
+       $tunits = array_shift($qunits);
+}
+printf(' in the last %.2f %s (%.2f qps)', $t, $tunits, $qavg);
+?>
+</div>
 
 <?php
 include 'foot.php';
-?>
\ No newline at end of file
+?>
This page took 0.032108 seconds and 4 git commands to generate.