Instantiating multiple instances in Google App Engine JAVA

I am testing Google App Engine using JAVA and I want to test the parallel execution of multiples instances. However, I don't know how to activate the multiples instances.

I tried to run this servlet in another browser (also I tried to make concurrent calls on another machine - with a different IP address)

import javax.servlet.*;
import javax.servlet.http.*;
import java.math.*;
public class SimpleServlet extends HttpServlet
  //A variable that is NOT thread-safe!

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
    doPost(req, resp);
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
     int counter = 0;
    resp.getWriter().println(this + ": <br>");
    for (int c = 0; c < 10; c++)
      resp.getWriter().println("Counter = " + counter + "<BR>");
        //Thread.currentThread().sleep( 500);
          for (int e=0;e<9999;e++) {

      catch (InterruptedException exc) {
        resp.getWriter().println("I can't sleep<BR>");


Each servlet takes 5 seconds to process, but the requests are bundled into one instance, for example if I run this servlet 10 times, it took 50 seconds to process the last.

I tried using:



but it doesn't do anything.

I tried to change the settings


no luck.

enter image description here

So what can I do?


source to share

1 answer

Once installed <threadsafe>true</threadsafe>

, you will be able to handle parallel requests in one instance. So, if you need to test how your application is performing with multiple active instances, it's best to disable this option.

In addition, you can create a traffic generator to make many requests to your application and thus wake up more than one instance.



All Articles