Showing posts with label throughout. Show all posts
Showing posts with label throughout. Show all posts

Thursday, March 29, 2012

Performance Question with Database Connections

I was just wondering what other people's opinions and experiences were in
regards to using Database Connections throughout a website. Supposing that a
single webpage accesses a database anywhere from 5-30 times throughout a
webpage do you prefer to open the database connection upon say
initialization and reuse it elsewhere whenever possible and then dispose of
it upon disposing or do you write 5 - 10 lines of code opening and closing
it every single time you want to use the database.It doesn't really matter much because of the built in database connection
pooling.
Creating a database connection 5 times in a page has no significant
performance penalty, so do it whichever way seems most intuitive for your
web site.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

<johndoe@.driver.net> wrote in message
news:u9lhwP8PEHA.3232@.TK2MSFTNGP11.phx.gbl...
> I was just wondering what other people's opinions and experiences were in
> regards to using Database Connections throughout a website. Supposing that
a
> single webpage accesses a database anywhere from 5-30 times throughout a
> webpage do you prefer to open the database connection upon say
> initialization and reuse it elsewhere whenever possible and then dispose
of
> it upon disposing or do you write 5 - 10 lines of code opening and closing
> it every single time you want to use the database.
I kind of assumed this but there are thousands of scenarios that are coming
to my mind for example if you have 150 - 350 concurrent users accessing a
webpage at once what type of load would this put on with having 350
connections open at one time versus 1000 - 3000 connections opening and
closing, etc so I thought I would see what other people would have to say.

does this
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:O6OStZ8PEHA.1048@.tk2msftngp13.phx.gbl...
> It doesn't really matter much because of the built in database connection
> pooling.
> Creating a database connection 5 times in a page has no significant
> performance penalty, so do it whichever way seems most intuitive for your
> web site.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> <johndoe@.driver.net> wrote in message
> news:u9lhwP8PEHA.3232@.TK2MSFTNGP11.phx.gbl...
>> I was just wondering what other people's opinions and experiences were in
>> regards to using Database Connections throughout a website. Supposing
>> that
> a
>> single webpage accesses a database anywhere from 5-30 times throughout a
>> webpage do you prefer to open the database connection upon say
>> initialization and reuse it elsewhere whenever possible and then dispose
> of
>> it upon disposing or do you write 5 - 10 lines of code opening and
>> closing
>> it every single time you want to use the database.
>>
>>
The connections aren't really opening and closing though, so from a
performance perspective the 2 scenarios scenarios are virtually identical.
So then it comes down to opinion about how you prefer to structure your
code.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

<johndoe@.driver.net> wrote in message
news:%23CE34T9PEHA.3944@.tk2msftngp13.phx.gbl...
> I kind of assumed this but there are thousands of scenarios that are
coming
> to my mind for example if you have 150 - 350 concurrent users accessing a
> webpage at once what type of load would this put on with having 350
> connections open at one time versus 1000 - 3000 connections opening and
> closing, etc so I thought I would see what other people would have to say.
Hmm do Connections Opened with .Open not correlate to SqlConnections
because I know that
New SqlConnection("...") ;
If a .Open is not called an exception is thrown stating the
connection is not thrown.

If the Page takes 1.3 seconds to render from the time Page_Load is
called and the DbConnection is .Open()ed to the time when the page is
finished doing its thinking and .Close()ed is the Connection not "open" ?
versus opening something 10 times.

Upon further reflection, logistically speaking it seems that Opening a
DbConnection might be good for a page that renders quickly versus a page
that might take an extended period of time to complete its rendering
(especially if there is the possibility of many users hitting it at the same
time).
Unless of course they just make us .Open and .Close and throw exceptions
when they are not done so properly just for the fun of it.

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:O4mjGk9PEHA.1348@.TK2MSFTNGP12.phx.gbl...
> The connections aren't really opening and closing though, so from a
> performance perspective the 2 scenarios scenarios are virtually identical.
> So then it comes down to opinion about how you prefer to structure your
> code.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> <johndoe@.driver.net> wrote in message
> news:%23CE34T9PEHA.3944@.tk2msftngp13.phx.gbl...
>> I kind of assumed this but there are thousands of scenarios that are
> coming
>> to my mind for example if you have 150 - 350 concurrent users accessing a
>> webpage at once what type of load would this put on with having 350
>> connections open at one time versus 1000 - 3000 connections opening and
>> closing, etc so I thought I would see what other people would have to
>> say.

Performance Question with Database Connections

