|
-
Nov 30th, 2004, 11:49 AM
#1
mysql_pconnect
On a page where I use mysql_pconnect, am I supposed to close it again in some way. Or is it done automaticaly?
Last edited by NoteMe; Dec 1st, 2004 at 05:27 PM.
-
Nov 30th, 2004, 05:42 PM
#2
Not persistant connections. They stay open all the time, and may be shared by other scripts. Once all scripts which used persistant connections are finished, I think it will then be closed.
-
Nov 30th, 2004, 09:03 PM
#3
You think or you know... ...well the thing is that I have a lot of pages that uses it on a server. And one of the guys that uses that page got an error today. But it dissapeared by it self.
It said something about too many users online....and I was wondering if it had something to do with the connection and closing to do.
ØØ
-
Dec 1st, 2004, 02:27 AM
#4
A persistant connection doesn't increase the number of users who can log on to the mysql server. It simply allows request for an identical connection from a child process to reuse the same connection. This just reduces the overhead of establishing the link.
If you want to increase the number of users who can logon, which defaults to 100, then you will need to configure this on the mysql server.
http://dev.mysql.com/doc/mysql/en/To...nnections.html
-
Dec 1st, 2004, 04:29 AM
#5
Persistent connections are closed when they time out (18 hours of non-usage by default, I think) or when the owning process (the web server, or at least one of the handler childs in Apache's case) shuts down. No earlier. Calling mysql_close on them has no effect.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 1st, 2004, 09:51 AM
#6
So that means that if we have 100 diffrent users in less then 18 hours then our web pages can't be used anymore before one of the connections gets closed??? Did I understand that right. So that might be the problem with our page?
If so, then I feel I have to write a mail to those who we are renting the server from. THen the number is too low for our use.
ØØ
-
Dec 1st, 2004, 01:20 PM
#7
No, because if all your users who visit the site use the same script, which will connect to the database with the same host name, user name and pass word, the connection will be reused. When you use mysql_pconnect() it only actually makes a new connection if one of the same type does not exist.
The error which you got has nothing to do with this however, its due to the sql server's configuration and occurs when more the number of sinmultanous connections, exceeds the maximum.
-
Dec 1st, 2004, 05:26 PM
#8
OK...so my code is working then....well then we have to slap the server guys so we can have more visitors on at the same time. We don't have more then 50-100k visitors a month, and they should be able to handle that....if not PIIIIP them...
-
Dec 1st, 2004, 06:01 PM
#9
The relevant stat is only how many requests you need to serve at the same time.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 1st, 2004, 06:04 PM
#10
It may be that the same SQL server is being shared with many other sites which have 50-100k hits per month. So it is quite plausable that at anyone time there could be 100 concurrent connectoins.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|