Keshtocal
Keshtocal

Reputation: 162

Gwt Atmosphere 1 Million long polling requests per hour

We have currently the problem, that our gwt web application is sending 1 million long-polling atmosphere calls per hour to the tomcat, when you have it opened.

They are answered directly with 200 and with empty response body.

We have a scheduler, that triggers the push every 60 seconds to refresh the data in the client.

Still, the long-polling is not waiting for the push.

We have a similar application where it is working with the same configuration.

Can it be a problem with a tomcat configuration or some authentication configuration problem?

Did someone had a similar issue?

Example Call:

URL/app/atmosphere/rpc?clientId=62831CFA-96E1-46E9-BFC8-AD3A02B59A79&eventType=dashboardnotification&X-Atmosphere-tracking-id=aab2c72d-9fbd-4cc6-a9a2-8c9191f19a4c&X-Atmosphere-Framework=3.0.0-javascript&X-Atmosphere-Transport=long-polling&Content-Type=text%2Fx-gwt-rpc%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1730362560535

Client code:

@Bean
   public ServletRegistrationBean<AtmosphereServlet> atmosphereServlet() throws ServletException {
      AtmosphereServlet atmosphereServlet = new AtmosphereServlet();
      atmosphereServlet.framework().addAtmosphereHandler("/app/atmosphere/rpc", new GwtRpcAtmosphereHandler(),
         Arrays.asList(new GwtRpcInterceptor(),
            // Proxies and firewalls can sometimes close inactive connections. To prevent them from closing a connection
            // when
            // using streaming, server side events or websocket transport, you can install an heartbeat
            // AtmosphereInterceptor
            // that will write whitespace after 60 seconds of inactivity, keeping the connection active.
            new HeartbeatInterceptor()));
      // Preventing Out Of Memory
      // Using shareable ExecutorServices
      // If your application creates a lot of Broadcasters, you may experience some Out Of Memory error because too many
      // instances of ExecutorServices have been created, e.g number of broadcaster * 3. If that's the case, you can
      // configure Atmosphere to share ExecutorServices amongst Broadcasters.
      atmosphereServlet.framework().addInitParameter(ApplicationConfig.BROADCASTER_SHARABLE_THREAD_POOLS, "true");
      // Configuring the maximum threads used by a Broadcaster.
      // To configure the maximum threads created by the Broadcaster of the message delivery
      atmosphereServlet.framework()
         .addInitParameter(ApplicationConfig.BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE, "10");
      atmosphereServlet.framework()
         .addInitParameter(ApplicationConfig.BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE, "10");
      // The heartbeat frequency, in seconds.
      // Default: 60
      atmosphereServlet.framework().addInitParameter(ApplicationConfig.HEARTBEAT_INTERVAL_IN_SECONDS, "60");
      atmosphereServlet.framework().addInitParameter(ApplicationConfig.CLIENT_HEARTBEAT_INTERVAL_IN_SECONDS, "60");
      
      ServletRegistrationBean<AtmosphereServlet> servletRegistrationBean = new ServletRegistrationBean<AtmosphereServlet>(
         atmosphereServlet,
         "/app/atmosphere/*");
      servletRegistrationBean.setName("AtmosphereServlet");
      servletRegistrationBean.setAsyncSupported(true);
      servletRegistrationBean.setLoadOnStartup(1);
      
      return servletRegistrationBean;
   }

I also found this error in the browser console, but it is only shown once. Can it be depending to this problem?

com.google.gwt.core.client.JavaScriptObject$
SEVERE: Failed to deserialize message: b07f16d9-82a2-447e-90c8-790d53bbf3d1|60000|X|
com.google.gwt.user.client.rpc.SerializationException: java.lang.NumberFormatException: For input string: ""
    at Unknown.xi(app-0.js)
    at Unknown.new Dsc(app-0.js)
    at Unknown.Tvd(app-0.js)
    at Unknown.wMg(app-0.js)
    at Unknown.eval(app-0.js)
    at Unknown.HX(app-0.js)
    at Unknown.KX(app-0.js)
    at Unknown.eval(app-0.js)
    at Unknown.m(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
    at Unknown.al(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
    at Unknown.ai(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
    at Unknown.aK.onreadystatechange(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
Caused by: java.lang.NumberFormatException: For input string: ""
    at Unknown.ii(app-0.js)
    at Unknown.wi(app-0.js)
    at Unknown.zi(app-0.js)
    at Unknown.apg(app-0.js)
    at Unknown.new bqg(app-0.js)
    at Unknown.BQ(app-0.js)
    at Unknown.Hyc(app-0.js)
    at Unknown.Tvd(app-0.js)
    at Unknown.wMg(app-0.js)
    at Unknown.eval(app-0.js)
    at Unknown.HX(app-0.js)
    at Unknown.KX(app-0.js)
    at Unknown.eval(app-0.js)
    at Unknown.m(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
    at Unknown.al(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
    at Unknown.ai(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)
    at Unknown.aK.onreadystatechange(https://mes-dev.web.porsche.de/axm/js/atmosphere-3.0.0.min.js)

Upvotes: 0

Views: 20

Answers (0)

Related Questions