Class AverageSystemLoadServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.jboss.test.clusterbench.web.load.AverageSystemLoadServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

@WebServlet(name="AverageSystemLoadServlet", urlPatterns="/averagesystemload") public class AverageSystemLoadServlet extends jakarta.servlet.http.HttpServlet
AverageSystemLoadServlet is used for stressing the server's CPU.

Usage:

You may GET e.g. this URL: http://localhost:8080/clusterbench/averagesystemload?milliseconds=20000&threads=4 By doing so, there will be 4 threads with evil active-loops created. These threads will be running for 20000 milliseconds.

After the aforementioned time, you shall receive a response saying something like:

DONE, I was stressing CPU with 4 evil threads for 20000 milliseconds (including warm-up).

NOTE: Do not forget to set some reasonable time-out on your client... That's it. No more functionality.

Author:
Michal Babacek
See Also:
  • Field Summary

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
     
     

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AverageSystemLoadServlet

      public AverageSystemLoadServlet()
  • Method Details

    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • getServletInfo

      public String getServletInfo()
      Specified by:
      getServletInfo in interface jakarta.servlet.Servlet
      Overrides:
      getServletInfo in class jakarta.servlet.GenericServlet