On Sep 11, 2012, at 8:27 AM, Oleg Kalnichevski <[email protected]> wrote:
> On Mon, 2012-09-10 at 17:10 -0400, Daniel Kulp wrote: >> On Sep 10, 2012, at 6:13 AM, Oleg Kalnichevski <[email protected]> wrote: >> >>> I think this problem can be easily fixed. If the expected X500Principal >>> is known in advance, one can stick it into the local execution context >>> as ClientContext#USER_TOKEN attribute [1]. This will force the client to >>> request connections with the given state only. >> >> Yep. Worked perfectly. >> >> I committed my latest updates to the sandbox. A little more cleanup and >> I'll likely merge it into the main build. >> >> I did do a pretty big update to the SharedOutputBuffer to better handle the >> case where a large byte[] is passed into the write method. It will now >> avoid copying blocks out of there into the buffer to then copy into the >> encoder. Avoids a bunch of copies. Also avoids a bunch of flipping back >> and forth between threads as the enable/disable output stuff is flipped back >> and forth. >> >> > > Great stuff! Actually one probably could apply similar optimization to > the SharedInputBuffer as well to reduce intermediate buffer copying for > input operations. Just did that. That said, it's much less critical there. Woodstox uses an internal 4000 byte buffer for decoding XML. Thus, under "normal" circumstances, we only get 4K byte[]'s in there. That said, I added a little detection in there so if we DO have to wait for data for the 4K buffer, we'll just read directly into that buffer. JAX-RS and maybe MTOM might pass in larger blocks so they may benefit more. Not really sure. With my simple test case, the updates drop the number of times the main processing thread needed to block for input from about 25% of the time to about 5%. However, this CAN increase the amount of buffer copies. I need to run some tests to see which is worse, they extra byte[] copies that occur on background threads or the waiting by the main thread. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
