Hey Ian, On Thu, Jul 24, 2014 at 4:03 AM, Ian Booth <[email protected]> wrote: > However, doing a session.Copy() each time the transaction log collection is > queried (every 5 seconds) causes a number of test failures when the host > machine > is heavily loaded. Either extra events are received or events are missed. > > Can anyone explain what's going on here? Why does copying a session affect > what's read from the txn log collection?
Would be good to have more details about the failure scenario, but I can provide a few general hints that have a chance of being helpful. What session.Copy does when a session is in Strong mode (the default one) is to take a new socket out of the pool, or to establish a new connection if that's required. So whatever side-effect you're observing is a direct consequence of that. One way this might be causing trouble, considering that we're talking about test cases that involve timing somehow, and that the scenario you describe is also of a heavily loaded system, is by skewing the clock. It's much more expensive to establish a new connection than to send data via a socket at hand. Another way it changes the situation is by increasing concurrency. If there are two tasks being concurrently done in Go but reaching out to the database via the same Strong session, they'll be serialized on their way out. With multiple Strong sessions, each has its own connection related to its own server thread, and can carry out the requests concurrently for longer. Please let me know if that helps or whether you have more details. gustavo @ http://niemeyer.net -- Juju-dev mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
