Tuesday, January 22, 2008

Mod_plsql for Apache2

Thanks to Patrick for finding this really interesting post by Joel Kallman.

Finally, mod_plsql has been ported to Apache2. Up until now it was only available and supported for the Oracle Http Server based on Apache (1.3.x).

Using this configuration on a *nix (Linux / Unix) based machine would start a new database session even if the request would only serve a static image. Thus the connection pool of mod_plsql wasn't used at all. This is the first time where I have seen an advantage of the Windows architecture over Linux, bummer.

Thus on Linux you had to be careful planning for your environment if you expected a heavy load, here are some of the typical things to do optimize the performance.

Using Apache 2.0 and the new mod_plsql this should be improved now.



Joel R. Kallman said...

Hi Dietmar,

Using this configuration on a *nix (Linux / Unix) based machine would start a new database session even if the request would only serve a static image. Thus the connection pool of mod_plsql wasn't used at all.

This really isn't a true statement. As I had mentioned, there is a database session per HTTP Server process per DAD. The database session associated with the DAD and the HTTP Server persists across requests. So it's not correct to say that a new database session would be started every time.

Make sense?


Unknown said...

Hi Joel,

yes you are right, my comment was misleading, I was mixing two separate concepts.

1) One thing is the reuse of the database connection held by mod_plsql in a specific http process.

You are right, no new connection is spawned if the existing http process is serving another request. But unfortunately the max. size of the connection pool for the http process is exactly *1*, so there is not much connection pooling going on ;).

Here is the quote from the Oracle documentation:

On UNIX systems, database connections cannot be shared across httpd processes, and process-based platforms have more of a Connection Reuse feature than Connection Pooling. Note that this is an artifact of the process-model in Oracle HTTP Server.

2) The other thing is that the database session is established even if mod_plsql is not used, for example, when a static image is served.
A workaround is to use the two-listener strategy described here:

Why was that done this way anyway? If mod_plsql is not used in this request, why initialize the module and create a database session?

Best regards,

Unknown said...

Hi Joel,

... and thanks for having an eye on me ;). I was not precise enough.


narsah said...

Do you know if there is a version of mod_plsql for the normal apache, too? I don't want to use OHS2.

Unknown said...

Hi Narsah,

well, the mod_plsql can ONLY be used with the Oracle OHS. It might be technically possible but license wise not.

There are a few options out there, personally I would go with DBPrism: http://marceloochoa.blogspot.com/2008/06/new-dbprism-release-apex-users-read.html

I haven't tried it but heard good things about it.

Another option coming up is the APEX Listener that will be available with APEX 4.0. It takes a similiar approach as DBPrism, being a J2EE app in a standard J2EE container.


Hans said...

Hi Dietmar,

thanks for your response. But there is a gpl-release of mod_plsql for Apache 1.3 (http://www.total-knowledge.com/progs/mod_plsql/). I just wondered if someone ported it to Apache 2.x?


Unknown said...

Hi Narsah,

no, I don't know about that. Would be best to ask the guys at total-knowledge since they seem to work on an Apache 2.0 port (http://www.total-knowledge.com/progs/mod_plsql/):

"Next version is currently under development. It will support latest APIs from Oracle, and will work with apache2 and lighttpd. The plan is to implement it using CPPSERV. This will give a lot of extra efficiency, as well as some interesting possibilities, like storing session data in PL/SQL package variables. "


Nevertheless, I would suggest going forward with the APEX 4.0 Listener since the APEX team added some enhancements to it and mod_plsql will only be maintained by oracle in the future, no further development is to be expected.