Page 1 of 1

Two Processes not ending.

Posted: Fri Feb 04, 2005 5:11 am
by reviewum
Okay, please bear with me. I am by no means a php programmer, but know enough to be dangerous. :)

I recently installed "mytop" found here: http://jeremy.zawodny.com/mysql/mytop/

It is a handy little tool that is "a top clone for MySQL"

Anyway, I ran it and it showed two processes running for CMS. Even though they were listed as "sleeping" it seemed to be a problem that they were still showing up. What's worse is they had been running for 215642 seconds... a long time.. so I killed them both.

I went to a CMS page and only viewed it (didn't log in) and noticed two more processes were opened up. After closing my browser window the processes were still there.

Any ideas what's going on? I have quite a few different applications that access MySQL but none of them leave processes behind.

Thanks in advance!

-Rob

Two Processes not ending.

Posted: Wed Feb 09, 2005 7:41 pm
by reviewum
24 views to this thread and nobody has any ideas why this is happening?

Any suggestions? Is anybody else noticing multiple SQL processes running and hanging around for CMS?

Two Processes not ending.

Posted: Wed Feb 09, 2005 7:46 pm
by Ted
I was wondering if it has something to do persistent mysql connections, but the documentation said that persistent connections don't take effect in cgi mode. Unless for some reason ADODB is messing with that fact...

If you're feeling saucy, look for

Code: Select all

$db->PConnect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
in include.php and change it to

Code: Select all

$db->Connect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
That will get rid of the perisitent connections, though I don't know if it'll help or not.

Two Processes not ending.

Posted: Wed Feb 09, 2005 8:02 pm
by reviewum
wishy, you're a freakin' genius! That worked like a charm!

As I'm no programmer I don't know much about persistent connections, but I've had multiple hosts tell me in the past that if they see persistent connections that I'm going to be in big trouble.

So, are they that bad, and are they necessary?

Two Processes not ending.

Posted: Wed Feb 09, 2005 8:10 pm
by Ted
Well, apparently they're bad if you're using cgi-bin. :) Personally, any hosting company that is using cgi-bin and not allowing persistent connections is nuts.

Basically, everytime time hits a page, php now has to go out to and make a fresh connection to mysql, which takes time and resources. Having a persistent connection to mysql means that every app just has to grab the open connection, do it's thing, and then give it back to php to hand out to someone else. It requires much less resources.

Of course, if you have 20,000 apps running on the same box, then I can see it being a problem...

I guess I can make it optional.