I was just wondering what other people's opinions and experiences were in
regards to using Database Connections throughout a website. Supposing that a
single webpage accesses a database anywhere from 5-30 times throughout a
webpage do you prefer to open the database connection upon say
initialization and reuse it elsewhere whenever possible and then dispose of
it upon disposing or do you write 5 - 10 lines of code opening and closing
it every single time you want to use the database.It doesn't really matter much because of the built in database connection
pooling.
Creating a database connection 5 times in a page has no significant
performance penalty, so do it whichever way seems most intuitive for your
web site.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
<johndoe@.driver.net> wrote in message
news:u9lhwP8PEHA.3232@.TK2MSFTNGP11.phx.gbl...
> I was just wondering what other people's opinions and experiences were in
> regards to using Database Connections throughout a website. Supposing that
a
> single webpage accesses a database anywhere from 5-30 times throughout a
> webpage do you prefer to open the database connection upon say
> initialization and reuse it elsewhere whenever possible and then dispose
of
> it upon disposing or do you write 5 - 10 lines of code opening and closing
> it every single time you want to use the database.
>
I kind of assumed this but there are thousands of scenarios that are coming
to my mind for example if you have 150 - 350 concurrent users accessing a
webpage at once what type of load would this put on with having 350
connections open at one time versus 1000 - 3000 connections opening and
closing, etc so I thought I would see what other people would have to say.
does this
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:O6OStZ8PEHA.1048@.tk2msftngp13.phx.gbl...
> It doesn't really matter much because of the built in database connection
> pooling.
> Creating a database connection 5 times in a page has no significant
> performance penalty, so do it whichever way seems most intuitive for your
> web site.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> <johndoe@.driver.net> wrote in message
> news:u9lhwP8PEHA.3232@.TK2MSFTNGP11.phx.gbl...
> a
> of
>
The connections aren't really opening and closing though, so from a
performance perspective the 2 scenarios scenarios are virtually identical.
So then it comes down to opinion about how you prefer to structure your
code.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
<johndoe@.driver.net> wrote in message
news:%23CE34T9PEHA.3944@.tk2msftngp13.phx.gbl...
> I kind of assumed this but there are thousands of scenarios that are
coming
> to my mind for example if you have 150 - 350 concurrent users accessing a
> webpage at once what type of load would this put on with having 350
> connections open at one time versus 1000 - 3000 connections opening and
> closing, etc so I thought I would see what other people would have to say.
Hmm do Connections Opened with .Open not correlate to SqlConnections
because I know that
New SqlConnection("...") ;
If a .Open is not called an exception is thrown stating the
connection is not thrown.
If the Page takes 1.3 seconds to render from the time Page_Load is
called and the DbConnection is .Open()ed to the time when the page is
finished doing its thinking and .Close()ed is the Connection not "open" ?
versus opening something 10 times.
Upon further reflection, logistically speaking it seems that Opening a
DbConnection might be good for a page that renders quickly versus a page
that might take an extended period of time to complete its rendering
(especially if there is the possibility of many users hitting it at the same
time).
Unless of course they just make us .Open and .Close and throw exceptions
when they are not done so properly just for the fun of it.
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:O4mjGk9PEHA.1348@.TK2MSFTNGP12.phx.gbl...
> The connections aren't really opening and closing though, so from a
> performance perspective the 2 scenarios scenarios are virtually identical.
> So then it comes down to opinion about how you prefer to structure your
> code.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> <johndoe@.driver.net> wrote in message
> news:%23CE34T9PEHA.3944@.tk2msftngp13.phx.gbl...
> coming
>

Monday, March 26, 2012

'permanent' web site url while browsing?

Hi all!

Does anyone know of a way to keep a permanent url throughout a user's
browsing?

For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!

How is this accomplished? Maybe some sort of script?

Thanks in advance!use a frame.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

"patrickdrd" <patrickdrd@.discussions.microsoft.comwrote in message
news:FDA51396-2304-4098-9A24-2AB478A8EF88@.microsoft.com...

Quote:

Originally Posted by

Hi all!
>
Does anyone know of a way to keep a permanent url throughout a user's
browsing?
>
For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!
>
How is this accomplished? Maybe some sort of script?
>
Thanks in advance!


No, I don't like frames,
something else?
Hi,

patrickdrd wrote:

Quote:

Originally Posted by

No, I don't like frames,
something else?


Apart from frames of iframes, there are no alternatives using standard
HTML / JavaScript. Even when using URL rewriting, you still need to
provide a unique URL to the server.

Other solutions could be using WPF, Flash or any other type of plug-in.
In these cases, the navigation is not handled by the browser anymore,
but by the plug-in itself.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Even when using URL rewriting, you still need to

Quote:

Originally Posted by

provide a unique URL to the server.


I don't care about the server,
I care about what the client can see,
will the client realize the same url by that?
Hi,

