<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 24 Feb 2009, at 18:37, Jason T. Greene wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Manik Surtani wrote:<br><blockquote type="cite">On 24 Feb 2009, at 16:41, Bela Ban wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Manik Surtani wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Yes, but it relies on an open stream between the 2 instances. &nbsp;State is written without a flush, and then a marker is placed on the stream asking the state requester to start a partial flush so that the final tx log can be written to the stream as well.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">IIRC the marker is on the TX log, so you can use either streaming or regular state transfer. Whether or not we use streaming state transfer should be hidden from the caller of Channel.getState()<br></blockquote></blockquote><blockquote type="cite">Nope. &nbsp;Regular state tfr will wait till the entire state is ready and then transfer the byte buffer. &nbsp;This is no good for NBST since, with NBST, here is what happens:<br></blockquote><blockquote type="cite">1. &nbsp;Joiner (Cache B) joins, requests state from Cache A<br></blockquote><blockquote type="cite">2. &nbsp;A generates and starts streaming state to B<br></blockquote><blockquote type="cite">3. &nbsp;When state is transferred, A starts streaming tx log<br></blockquote><blockquote type="cite">4. &nbsp;When remaining tx log is small, A puts a marker on the stream<br></blockquote><blockquote type="cite">5. &nbsp;B sees this marker and requests a flush<br></blockquote><blockquote type="cite">6. &nbsp;Once flush is detected by A, write remaining tx log and *this* ends the state transfer process. &nbsp;7. &nbsp;B releases the flush<br></blockquote><blockquote type="cite">So when using regular state tfr, B will not see the marker placed by A in step 4, since the stream is flushed to a byte buffer and transferred in 6. &nbsp;A will never get to step 6 until B starts a flush in step 5. &nbsp;And for this to happen, state needs to stream across constantly and not wait for the state generation process to complete.<br></blockquote><br>Writing all of your state to a big byte array is a bad idea anyway ;) </div></blockquote><div><br></div><div>Yes. &nbsp;I can see how this can easily lead to OOMs.</div><div><br></div>Cheers</div><div>Manik</div><div><br></div><div>--</div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Manik Surtani</div><div>Lead, JBoss Cache</div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a><br><a href="mailto:manik@jboss.org" target="_blank">manik@jboss.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>