Torsten Förtsch
IT System Development & Security
Kaum macht man's richtig, schon geht's, ;-)

>> Home >> ModPerl

ModPerl & Apache related stuff

To reach a broader audience this stuff is in English. Native speakers, please bear with me. This is not my mother tongue.

How to work with PostgreSQL notifications in Perl

24.02.2013

PostgreSQL has a nice but almost unknown feature called notifications. It allows you to trigger events in external applications by SQL commands. Thus, a print-on-demand system can for example start printing a book as soon as it is paid for without polling the database on a regular basis.

As an example this article implements a mod_perl and Postgres based chat application.

Asynchronous SQL queries in Perl with PostgreSQL

27.01.2013

This text actually not related to mod_perl. Suppose you have a WEB application based on a PostgreSQL database. Over time the database grows and reveals mistakes in the original design because it takes longer and longer to complete a query. Or perhaps the administrator decided to redesign the indexes and has forgotten about one that is seldom used. Now, suddenly a certain type of requests has become unbearable slow. The surprised user presses Reload again and again. Shortly after that other parts of the application also show signs of serious slow-down or worse stop to work. Does this sound familiar?

The article talks about how to prevent such situations by cancelling the query running wild in time.

Measuring memory consumption

19.12.2010

When working with mod_perl, mod_php or other script languages embedded in the Apache httpd the memory consumption of the whole has to be paid attention. Every now and then people complain on various mailing lists and forums about their WEB server that works for hours, days or weeks and then suddenly becomes unaccessible. Even SSH or login on a console times out or takes almost forever. After a httpd restart everything works as usual again. These are the symptoms one encounter if the httpd working set does not fit into the available RAM.

The basic ideas of this article are quite old. I have done similar measurements in 2004 or even earlier. Nevertheless, I think they are worth to be written down.

How to hand long-running requests over to another process

19.04.2010

Modperl worker processes are usually an expensive resource. Hence, locking up such a thing for a long time is undesirable. So, perhaps it's possible to free the apache worker before the request is actually done and handing the client connection over to another more light-weight process?

This is a follow-up to the server-push clock below.

Bucket brigade based IO in a PerlResponseHandler

18.03.2010

This article shows how to work around a memory leak in $r->print based IO for really large response bodies.

How to deploy mod_proxy as WWW user agent?

15.03.2010

Have you ever asked if it is possible to use mod_proxy in a mod_perl handler to fetch the content of a remote URL? This article explain how to do that.

How to send a custom content type along with a custom response?

14.03.2010

One can set the text sent to the browser in case the request ends in a HTTP error via ErrorDocument or in Perl via $r->custom_response($code, $message). But if I need a special Content-Type header to be passed along, how do I do that? This article explains it.

How to have Apache::Test generate SSL certificates?

13.03.2010

Apache::Test can generate SSL certificates to be used in tests. This article explains how.

How to pass control from an output filter to an ErrorDocument

28.02.2010

A Perl*Handler can normally trigger HTTP error messages like 404 Not Found by simply returning something other than Apache2::Const::OK or Apache2::Const::DECLINED. But there is an exception. Filter handlers can only trigger Apache2::Const::SERVER_ERROR this way. This article explains why and how to circumvent that limitation.