patrickdrd wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

>Even when using URL rewriting, you still need to
>provide a unique URL to the server.


>
I don't care about the server,
I care about what the client can see,
will the client realize the same url by that?


Maybe you don't, but the web browser does care.

It's not possible, except by the solutions already provided to you.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
no

use forms.

So if the user clicks the biteme button, the page shows the biteme stuff.
if the user clicks the bitemybubbles button the page shows the bitemybubbles
stuff

same url the whole time
this is usually done one of 2 way:

1) site frameset
2) model-view-controller pattern (site is just one page)

-- bruce (sqlwork.com)

patrickdrd wrote:

Quote:

Originally Posted by

Hi all!
>
Does anyone know of a way to keep a permanent url throughout a user's
browsing?
>
For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!
>
How is this accomplished? Maybe some sort of script?
>
Thanks in advance!


What about Server.Transfer?

Keep transferring the user to another page. The server knows, the client
doesn't.

This is (kinda) similar to proper MVC, which .NET doesn't really do that
well, in that the context keeps getting forwared somewhere else to handle
the request and provide the view.

"Laurent Bugnion [MVP]" <galasoft-lb@.bluewin.chwrote in message
news:OQlXfg3WHHA.1180@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Hi,
>
patrickdrd wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

>>Even when using URL rewriting, you still need to provide a unique URL to
>>the server.


>>
>I don't care about the server,
>I care about what the client can see,
>will the client realize the same url by that?


>
Maybe you don't, but the web browser does care.
>
It's not possible, except by the solutions already provided to you.
>
Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

'permanent' web site url while browsing?

Hi all!
Does anyone know of a way to keep a permanent url throughout a user's
browsing?
For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!
How is this accomplished? Maybe some sort of script?
Thanks in advance!use a frame.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"patrickdrd" <patrickdrd@.discussions.microsoft.com> wrote in message
news:FDA51396-2304-4098-9A24-2AB478A8EF88@.microsoft.com...
> Hi all!
> Does anyone know of a way to keep a permanent url throughout a user's
> browsing?
> For example, if my web site's address is http://www.mysite.com,
> I have noticed that some sites keep that url 'permanent' somehow,
> i.e. doesn't change while e.g. clicking on a link!
> How is this accomplished? Maybe some sort of script?
> Thanks in advance!
No, I don't like frames,
something else?
Hi,
patrickdrd wrote:
> No, I don't like frames,
> something else?
Apart from frames of iframes, there are no alternatives using standard
HTML / JavaScript. Even when using URL rewriting, you still need to
provide a unique URL to the server.
Other solutions could be using WPF, Flash or any other type of plug-in.
In these cases, the navigation is not handled by the browser anymore,
but by the plug-in itself.
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
> Even when using URL rewriting, you still need to
> provide a unique URL to the server.
I don't care about the server,
I care about what the client can see,
will the client realize the same url by that?
Hi,
patrickdrd wrote:
> I don't care about the server,
> I care about what the client can see,
> will the client realize the same url by that?
Maybe you don't, but the web browser does care.
It's not possible, except by the solutions already provided to you.
Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
no
use forms.
So if the user clicks the biteme button, the page shows the biteme stuff.
if the user clicks the bitemybubbles button the page shows the bitemybubbles
stuff
same url the whole time
this is usually done one of 2 way:
1) site frameset
2) model-view-controller pattern (site is just one page)
-- bruce (sqlwork.com)
patrickdrd wrote:
> Hi all!
> Does anyone know of a way to keep a permanent url throughout a user's
> browsing?
> For example, if my web site's address is http://www.mysite.com,
> I have noticed that some sites keep that url 'permanent' somehow,
> i.e. doesn't change while e.g. clicking on a link!
> How is this accomplished? Maybe some sort of script?
> Thanks in advance!
What about Server.Transfer?
Keep transferring the user to another page. The server knows, the client
doesn't.
This is (kinda) similar to proper MVC, which .NET doesn't really do that
well, in that the context keeps getting forwared somewhere else to handle
the request and provide the view.
"Laurent Bugnion [MVP]" <galasoft-lb@.bluewin.ch> wrote in message
news:OQlXfg3WHHA.1180@.TK2MSFTNGP05.phx.gbl...
> Hi,
> patrickdrd wrote:
> Maybe you don't, but the web browser does care.
> It's not possible, except by the solutions already provided to you.
> Greetings,
> Laurent
> --
> Laurent Bugnion [MVP ASP.NET]
> Software engineering, Blog: http://www.galasoft-LB.ch
> PhotoAlbum: http://www.galasoft-LB.ch/pictures
> Support children in Calcutta: http://www.calcutta-espoir.ch