You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org> on 2005/03/07 21:43:52 UTC

[jira] Created: (DIR-108) Server PDU are splitted in small chunks

Server PDU are splitted in small chunks
---------------------------------------

         Key: DIR-108
         URL: http://issues.apache.org/jira/browse/DIR-108
     Project: Directory
        Type: Improvement
    Reporter: Emmanuel Lecharny
    Priority: Minor


PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIR-108) Server PDU are splitted in small chunks

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=history ]

Emmanuel Lecharny updated DIR-108:
----------------------------------

    Attachment: Chunked.png
                Unchunked.png

I've done some tests based on the 0.9 Apache DS and the same version with the patch I've attached in a previous comment. Here are both screenshot of the same JMeter run : the un-chunked version has a 5 x times better througput than the original version (only one thread requestiong 1000 times the same thing...).

I agree with Alex and David. Rewritting the whole codec will certainly improve performance a lot. Let's do it, and do it now ! I think that the encoding part is the most important one as it's the one that send search results.

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor
>  Attachments: Chunked.png, Unchunked.png, mina.diff
>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by Alex Karasulu <ao...@bellsouth.net>.
Thanks Dave for the heads up.

Alex

David Boreham (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60471 ]
>     
>David Boreham commented on DIR-108:
>-----------------------------------
>
>I've written and re-written this code in 
>other products. Some random thoughts:
>
>Encode the bits in-place. That is, where
>you have an entry for a search result
>in your hand, go call whatever code generates the BER, right there. Accumulate the BER bits in a buffer, do not attempt
>to send immediately, unless the buffer overflows. Do not store some intermediate symbolic representation of the data : just make the BER. This is safe to do because you are always generating BER left to right,
>and have no need to retrace your steps.
>
>Flush the buffer (only) every time you send a
>response PDU (search result done in the
>case of a search). This ensures that you
>coalesce a search entry PDU with the search result done PDU into one TCP segment.
>Doing this can deliver a significant 
>performance benefit.
>
>In some client/server scenarios you will
>find it beneficial to disable nagle on the 
>TCP session.
>
>Don't worry about UDP : nobody uses it.
>
>
>
>
>  
>
>>Server PDU are splitted in small chunks
>>---------------------------------------
>>
>>         Key: DIR-108
>>         URL: http://issues.apache.org/jira/browse/DIR-108
>>     Project: Directory
>>        Type: Improvement
>>    Reporter: Emmanuel Lecharny
>>    Priority: Minor
>> Attachments: mina.diff
>>
>>PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.
>>    
>>
>
>  
>


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "David Boreham (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60471 ]
     
David Boreham commented on DIR-108:
-----------------------------------

I've written and re-written this code in 
other products. Some random thoughts:

Encode the bits in-place. That is, where
you have an entry for a search result
in your hand, go call whatever code generates the BER, right there. Accumulate the BER bits in a buffer, do not attempt
to send immediately, unless the buffer overflows. Do not store some intermediate symbolic representation of the data : just make the BER. This is safe to do because you are always generating BER left to right,
and have no need to retrace your steps.

Flush the buffer (only) every time you send a
response PDU (search result done in the
case of a search). This ensures that you
coalesce a search entry PDU with the search result done PDU into one TCP segment.
Doing this can deliver a significant 
performance benefit.

In some client/server scenarios you will
find it beneficial to disable nagle on the 
TCP session.

Don't worry about UDP : nobody uses it.




> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor
>  Attachments: mina.diff
>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "Trustin Lee (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60476 ]
     
Trustin Lee commented on DIR-108:
---------------------------------

Hi,

I looked at the patch, and now I realized ApacheDS LDAP encoder generates arrays of ByteBuffers.  If it is always like that, we would be able to set up a rule that an array of ByteBuffers are to be merged.  So I think merging that patch seems to be OK at all.  WDYT?

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor
>  Attachments: Chunked.png, Unchunked.png, mina.diff
>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60411 ]
     
Emmanuel Lecharny commented on DIR-108:
---------------------------------------

I've checked the way those PDU are created, and I think that the best place to merge the chunks could be in the encoder. Actually, every Tuple generates a ByteBuffer and push it on a stack, which is sent by MINA. An encoder that merge all those little chunks could help to improve this behavior.

Of course, for very large PDU like Search results, we will have to deal with the memory footprint in the same way we should do it for the decoding process.

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor

>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIR-108) Server PDU are splitted in small chunks

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=history ]

Emmanuel Lecharny updated DIR-108:
----------------------------------

    Attachment: mina.diff

A workaround that merge the chunks. It seems to work, I still have to evaluate the performance impact of this modification. 

I repeat : it's nothing else but a workaround. It's ugly...

+1 for a modification at the decoder level, but it will be a lot of work ...

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor
>  Attachments: mina.diff
>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60429 ]
     
Alex Karasulu commented on DIR-108:
-----------------------------------

I agree Trustin re: changes to encoder.  This is something we should factor into a redesign making sure the encoder decoder line up with MINA for maximum performance gains.

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor

>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "Trustin Lee (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60402 ]
     
Trustin Lee commented on DIR-108:
---------------------------------

This issue has been resolved in APSEDA, but MINA doesn't merge fragments of bytebuffers now.  It would be nice if MINA can handle this.  I can add ProtocolDecoderOutput.mergeAll() method to let ProtocolDecoders can merge fragmented ByteBuffers into a single ByteBuffer.  I'll also have to modify MINA's Asn1Encoder.

But I'm afraid that Asn1Encoder would not be able to work against UDP because there is a possibility that one message can generate two or more packets and modified version will merge them into one packet.  It would be the best if ASN1 codec modify its interface to provide a method that is directly mapped to ProtocolDecoderOutput.mergeAll().

WDYT, Alex?

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor

>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "Trustin Lee (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60483 ]
     
Trustin Lee commented on DIR-108:
---------------------------------

I fixed MINA Asn1Encoder using new mergeAll() method in ProtocolEncoderOutput.

Here's the change I've made:

http://svn.apache.org/viewcvs?view=rev&rev=156608

I think it is less efficient in performance than the patch, but it effectively removed duplication of code.

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor
>  Attachments: Chunked.png, Unchunked.png, mina.diff
>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIR-108) Server PDU are splitted in small chunks

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIR-108?page=comments#action_60470 ]
     
Alex Karasulu commented on DIR-108:
-----------------------------------

Look why don't we just rewrite this thing top to bottom with this consideration in mind.  Let's hand write the LDAP codec with all the optimizations making sure its as fast as lightning and fits into MINA like a hand in a glove.
 

> Server PDU are splitted in small chunks
> ---------------------------------------
>
>          Key: DIR-108
>          URL: http://issues.apache.org/jira/browse/DIR-108
>      Project: Directory
>         Type: Improvement
>     Reporter: Emmanuel Lecharny
>     Priority: Minor
>  Attachments: mina.diff
>
> PDU that are created by ApacheDS server are sent back in small chunk. A lot of IP packets are necessary to reconstruct the LDAP message : typically, each TLV is sent as a TCP packet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira