Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

mod_perl and Links SQL

Quote Reply
mod_perl and Links SQL
For those of you who don't know, mod_perl is a technology that allows you to, among other things, embed perl inside of Apache. This has many benefits:

1. You don't need to fork a new process for every cgi script, saving considerable overhead.
2. You don't need to read, parse, compile every cgi script. They stay persistant in memory, already compiled.
3. mod_perl will let you easily use persistent database connections meaning you don't need to connect/disconnect to the database for every request.
4. You can run existing CGI scripts under mod_perl with little modification, or you can create new scripts that can work directly with the Apache API.

Links SQL runs under what is called Apache::Registry in mod_perl. This means when you use Links SQL and mod_perl, all the scripts stay compiled in memory, and the database connection is preserved for really quick performance.

Some questions about mod_perl:

Quote:
A bit off topic, but the problem with mod_perl is that it increases the size of each Apache process _significantly_ on the order of 4meg vs about 1.3 meg (if I remember)

The suggestion for busy sites was to run two versions of Apache, one mod-perl and one plain using the plain for static pages. I'm not sure what the PHP does to the memory usage, since I have no way to directly measure the running process, but I know it increased the binary size about 20%.

I realize none of this is scientific, but do you have any idea how this would relate to LinkSQL -- if a dual server would work better because of the large volume of static pages??

It depends. Wink You should go the dual server root if you get lots of traffic. If you just want quick performance, but typically don't see more then 20-30 concurrent httpd's, I wouldn't worry about it.

The dual server mode works great, and is what we are using here at gossamer-threads.com. Any request to gossamer-threads.com/perl gets behind the scenes proxied to the mod_perl server which returns the results to the user transparently. The end user never knows the difference.

This is great if you get a lot of hits, as you can serve regular html pages, or graphics with your small httpd, and use the mod_perl server only for the cgi programs.

I'd invite you to look at http://perl.apache.org/guide/ for more info, or please feel free to ask here.

Cheers,

Alex
Quote Reply
Re: mod_perl and Links SQL In reply to
Hello !

I am glad to know more about the mod_perl features of Links SQL. But what about php3, which I was interested in knowing? How is it with mod_perl? about persistant database connections memory usage etc.?

------------------
rajani











Quote Reply
Re: mod_perl and Links SQL In reply to
PHP is a different programming language, so Links SQL won't work with it. However, all the information is stored in a SQL database, so you could create a new php script that would access Links SQL data.

I have limited PHP experience, but from what I've heard it's not as versatile as perl, but probably easier to get going for the programming novice.

Cheers,

Alex