[Seaside] Re: Scaling Seaside apps (was: About SToR)
cputney at wiresong.ca
Sat Aug 5 19:25:42 UTC 2006
On Aug 5, 2006, at 11:28 AM, Yanni Chiu wrote:
> The protocol returns a row at a time until there no more (indicated
> by a CompletedResponse message, instead of another Row message). It
> seems both Bruce and I chose to implement in such a way that a
> result set is only available after the last row has been received.
> I suppose a better choice (for the future) would return with a
> result set stream as soon as the first row is retrieved. Then add
> additional protocol to return the entire result set by pulling in
> the whole stream contents.
Yeah, that's handy alright. The Squeak MySQL driver does this. The
implementation in the MySQL driver has a significant flaw though, in
that it basically relies on the client reading rows from the stream
to cause the driver to read bytes from the socket. This leads to
problems when the client fails to read all the rows that were
returned. If there is an error and reading is curtailed, the user
cancels the action or whatever, the row bytes are left in the socket
buffer and the driver gets confused the next time it sends a query
and receives unexpected results.
That's not to say that a result set stream is a bad idea, it just has
to be implemented to so that the driver maintains control over
reading from the socket and can keep a consistent state when the
result stream isn't read completely.
Just a heads up - the problem can be hard to track down and has
caused me lots of grief in the past.
More information about the Seaside