Class 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:
    Serialized Form
    • Field Summary

      • Fields inherited from class jakarta.servlet.http.HttpServlet

        LEGACY_DO_HEAD
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doGet​(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)  
      String getServletInfo()  
      • 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
    • Constructor Detail

      • AverageSystemLoadServlet

        public AverageSystemLoadServlet()
    • Method Detail

      • 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