Re: Global data concurrent access ?
- From: "Michael Petrotta" <mpetrotta@xxxxxxxxx>
- Date: 8 Jan 2007 14:27:42 -0800
Jon wrote:
Michael Petrotta <mpetrotta@xxxxxxxxx> wrote:
Jon wrote:
Next in line: how expensive is making a database connection these days?
That may have been a rhetorical question, but I happen to have just
written a little test to figure out how pooled versus unpooled
connections performed. The code below is executing the same simple
stored procedure 1000 times, from a 3.4GHz Xeon box to a 3.6GHz Xeon
box about four network hops away.
No pooling 1000 iterations. Elapsed time: 00:00:12.9217096
Pooling 1000 iterations. Elapsed time: 00:00:01.0624864
That's about 12ms per round-trip for a non-pooled connection, and 1ms
per for a pooled connection (I was trying to prove that pooling didn't
produce an order of magnitude performance improvement, and I was
obviously wrong).
Out of interest, what happens to the figures if:
1) You're on the same box?
No pooling 1000 iterations. Elapsed time: 00:00:06.0936720
Pooling 1000 iterations. Elapsed time: 00:00:00.2499968
2) You're only one network hop away?
No pooling 1000 iterations. Elapsed time: 00:00:12.7683600
Pooling 1000 iterations. Elapsed time: 00:00:00.2904176
Interesting. The results are repeatable, but it's not a perfect test
(in particular, the client for #2 is a much slower laptop).
If I take the results at face value, it seems to say that network speed
affects pooled connections (makes sense; there's not much connection
setup and teardown with pooled connections. It's just the time taken
to get the query and results over the wires).
I think the speed of my laptop is affecting the non-pooled test; it's
taking time to have ADO.NET set up and tear down the connection.
Unfortunately, our network architecture is such that it's hard to have
two powerful desktops closely connected.
(The speed of pooled connections in general surprised me, when I first
ran this test. I'd assumed network latency would give me round-trip
times around 10-20ms. Pings to the server are also returning
sub-millisecond times. Remember modems and their 200ms pings?)
Michael
.
- Follow-Ups:
- Re: Global data concurrent access ?
- From: Jon Skeet [C# MVP]
- Re: Global data concurrent access ?
- References:
- Global data concurrent access ?
- From: Kunal
- Re: Global data concurrent access ?
- From: Chris Mullins [MVP]
- Re: Global data concurrent access ?
- From: Jon Skeet [C# MVP]
- Re: Global data concurrent access ?
- From: Chris Mullins [MVP]
- Re: Global data concurrent access ?
- From: Jon Skeet [C# MVP]
- Re: Global data concurrent access ?
- From: Michael Petrotta
- Re: Global data concurrent access ?
- From: Jon Skeet [C# MVP]
- Global data concurrent access ?
- Prev by Date: Re: How to differentiate between a program launched manually and launched by a windows task scheduler ???
- Next by Date: WebRequest timeout changed declaratively
- Previous by thread: Re: Global data concurrent access ?
- Next by thread: Re: Global data concurrent access ?
- Index(es):
Relevant Pages
|