Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-8054

Let serialize only valuable part of GridLongList

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4
    • 2.7
    • messaging

    Description

      Here in GridLongList we serialize all elements and don't take into account `idx` value:

      @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { 
      
              writer.setBuffer(buf); 
      
        
      
              if (!writer.isHeaderWritten()) { 
      
                  if (!writer.writeHeader(directType(), fieldsCount())) 
      
                      return false; 
      
        
      
                  writer.onHeaderWritten(); 
      
              } 
      
        
      
              switch (writer.state()) { 
      
                  case 0: 
                      if (!writer.writeLongArray("arr", arr)) 
      
                          return false; 
      
        
      
                      writer.incrementState(); 
      
        
      
                  case 1: 
      
                      if (!writer.writeInt("idx", idx)) 
      
                          return false; 
      
        
      
                      writer.incrementState(); 
      
        
      
              } 
      
        
      
              return true; 
      
          } 

      Which is not happening in another serialization method in the same class:

      public static void writeTo(DataOutput out, @Nullable GridLongList list) throws IOException { 
      
              out.writeInt(list != null ? list.idx : -1); 
      
        
      
              if (list != null) { 
      
                  for (int i = 0; i < list.idx; i++) 
      
                      out.writeLong(list.arr[i]); 
      
              } 
      
      } 

      So, we can simply reduce messages size by sending only a valuable part of the array.

      I created this issue according to a discussion on the mailing list:

      http://apache-ignite-developers.2346864.n4.nabble.com/Optimize-GridLongList-serialization-td28571.html

      Attachments

        Issue Links

          Activity

            People

              sharpler Alexander Menshikov
              sharpler Alexander Menshikov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: