6 Replies Latest reply on May 7, 2010 11:51 AM by Clebert Suconic

    Performance when starting up many TopicSubscribers

    Matthew Smith Newbie

      I've just started using Hornetq 2.0.0GA embedded in JBoss EAP 4.3.0CP6.Hornetq is using the out of the box configuration.

       

      The app I'm working on will need to register approximately 10,000 topic subscribers (with associated message listeners) at startup and it is time criticial. I've written a simple stub app to try out performance. Starting up 10,000 listeners takes about 7 minutes (WinXP, JVM 6.0_16, 3.0Ghz Xeon). I think this is going to be too slow. Can anyone suggest any ways to speed this up?
      Creating the subscribers concurrently/in serial doesn't make much difference and neither does creating multiple sessions compared to sharing sessions. I've tried using both the Netty and in-vm connection factories and it doesn't make any difference either. I haven't changed any defaults.
      I've included some of the listener creation source below, from my session sharing, non-concurrent version. The connection factory is looked up from JNDI.
      Cheers,
      Matthew
      From AsycnhronousTopicListenerManager:
      ...
      connection = connectionFactory.createTopicConnection();
      session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      listeners = new ArrayList<AsynchronousTopicListener>(listenersCount);
      Collection<Callable<Void>> tasks = new Vector<Callable<Void>>();
      int i;
      for(i = 0; i < listenersCount; i++) {
      AsynchronousTopicListener listener;
      listener = new AsynchronousTopicListener(Integer.toString(i), session, topic);
      listeners.add(listener);
      Log.info(this, "Created listener %s.", i);
      }
      connection.start();
      ...
      From AsychronousTopicListener:
      ...
      public AsynchronousTopicListener(String id, TopicSession session, Topic topic) throws NamingException {
      this.id = id;
      this.session = session;
      this.topic = topic;
      TopicSubscriber subscriber = session.topicSubscriber(topic);
      subscriber.setMessageListener(this);
      }
      ...