Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-1095

Seems like the management f UDP sessions is really unneficient

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.19
    • 2.1.3, 2.0.23
    • None
    • None

    Description

      When we process incoming UDP messages, we iterate over the activated {{SelectionKey}}s. That's ok, but for each one of them, we read the data and try to flush the scheduled messages. The loop where it's done seems to iterate on all the managed sessions, for each keys we are processing :

         private void processReadySessions(Set<SelectionKey> handles) {
              Iterator<SelectionKey> iterator = handles.iterator();
      
              while (iterator.hasNext()) {
                  SelectionKey key = iterator.next();
                  DatagramChannel handle = (DatagramChannel) key.channel();
                  iterator.remove();
      
                  try {
                      if (key.isValid() && key.isReadable()) {
                          readHandle(handle);
                      }
      
                      if (key.isValid() && key.isWritable()) {
                          for (IoSession session : getManagedSessions().values()) {
                              scheduleFlush((NioSession) session);
      ...
      

      There is no reason to do so. First, we should not iterate on all the managed sessions (we may have thousands), but only the sessions which have something to write, and we certainly should not do that for every active key...

      Attachments

        Activity

          People

            johnnyv Jonathan Valliere
            elecharny Emmanuel L├ęcharny
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: