Bluehost.com Web Hosting $6.95

Should I use mysql_connect() or mysql_pconnect() ?

This is a discussion on Should I use mysql_connect() or mysql_pconnect() ? within the MySQL Database forums, part of the Database Forums category; If wondering the site has many con-current users, use of persistent connection might block new user from connecting? For ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-03-2006
howa
 
Posts: n/a
Default Should I use mysql_connect() or mysql_pconnect() ?

If wondering the site has many con-current users, use of persistent
connection might block new user from connecting?

For heavy loaded site, which one is better?

Reply With Quote
  #2 (permalink)  
Old 11-03-2006
Axel Schwenke
 
Posts: n/a
Default Re: Should I use mysql_connect() or mysql_pconnect() ?

"howa" <howachen@gmail.com> wrote:
> If wondering the site has many con-current users, use of persistent
> connection might block new user from connecting?
>
> For heavy loaded site, which one is better?


In almost all cases pconnect() causes more problems than it solves.

http://groups.google.com/group/comp....43f0b9e59ad710


XL
--
Axel Schwenke, Senior Software Developer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Reply With Quote
  #3 (permalink)  
Old 11-04-2006
Gordon Burditt
 
Posts: n/a
Default Re: Should I use mysql_connect() or mysql_pconnect() ?

>If wondering the site has many con-current users, use of persistent
>connection might block new user from connecting?
>
>For heavy loaded site, which one is better?


If you have a maximum of N Apache processes (this is an Apache
setting, and may be much larger than the actual number of simultaneous
hits), K different db_host / username / password / db combinations
on your pages, and you use persistent connections, then you'll
eventually have N*K connections, and MySQL had better be able to
handle that many.

On the other hand, if you use mysql_connect(), you'll at most use
a number of connections equal to the max number of simultaneous
hits, which is somewhat less than N.

Reply With Quote
  #4 (permalink)  
Old 11-04-2006
howa
 
Posts: n/a
Default Re: Should I use mysql_connect() or mysql_pconnect() ?


Axel Schwenke wrote:
> "howa" <howachen@gmail.com> wrote:
> > If wondering the site has many con-current users, use of persistent
> > connection might block new user from connecting?
> >
> > For heavy loaded site, which one is better?

>
> In almost all cases pconnect() causes more problems than it solves.
>
> http://groups.google.com/group/comp....43f0b9e59ad710
>
>
> XL
> --
> Axel Schwenke, Senior Software Developer, MySQL AB
>
> Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
> MySQL User Forums: http://forums.mysql.com/


that's great information!

many people believed that pconnect mean scalability but the fact is
not, and in fact it is harmful in a busy site!

thanks.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:03 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0