Archive

Posts Tagged ‘JSP’

Checking memory usage of your server in Java website hosting

December 5th, 2009 Karthikeyan C No comments

If you host your website on a JEE web or application server on a shared hosting plan (either private or shared instance), you may use the JSP code below to check the memory usage of your server. This will help you to know if the web hosting company really provides you what they promised. This is a simple but efficient tool.


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>Your title here</title>
 </head>
 <body>
 <h3>Total memory : <%=Runtime.getRuntime().totalMemory()%></h3>
 <h3>Free memory : <%=Runtime.getRuntime().freeMemory()%></h3>
 <h3>Max memory : <%=Runtime.getRuntime().maxMemory()%></h3>
 <h3>Java version : <%=System.getProperties().getProperty("java.version")%></h3>
 </body>
</html>
  • Share/Bookmark
Categories: Tools / Utilities Tags: ,