Gossamer Forum
Home : Products : Gossamer Links : Discussions :

speedy cgi? memory usage?

Quote Reply
speedy cgi? memory usage?
I have been experiencing problems with memory shortages... and I'm having trouble determining the cause because I moved to a new dedicated server, upgraded to Links SQL 2 and started using speedy cgi. I also don't know much (if anything) about this.

Can speedy_cgi cause memory problems? ..or is it most likely because I just need more memory to run my database? I already have 512 MB. Maybe someone can help by seeing a sample of my top processes listed by memory usage:

13208 kB /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user ...
(THERE ARE 10 INSTANCES OF THIS--all 13208 kB each)
8076 kB /usr/bin/speedy_backend search.cgi
8036 kB /usr/bin/speedy_backend search.cgi
7296 kB /usr/bin/speedy_backend rate.cgi
6884 kB /usr/bin/speedy_backend nph-build.cgi
6408 kB /usr/bin/speedy_backend nph-index.cgi
6356 kB /usr/bin/speedy_backend jump.cgi
6096 kB /usr/bin/speedy_backend db.cgi
6064 kB /usr/bin/speedy_backend setup.cgi
5864 kB /usr/bin/speedy_backend admin.cgi

I notice that nph-index and nph-build are listed, but I am not indexing or building right now....

Does anyone have any ideas or advice? Your help is appreciated :) Thanks.

Quote Reply
Re: speedy cgi? memory usage? In reply to
>> 13208 kB /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user ...
>> (THERE ARE 10 INSTANCES OF THIS--all 13208 kB each)

This is most likely the problem! You should only have ONE instance of the mysqld server running! You might need to reboot to clear out all the other instances, but I would try shutting down the mysql server first.

Why this happened, is beyond me. If they all have different PID's then you are doing something to cause the server to load more than once.

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: speedy cgi? memory usage? In reply to
Thanks for your reply... :)

I just cleared out all the running processes related to speedy cgi and mysql and restarted the mysql server about an hour ago. There are now already 6 instances running again... some are sub processes of other processes.

I also switched back to not using speedy_cgi to free up some memory. This is a temporary solution while I try to figure out what is wrong. The server has gone down 2-3 times over the past week, and I just realized today that it was probably due to the lack of memory.

I am also using mysql with a forum, and I think it may be causing the multiple instances... I'm going to look into that.

Thanks again for your help.

Quote Reply
UPDATE! :) In reply to
I think this has turned out not to be more related to the forum software. It uses pconnect(), and I've changed it to use just connect()--which I think has taken care of the problem. Pugdog, thanks again for your help.. I didn't realize that seeing multiple mysql processes was not normal. (I learn something new every day!)


Quote Reply
Re: UPDATE! :) In reply to
Sorry pugdog, but multiple mysql is quite normal. On linux you see one mysql process in `ps aux` for each mysql connection you have to the database. In BSD or solaris, you only see one mysql process no matter how many connections you have, so it can be misleading.

Yes, SpeedyCGI is memory intensive. It keeps your perl + cgi scripts in memory. You may want to replace /usr/bin/speedy with /usr/bin/perl on admin scripts where performance isn't as important.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: UPDATE! :) In reply to
Alex,

I guess I've never run Linux, or visited a system running it -- only BSD and Solaris, so I've only seen one process, that hovers between about 17 and 40 meg. Multiple 13 meg processes seems to be wasteful, and it didn't look right. Especially 10 13-meg processes at 130 meg, which is more than double what I've ever seen my mySQL process at even under high load.

If MySQL is spawning a 13 meg process for each connect, then it would seem it, not speedy, is eating up the resources. Together, the two are probably eating up whatever free memory there is.

But it really doesn't seem right that Linux would be using that much resource to run MySQL?





PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: UPDATE! :) In reply to
Hi,

The ps is deceptive because when you see 5-10 processes at 10 MB's of memory each, that does not mean mysql is taking 50-100 MB's of memory. A lot of the memory is shared between all mysql processes, so in reality it's really closer to 10-12 megs of memory in total. It's just how ps displays things that is confusing.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: UPDATE! :) In reply to
Ah, it just reports differently? Or is it actually running differently?

I guess I need to go back to the differences between unix flavors again. Seems I've been in the BSD/Solaris camp, while the rest of the world is marching over to the Linux camp.

This is the type of thing that will come back to bite me if I don't get it figured out now.

Unix is Unix, except when it's Unix.

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: UPDATE! :) In reply to
Hi,

No it just reports it differently. It's how ps works on Linux.

Cheers,

Alex

--
Gossamer Threads Inc.